Skip to content

Commit c5d839e

Browse files
authored
bugfix(replay): Fix unrecognized replay files in Generals (#1815)
1 parent 0bb57b2 commit c5d839e

File tree

2 files changed

+40
-14
lines changed

2 files changed

+40
-14
lines changed

Generals/Code/GameEngine/Source/GameNetwork/GameInfo.cpp

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,8 +1023,15 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options)
10231023
Money startingCash = TheGlobalData->m_defaultStartingCash;
10241024
UnsignedShort restriction = 0; // Always the default
10251025

1026-
Bool sawMap, sawMapCRC, sawMapSize, sawSeed, sawSlotlist, sawUseStats, sawSuperweaponRestriction, sawStartingCash, sawOldFactions;
1027-
sawMap = sawMapCRC = sawMapSize = sawSeed = sawSlotlist = sawUseStats = sawSuperweaponRestriction = sawStartingCash = sawOldFactions = FALSE;
1026+
Bool sawMap = FALSE;
1027+
Bool sawMapCRC = FALSE;
1028+
Bool sawMapSize = FALSE;
1029+
Bool sawSeed = FALSE;
1030+
Bool sawSlotlist = FALSE;
1031+
Bool sawUseStats = FALSE;
1032+
Bool sawSuperweaponRestriction = FALSE;
1033+
Bool sawStartingCash = FALSE;
1034+
Bool sawOldFactions = FALSE;
10281035

10291036
//DEBUG_LOG(("Saw options of %s", options.str()));
10301037
DEBUG_LOG(("ParseAsciiStringToGameInfo - parsing [%s]", options.str()));
@@ -1472,8 +1479,14 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options)
14721479

14731480
free(buf);
14741481

1475-
//DEBUG_LOG(("Options were ok == %d", optionsOk));
1476-
if (optionsOk && sawMap && sawMapCRC && sawMapSize && sawSeed && sawSlotlist && sawCRC && sawUseStats && sawSuperweaponRestriction && sawStartingCash && sawOldFactions )
1482+
// TheSuperHackers @tweak The following settings are no longer
1483+
// a strict requirement in the Zero Hour Replay file:
1484+
// * UseStats
1485+
// * SuperweaponRestriction
1486+
// * StartingCash
1487+
// * OldFactionsOnly
1488+
// In Generals they never were.
1489+
if (optionsOk && sawMap && sawMapCRC && sawMapSize && sawSeed && sawSlotlist && sawCRC)
14771490
{
14781491
// We were setting the Global Data directly here, but Instead, I'm now
14791492
// first setting the data in game. We'll set the global data when
@@ -1493,9 +1506,9 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options)
14931506
game->setSeed(seed);
14941507
game->setCRCInterval(crc);
14951508
game->setUseStats(useStats);
1496-
game->setSuperweaponRestriction(restriction);
1497-
game->setStartingCash( startingCash );
1498-
game->setOldFactionsOnly( oldFactionsOnly );
1509+
game->setSuperweaponRestriction(restriction);
1510+
game->setStartingCash(startingCash);
1511+
game->setOldFactionsOnly(oldFactionsOnly);
14991512

15001513
return true;
15011514
}

GeneralsMD/Code/GameEngine/Source/GameNetwork/GameInfo.cpp

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,8 +1023,15 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options)
10231023
Money startingCash = TheGlobalData->m_defaultStartingCash;
10241024
UnsignedShort restriction = 0; // Always the default
10251025

1026-
Bool sawMap, sawMapCRC, sawMapSize, sawSeed, sawSlotlist, sawUseStats, sawSuperweaponRestriction, sawStartingCash, sawOldFactions;
1027-
sawMap = sawMapCRC = sawMapSize = sawSeed = sawSlotlist = sawUseStats = sawSuperweaponRestriction = sawStartingCash = sawOldFactions = FALSE;
1026+
Bool sawMap = FALSE;
1027+
Bool sawMapCRC = FALSE;
1028+
Bool sawMapSize = FALSE;
1029+
Bool sawSeed = FALSE;
1030+
Bool sawSlotlist = FALSE;
1031+
Bool sawUseStats = FALSE;
1032+
Bool sawSuperweaponRestriction = FALSE;
1033+
Bool sawStartingCash = FALSE;
1034+
Bool sawOldFactions = FALSE;
10281035

10291036
//DEBUG_LOG(("Saw options of %s", options.str()));
10301037
DEBUG_LOG(("ParseAsciiStringToGameInfo - parsing [%s]", options.str()));
@@ -1472,8 +1479,14 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options)
14721479

14731480
free(buf);
14741481

1475-
//DEBUG_LOG(("Options were ok == %d", optionsOk));
1476-
if (optionsOk && sawMap && sawMapCRC && sawMapSize && sawSeed && sawSlotlist && sawCRC && sawUseStats && sawSuperweaponRestriction && sawStartingCash && sawOldFactions )
1482+
// TheSuperHackers @tweak The following settings are no longer
1483+
// a strict requirement in the Zero Hour Replay file:
1484+
// * UseStats
1485+
// * SuperweaponRestriction
1486+
// * StartingCash
1487+
// * OldFactionsOnly
1488+
// In Generals they never were.
1489+
if (optionsOk && sawMap && sawMapCRC && sawMapSize && sawSeed && sawSlotlist && sawCRC)
14771490
{
14781491
// We were setting the Global Data directly here, but Instead, I'm now
14791492
// first setting the data in game. We'll set the global data when
@@ -1493,9 +1506,9 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options)
14931506
game->setSeed(seed);
14941507
game->setCRCInterval(crc);
14951508
game->setUseStats(useStats);
1496-
game->setSuperweaponRestriction(restriction);
1497-
game->setStartingCash( startingCash );
1498-
game->setOldFactionsOnly( oldFactionsOnly );
1509+
game->setSuperweaponRestriction(restriction);
1510+
game->setStartingCash(startingCash);
1511+
game->setOldFactionsOnly(oldFactionsOnly);
14991512

15001513
return true;
15011514
}

0 commit comments

Comments
 (0)