diff options
-rw-r--r-- | engines/agi/preagi_mickey.cpp | 15 | ||||
-rw-r--r-- | engines/agi/preagi_mickey.h | 6 |
2 files changed, 14 insertions, 7 deletions
diff --git a/engines/agi/preagi_mickey.cpp b/engines/agi/preagi_mickey.cpp index 08f8969ca3..b9591d1f2d 100644 --- a/engines/agi/preagi_mickey.cpp +++ b/engines/agi/preagi_mickey.cpp @@ -932,10 +932,17 @@ bool Mickey::loadGame() { if (_vm->getSelection(kSelAnyKey) == 0) return false; } else { - if (infile->readUint32BE() != MKID_BE('MICK')) - error("Mickey::loadGame wrong save game format"); + if (infile->readUint32BE() != MKID_BE('MICK')) { + warning("Mickey::loadGame wrong save game format"); + return false; + } saveVersion = infile->readByte(); + if (saveVersion < 2) { + warning("The planet data in this save game is corrupted. Load aborted"); + return false; + } + if (saveVersion != MSA_SAVEGAME_VERSION) warning("Old save game version (%d, current version is %d). Will try and read anyway, but don't be surprised if bad things happen", saveVersion, MSA_SAVEGAME_VERSION); @@ -953,7 +960,7 @@ bool Mickey::loadGame() { _game.iPlanetXtal[i] = infile->readByte(); for(i = 0; i < IDI_MSA_MAX_PLANET; i++) - _game.iClue[i] = infile->readByte(); + _game.iClue[i] = infile->readUint16LE(); infile->read(_game.szAddr, IDI_MSA_MAX_BUTTON + 1); @@ -1058,7 +1065,7 @@ void Mickey::saveGame() { outfile->writeByte(_game.iPlanetXtal[i]); for(i = 0; i < IDI_MSA_MAX_PLANET; i++) - outfile->writeByte(_game.iClue[i]); + outfile->writeUint16LE(_game.iClue[i]); outfile->write(_game.szAddr, IDI_MSA_MAX_BUTTON + 1); diff --git a/engines/agi/preagi_mickey.h b/engines/agi/preagi_mickey.h index 8d982dc401..f29d2fbccd 100644 --- a/engines/agi/preagi_mickey.h +++ b/engines/agi/preagi_mickey.h @@ -30,7 +30,7 @@ namespace Agi { -#define MSA_SAVEGAME_VERSION 1 +#define MSA_SAVEGAME_VERSION 2 // strings #define IDS_MSA_PATH_DAT "dat/%s" @@ -637,7 +637,7 @@ const int IDO_MSA_NEXT_PIECE[IDI_MSA_MAX_PLANET][5] = { {0x5B78, 0x5BB6, 0x5C29, 0x5C76, 0x5CE1}, // pluto {0x526B, 0x52DA, 0x5340, 0x53A1, 0x540C}, // jupiter {0x50F6, 0x512C, 0x5170, 0x51D5, 0x5228}, // mars - {0x56AA, 0x571C, 0x579E, 0x5807, 0x5875} // uranus + {0x56AA, 0x571C, 0x579E, 0x5807, 0x5875} // uranus }; // message offsets @@ -697,7 +697,7 @@ struct MSA_GAME { uint8 nXtals; uint8 iPlanetXtal[IDI_MSA_MAX_DAT]; - uint8 iClue[IDI_MSA_MAX_PLANET]; + uint16 iClue[IDI_MSA_MAX_PLANET]; char szAddr[IDI_MSA_MAX_BUTTON + 1]; // Flags |