diff options
-rw-r--r-- | engines/xeen/files.cpp | 13 | ||||
-rw-r--r-- | engines/xeen/map.cpp | 2 |
2 files changed, 8 insertions, 7 deletions
diff --git a/engines/xeen/files.cpp b/engines/xeen/files.cpp index a889cfb95e..375b9df65a 100644 --- a/engines/xeen/files.cpp +++ b/engines/xeen/files.cpp @@ -321,22 +321,23 @@ void File::syncBitFlags(Common::Serializer &s, bool *startP, bool *endP) { byte data = 0; int bitCounter = 0; - for (bool *p = startP; p <= endP; ++p, bitCounter = (bitCounter + 1) % 8) { - if (p == endP || bitCounter == 0) { - if (p != endP || s.isSaving()) + for (bool *p = startP; p < endP; ++p, bitCounter = (bitCounter + 1) % 8) { + if (bitCounter == 0) { + if (s.isLoading() || p != startP) s.syncAsByte(data); - if (p == endP) - break; if (s.isSaving()) data = 0; } if (s.isLoading()) - *p = (data >> bitCounter) != 0; + *p = ((data >> bitCounter) & 1) != 0; else if (*p) data |= 1 << bitCounter; } + + if (s.isSaving()) + s.syncAsByte(data); } /*------------------------------------------------------------------------*/ diff --git a/engines/xeen/map.cpp b/engines/xeen/map.cpp index 27b746e427..611101eac7 100644 --- a/engines/xeen/map.cpp +++ b/engines/xeen/map.cpp @@ -1452,7 +1452,7 @@ void Map::saveMap() { if (!_isOutdoors) { // Iterate through the surrounding mazes for (int mazeIndex = 1; mazeIndex < 9; ++mazeIndex) { - mapId = _mazeData[_mazeDataIndex]._mazeId; + mapId = _mazeData[mazeIndex]._mazeId; if (mapId == 0) continue; |