Skip to content

Commit

Permalink
Engine: fixed ReadGameData() to read GUID before logging
Browse files Browse the repository at this point in the history
It worked in most cases because there's PreReadGameData() called earlier, but the mistake can be noticed in case RunAGSGame is run.
  • Loading branch information
ivan-mogilko committed Sep 12, 2024
1 parent f7510d8 commit 6baad09
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Common/game/main_game_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -928,10 +928,11 @@ HGameFileError ReadGameData(LoadedGameEntities &ents, std::unique_ptr<Stream> &&
Stream *in = s_in.get(); // for convenience

//-------------------------------------------------------------------------
// The classic data section.
// The standard data section.
//-------------------------------------------------------------------------
GameSetupStruct::SerializeInfo sinfo;
game.GameSetupStructBase::ReadFromFile(in, data_ver, sinfo);
game.read_savegame_info(in, data_ver); // here we also read GUID in v3.* games

Debug::Printf(kDbgMsg_Info, "Game title: '%s'", game.gamename.GetCStr());
Debug::Printf(kDbgMsg_Info, "Game uid (old format): `%d`", game.uniqueid);
Expand All @@ -940,7 +941,6 @@ HGameFileError ReadGameData(LoadedGameEntities &ents, std::unique_ptr<Stream> &&
if (game.GetGameRes().IsNull())
return new MainGameFileError(kMGFErr_InvalidNativeResolution);

game.read_savegame_info(in, data_ver);
game.read_font_infos(in, data_ver);
HGameFileError err = ReadSpriteFlags(ents, in, data_ver);
if (!err)
Expand Down Expand Up @@ -1032,8 +1032,8 @@ void PreReadGameData(GameSetupStruct &game, std::unique_ptr<Stream> &&s_in, Game
{
Stream *in = s_in.get(); // for convenience
GameSetupStruct::SerializeInfo sinfo;
game.ReadFromFile(in, data_ver, sinfo);
game.read_savegame_info(in, data_ver);
game.GameSetupStructBase::ReadFromFile(in, data_ver, sinfo);
game.read_savegame_info(in, data_ver); // here we also read GUID in v3.* games

// Check for particular expansions that might have data necessary
// for "preload" purposes
Expand Down

0 comments on commit 6baad09

Please sign in to comment.