diff options
author | Matthew Hoops | 2011-09-16 09:17:00 -0400 |
---|---|---|
committer | Matthew Hoops | 2011-09-16 09:17:00 -0400 |
commit | ecde87260c1db0de463f294b551402c08e731d0e (patch) | |
tree | 2416eecc72ecedf62444f7a8722aede9e79923a0 | |
parent | dc0254c1ce10647f179a674e924d17a62640007f (diff) | |
download | scummvm-rg350-ecde87260c1db0de463f294b551402c08e731d0e.tar.gz scummvm-rg350-ecde87260c1db0de463f294b551402c08e731d0e.tar.bz2 scummvm-rg350-ecde87260c1db0de463f294b551402c08e731d0e.zip |
PEGASUS: Fix saving/loading the game state
-rwxr-xr-x | engines/pegasus/gamestate.cpp | 6 | ||||
-rwxr-xr-x | engines/pegasus/gamestate.h | 5 |
2 files changed, 7 insertions, 4 deletions
diff --git a/engines/pegasus/gamestate.cpp b/engines/pegasus/gamestate.cpp index bc88c5ed22..5c889bdd20 100755 --- a/engines/pegasus/gamestate.cpp +++ b/engines/pegasus/gamestate.cpp @@ -45,6 +45,7 @@ Common::Error GameStateManager::writeGameState(Common::WriteStream *stream) { stream->writeByte(_nextDirection); stream->writeUint16BE(_lastNeighborhood); stream->writeUint16BE(_lastRoom); + stream->writeByte(_lastDirection); stream->writeUint16BE(_openDoorRoom); stream->writeByte(_openDoorDirection); @@ -74,6 +75,7 @@ Common::Error GameStateManager::readGameState(Common::ReadStream *stream) { _nextDirection = stream->readByte(); _lastNeighborhood = stream->readUint16BE(); _lastRoom = stream->readUint16BE(); + _lastDirection = stream->readByte(); _openDoorRoom = stream->readUint16BE(); _openDoorDirection = stream->readByte(); @@ -599,13 +601,13 @@ void GameStateManager::resetPrehistoricState() { void GameStateManager::writeNoradState(Common::WriteStream *stream) { _noradFlags.writeToStream(stream); stream->writeUint16BE(_noradSubRoomPressure); - stream->writeUint32BE(_noradSubPrepState); // FIXME: sizeof(enum)! + stream->writeByte(_noradSubPrepState); } void GameStateManager::readNoradState(Common::ReadStream *stream) { _noradFlags.readFromStream(stream); _noradSubRoomPressure = stream->readUint16BE(); - _noradSubPrepState = (tNoradSubPrepState)stream->readUint32BE(); // FIXME: sizeof(enum)! + _noradSubPrepState = (tNoradSubPrepState)stream->readByte(); } void GameStateManager::resetNoradState() { diff --git a/engines/pegasus/gamestate.h b/engines/pegasus/gamestate.h index 4118b5d519..f3568295d6 100755 --- a/engines/pegasus/gamestate.h +++ b/engines/pegasus/gamestate.h @@ -27,6 +27,7 @@ #define PEGASUS_GAMESTATE_H #include "common/singleton.h" +#include "common/util.h" #include "pegasus/types.h" #include "pegasus/items/item.h" @@ -879,7 +880,7 @@ private: return; } - for (uint32 i = 0; i < sizeof(_flags); i++) { + for (uint32 i = 0; i < ARRAYSIZE(_flags); i++) { if (sizeof(Unit) == 2) _flags[i] = stream->readUint16BE(); else /* if (sizeof(Unit) == 4) */ @@ -894,7 +895,7 @@ private: return; } - for (uint32 i = 0; i < sizeof(_flags); i++) { + for (uint32 i = 0; i < ARRAYSIZE(_flags); i++) { if (sizeof(Unit) == 2) stream->writeUint16BE(_flags[i]); else /* if (sizeof(Unit) == 4) */ |