aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2017-12-27 01:45:38 -0500
committerPaul Gilbert2017-12-27 01:45:38 -0500
commit4f099a8fff0930a81c085dc8aa6be1b46a3ba491 (patch)
treeef7a5d450c5b5b759c903415e540899151878661 /engines
parent1fa80ea3a35a4086c627228b834c0e17c4aa3cc1 (diff)
downloadscummvm-rg350-4f099a8fff0930a81c085dc8aa6be1b46a3ba491.tar.gz
scummvm-rg350-4f099a8fff0930a81c085dc8aa6be1b46a3ba491.tar.bz2
scummvm-rg350-4f099a8fff0930a81c085dc8aa6be1b46a3ba491.zip
XEEN: Fix saving of map stepped on tiles
Diffstat (limited to 'engines')
-rw-r--r--engines/xeen/files.cpp13
-rw-r--r--engines/xeen/map.cpp2
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;