aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2013-04-21 00:40:09 +0200
committerStrangerke2013-04-21 00:40:09 +0200
commit48c62cbb7dbc24b9d6f94c728b419a4eca067f75 (patch)
treeaeadd90d61241cbab3415310dd3cfde50fda8eed /engines
parentf66e702e013fcdf95bb10f4fae7105259c3c9d27 (diff)
downloadscummvm-rg350-48c62cbb7dbc24b9d6f94c728b419a4eca067f75.tar.gz
scummvm-rg350-48c62cbb7dbc24b9d6f94c728b419a4eca067f75.tar.bz2
scummvm-rg350-48c62cbb7dbc24b9d6f94c728b419a4eca067f75.zip
HOPKINS: Fix code related to _zoneLine
Diffstat (limited to 'engines')
-rw-r--r--engines/hopkins/lines.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp
index 89bc4ecddd..0365d33a3f 100644
--- a/engines/hopkins/lines.cpp
+++ b/engines/hopkins/lines.cpp
@@ -33,10 +33,11 @@ namespace Hopkins {
LinesManager::LinesManager(HopkinsEngine *vm) {
_vm = vm;
- for (int i = 0; i < MAX_LINES; ++i) {
+ for (int i = 0; i < MAX_LINES + 1; ++i)
Common::fill((byte *)&_zoneLine[i], (byte *)&_zoneLine[i] + sizeof(LigneZoneItem), 0);
+
+ for (int i = 0; i < MAX_LINES; ++i)
Common::fill((byte *)&_lineItem[i], (byte *)&_lineItem[i] + sizeof(LigneItem), 0);
- }
for (int i = 0; i < 4000; ++i)
Common::fill((byte *)&_smoothRoute[i], (byte *)&_smoothRoute[i] + sizeof(SmoothItem), 0);
@@ -208,7 +209,7 @@ void LinesManager::addZoneLine(int idx, int fromX, int fromY, int destX, int des
_bobZoneFl[bobZoneIdx] = true;
_bobZone[bobZoneIdx] = fromY;
} else {
- assert (idx < MAX_LINES);
+ assert (idx < MAX_LINES + 1);
_zoneLine[idx]._zoneData = (int16 *)_vm->_globals->freeMemory((byte *)_zoneLine[idx]._zoneData);
int distX = abs(fromX - destX);
@@ -2695,7 +2696,7 @@ void LinesManager::initSquareZones() {
curZone->_maxZoneLineIdx = 0;
}
- for (int idx = 0; idx < MAX_LINES; ++idx) {
+ for (int idx = 0; idx < MAX_LINES + 1; ++idx) {
int16 *dataP = _zoneLine[idx]._zoneData;
if (dataP == NULL)
continue;
@@ -2778,7 +2779,7 @@ void LinesManager::clearAllZones() {
* Remove Zone Line
*/
void LinesManager::removeZoneLine(int idx) {
- assert (idx < MAX_LINES);
+ assert (idx < MAX_LINES + 1);
_zoneLine[idx]._zoneData = (int16 *)_vm->_globals->freeMemory((byte *)_zoneLine[idx]._zoneData);
}