Skip to content

Commit

Permalink
Engine: fixed save ver constants for Characters and RoomStates
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-mogilko committed Oct 23, 2023
1 parent 9159ea3 commit 7871326
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Engine/ac/characterextras.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ using namespace AGS; // FIXME later
enum CharacterSvgVersion
{
kCharSvgVersion_Initial = 0,
// 1 was skipped somehow
kCharSvgVersion_350 = 1, // new movelist format (along with pathfinder)
kCharSvgVersion_36025 = 2, // animation volume
kCharSvgVersion_36109 = 3, // removed movelists, save externally
};
Expand Down
4 changes: 2 additions & 2 deletions Engine/ac/roomstatus.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ struct HotspotState
enum RoomStatSvgVersion
{
kRoomStatSvgVersion_Initial = 0,
kRoomStatSvgVersion_36016 = 1, // hotspot and object names
// 2 was practically unused
kRoomStatSvgVersion_350 = 1, // new movelist format (along with pathfinder)
kRoomStatSvgVersion_36016 = 2, // hotspot and object names
kRoomStatSvgVersion_36025 = 3, // object animation volume
kRoomStatSvgVersion_36041 = 4, // room state's contentFormat
kRoomStatSvgVersion_36109 = 5, // removed movelists, save externally
Expand Down
7 changes: 4 additions & 3 deletions Engine/game/savegame_components.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,7 @@ HSaveError ReadCharacters(Stream *in, int32_t cmp_ver, const PreservedParams& /*
HSaveError err;
if (!AssertGameContent(err, in->ReadInt32(), game.numcharacters, "Characters"))
return err;
const int mls_cmp_ver = cmp_ver > kCharSvgVersion_Initial ? kMoveSvgVersion_350 : kMoveSvgVersion_Initial;
for (int i = 0; i < game.numcharacters; ++i)
{
game.chars[i].ReadFromFile(in, kGameVersion_Undefined, cmp_ver);
Expand All @@ -566,9 +567,9 @@ HSaveError ReadCharacters(Stream *in, int32_t cmp_ver, const PreservedParams& /*
if (loaded_game_file_version <= kGameVersion_272)
ReadTimesRun272(*game.intrChar[i], in);
// character movement path (for old saves)
if (cmp_ver < 3)
if (cmp_ver < kCharSvgVersion_36109)
{
err = mls[CHMLSOFFS + i].ReadFromFile(in, cmp_ver > 0 ? 1 : 0);
err = mls[CHMLSOFFS + i].ReadFromFile(in, mls_cmp_ver);
if (!err)
return err;
}
Expand Down Expand Up @@ -1102,7 +1103,7 @@ HSaveError ReadThisRoom(Stream *in, int32_t cmp_ver, const PreservedParams& /*pp
int objmls_count = in->ReadInt32();
if (!AssertCompatLimit(err, objmls_count, CHMLSOFFS, "room object move lists"))
return err;
const int mls_cmp_ver = cmp_ver > 0 ? 1 : 0;
const int mls_cmp_ver = cmp_ver > kRoomStatSvgVersion_Initial ? kMoveSvgVersion_350 : kMoveSvgVersion_Initial;
for (int i = 0; i < objmls_count; ++i)
{
err = mls[i].ReadFromFile(in, mls_cmp_ver);
Expand Down

0 comments on commit 7871326

Please sign in to comment.