aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen/map.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2015-01-25 20:05:35 -0500
committerPaul Gilbert2015-01-25 20:05:35 -0500
commit84741d73a09f45232b0dccd26df5b05eb6c80476 (patch)
treec463be82406d200e0e22cad9691a595dd5a4e81b /engines/xeen/map.cpp
parent94ce2c1e6f46a858725dfab2c587f5069acdef8b (diff)
downloadscummvm-rg350-84741d73a09f45232b0dccd26df5b05eb6c80476.tar.gz
scummvm-rg350-84741d73a09f45232b0dccd26df5b05eb6c80476.tar.bz2
scummvm-rg350-84741d73a09f45232b0dccd26df5b05eb6c80476.zip
XEEN: Properly clear previous MazeData when loading a new map
Diffstat (limited to 'engines/xeen/map.cpp')
-rw-r--r--engines/xeen/map.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/engines/xeen/map.cpp b/engines/xeen/map.cpp
index 52dc4273aa..51e87ef97e 100644
--- a/engines/xeen/map.cpp
+++ b/engines/xeen/map.cpp
@@ -491,6 +491,10 @@ void MonsterData::synchronize(Common::SeekableReadStream &s) {
/*------------------------------------------------------------------------*/
SurroundingMazes::SurroundingMazes() {
+ clear();
+}
+
+void SurroundingMazes::clear() {
_north = 0;
_east = 0;
_south = 0;
@@ -541,6 +545,10 @@ void MazeDifficulties::synchronize(Common::SeekableReadStream &s) {
/*------------------------------------------------------------------------*/
MazeData::MazeData() {
+ clear();
+}
+
+void MazeData::clear() {
for (int y = 0; y < MAP_HEIGHT; ++y) {
for (int x = 0; x < MAP_WIDTH; ++x)
_wallData[y][x]._data = 0;
@@ -550,6 +558,7 @@ MazeData::MazeData() {
_surfaceTypes[y] = 0;
}
_mazeNumber = 0;
+ _surroundingMazes.clear();
_mazeFlags = _mazeFlags2 = 0;
_floorType = 0;
_trapDamage = 0;
@@ -963,7 +972,9 @@ void Map::load(int mapId) {
for (int idx = 0; idx < 9; ++idx, ++mazeDataP) {
mazeDataP->_mazeId = mapId;
- if (mapId != 0) {
+ if (mapId == 0) {
+ mazeDataP->clear();
+ } else {
// Load in the maze's data file
Common::String datName = Common::String::format("maze%c%03d.dat",
(mapId >= 100) ? 'x' : '0', mapId);