File tree Expand file tree Collapse file tree 4 files changed +22
-12
lines changed
Expand file tree Collapse file tree 4 files changed +22
-12
lines changed Original file line number Diff line number Diff line change @@ -200,6 +200,11 @@ static void restartMissionMenu()
200200 Int gameMode = TheGameLogic->getGameMode ();
201201 AsciiString mapName = TheGlobalData->m_mapName ;
202202
203+ // TheSuperHackers @bugfix Caball009 07/02/2026 Reuse the previous seed value for the new skirmish match to prevent mismatches.
204+ // Campaign, challenge, and skirmish single-player scenarios all use GAME_SINGLE_PLAYER and are expected to use 0 as seed value.
205+ DEBUG_ASSERTCRASH ((TheSkirmishGameInfo != nullptr ) == (gameMode == GAME_SKIRMISH), (" Unexpected game mode on map / mission restart" ));
206+ const Int seed = TheSkirmishGameInfo ? TheSkirmishGameInfo->getSeed () : 0 ;
207+
203208 //
204209 // if the map name was from a save game it will have "Save/" at the front of it,
205210 // we want to go back to the original pristine map string for the map name when restarting
@@ -238,11 +243,8 @@ static void restartMissionMenu()
238243 TheScriptEngine->getGlobalDifficulty (),
239244 rankPointsStartedWith)
240245 );
241- // if (TheGlobalData->m_fixedSeed >= 0)
242- // InitRandom(TheGlobalData->m_fixedSeed);
243- InitRandom (0 );
244- // else
245- // InitGameLogicRandom(GameClientRandomValue(0, INT_MAX - 1));
246+
247+ InitRandom (seed);
246248 }
247249 // TheTransitionHandler->remove("QuitFull"); //KRISMORNESS ADD
248250 // quitMenuLayout = nullptr; //KRISMORNESS ADD
Original file line number Diff line number Diff line change @@ -420,7 +420,6 @@ void reallyDoStart( void )
420420
421421 TheWritableGlobalData->m_mapName = TheSkirmishGameInfo->getMap ();
422422 TheSkirmishGameInfo->startGame (0 );
423- InitGameLogicRandom (TheSkirmishGameInfo->getSeed ());
424423
425424 Bool isSkirmish = TRUE ;
426425 const MapMetaData *md = TheMapCache->findMap (TheSkirmishGameInfo->getMap ());
@@ -431,6 +430,8 @@ void reallyDoStart( void )
431430
432431 if (isSkirmish)
433432 {
433+ InitGameLogicRandom (TheSkirmishGameInfo->getSeed ());
434+
434435 GameMessage *msg = TheMessageStream->appendMessage ( GameMessage::MSG_NEW_GAME );
435436 msg->appendIntegerArgument (GAME_SKIRMISH);
436437 msg->appendIntegerArgument (DIFFICULTY_NORMAL); // not really used; just specified so we can add the game speed last
@@ -439,6 +440,8 @@ void reallyDoStart( void )
439440 }
440441 else
441442 {
443+ InitGameLogicRandom (0 );
444+
442445 GameMessage *msg = TheMessageStream->appendMessage ( GameMessage::MSG_NEW_GAME );
443446 msg->appendIntegerArgument (GAME_SINGLE_PLAYER);
444447 msg->appendIntegerArgument (DIFFICULTY_NORMAL); // not really used; just specified so we can add the game speed last
Original file line number Diff line number Diff line change @@ -200,6 +200,11 @@ static void restartMissionMenu()
200200 Int gameMode = TheGameLogic->getGameMode ();
201201 AsciiString mapName = TheGlobalData->m_mapName ;
202202
203+ // TheSuperHackers @bugfix Caball009 07/02/2026 Reuse the previous seed value for the new skirmish match to prevent mismatches.
204+ // Campaign, challenge, and skirmish single-player scenarios all use GAME_SINGLE_PLAYER and are expected to use 0 as seed value.
205+ DEBUG_ASSERTCRASH ((TheSkirmishGameInfo != nullptr ) == (gameMode == GAME_SKIRMISH), (" Unexpected game mode on map / mission restart" ));
206+ const Int seed = TheSkirmishGameInfo ? TheSkirmishGameInfo->getSeed () : 0 ;
207+
203208 //
204209 // if the map name was from a save game it will have "Save/" at the front of it,
205210 // we want to go back to the original pristine map string for the map name when restarting
@@ -238,11 +243,8 @@ static void restartMissionMenu()
238243 TheScriptEngine->getGlobalDifficulty (),
239244 rankPointsStartedWith)
240245 );
241- // if (TheGlobalData->m_fixedSeed >= 0)
242- // InitRandom(TheGlobalData->m_fixedSeed);
243- InitRandom (0 );
244- // else
245- // InitGameLogicRandom(GameClientRandomValue(0, INT_MAX - 1));
246+
247+ InitRandom (seed);
246248 }
247249 // TheTransitionHandler->remove("QuitFull"); //KRISMORNESS ADD
248250 // quitMenuLayout = nullptr; //KRISMORNESS ADD
Original file line number Diff line number Diff line change @@ -431,7 +431,6 @@ void reallyDoStart( void )
431431
432432 TheWritableGlobalData->m_mapName = TheSkirmishGameInfo->getMap ();
433433 TheSkirmishGameInfo->startGame (0 );
434- InitGameLogicRandom (TheSkirmishGameInfo->getSeed ());
435434
436435 Bool isSkirmish = TRUE ;
437436 const MapMetaData *md = TheMapCache->findMap (TheSkirmishGameInfo->getMap ());
@@ -442,6 +441,8 @@ void reallyDoStart( void )
442441
443442 if (isSkirmish)
444443 {
444+ InitGameLogicRandom (TheSkirmishGameInfo->getSeed ());
445+
445446 GameMessage *msg = TheMessageStream->appendMessage ( GameMessage::MSG_NEW_GAME );
446447 msg->appendIntegerArgument (GAME_SKIRMISH);
447448 msg->appendIntegerArgument (DIFFICULTY_NORMAL); // not really used; just specified so we can add the game speed last
@@ -450,6 +451,8 @@ void reallyDoStart( void )
450451 }
451452 else
452453 {
454+ InitGameLogicRandom (0 );
455+
453456 GameMessage *msg = TheMessageStream->appendMessage ( GameMessage::MSG_NEW_GAME );
454457 msg->appendIntegerArgument (GAME_SINGLE_PLAYER);
455458 msg->appendIntegerArgument (DIFFICULTY_NORMAL); // not really used; just specified so we can add the game speed last
You can’t perform that action at this time.
0 commit comments