diff options
author | Max Horn | 2006-04-23 22:39:55 +0000 |
---|---|---|
committer | Max Horn | 2006-04-23 22:39:55 +0000 |
commit | 3f41e2dc2135cc7c41cf504649e8f327635f1a73 (patch) | |
tree | 23e367ad92db4d3a6acc4502ee68a25e10591546 /engines/scumm | |
parent | f776b903d1cbe919108eff9d25f0239ff204a7a7 (diff) | |
download | scummvm-rg350-3f41e2dc2135cc7c41cf504649e8f327635f1a73.tar.gz scummvm-rg350-3f41e2dc2135cc7c41cf504649e8f327635f1a73.tar.bz2 scummvm-rg350-3f41e2dc2135cc7c41cf504649e8f327635f1a73.zip |
Detect (and error out) if readMAXS fails
svn-id: r22120
Diffstat (limited to 'engines/scumm')
-rw-r--r-- | engines/scumm/he/resource_he.cpp | 15 | ||||
-rw-r--r-- | engines/scumm/resource.cpp | 9 |
2 files changed, 14 insertions, 10 deletions
diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp index b2e237e7b6..9bf44b214c 100644 --- a/engines/scumm/he/resource_he.cpp +++ b/engines/scumm/he/resource_he.cpp @@ -1683,9 +1683,8 @@ void ScummEngine_v99he::readMAXS(int blockSize) { _objectRoomTable = (byte *)calloc(_numGlobalObjects, 1); _numGlobalScripts = 2048; - } - - ScummEngine_v90he::readMAXS(blockSize); + } else + ScummEngine_v90he::readMAXS(blockSize); } void ScummEngine_v90he::readMAXS(int blockSize) { @@ -1718,9 +1717,8 @@ void ScummEngine_v90he::readMAXS(int blockSize) { _numGlobalScripts = 2048; else _numGlobalScripts = 200; - } - - ScummEngine_v72he::readMAXS(blockSize); + } else + ScummEngine_v72he::readMAXS(blockSize); } void ScummEngine_v72he::readMAXS(int blockSize) { @@ -1747,9 +1745,8 @@ void ScummEngine_v72he::readMAXS(int blockSize) { _objectRoomTable = (byte *)calloc(_numGlobalObjects, 1); _numGlobalScripts = 200; - } - - ScummEngine_v6::readMAXS(blockSize); + } else + ScummEngine_v6::readMAXS(blockSize); } byte *ScummEngine_v72he::getStringAddress(int i) { diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp index beeff2f63c..c8a886733b 100644 --- a/engines/scumm/resource.cpp +++ b/engines/scumm/resource.cpp @@ -1181,13 +1181,16 @@ void ScummEngine_v6::readMAXS(int blockSize) { _shadowPaletteSize = 256; _shadowPalette = (byte *)calloc(_shadowPaletteSize, 1); } - } + } else + error("readMAXS(%d) failed to read MAXS data", blockSize); } void ScummEngine::readGlobalObjects() { int i; int num = _fileHandle->readUint16LE(); assert(num == _numGlobalObjects); + assert(_objectStateTable); + assert(_objectOwnerTable); _fileHandle->read(_objectOwnerTable, num); for (i = 0; i < num; i++) { @@ -1209,6 +1212,8 @@ void ScummEngine_v8::readGlobalObjects() { int i; int num = _fileHandle->readUint32LE(); assert(num == _numGlobalObjects); + assert(_objectStateTable); + assert(_objectOwnerTable); _objectIDMap = new ObjectNameId[num]; _objectIDMapSize = num; @@ -1233,6 +1238,8 @@ void ScummEngine_v8::readGlobalObjects() { void ScummEngine_v7::readGlobalObjects() { int num = _fileHandle->readUint16LE(); assert(num == _numGlobalObjects); + assert(_objectStateTable); + assert(_objectOwnerTable); _fileHandle->read(_objectStateTable, num); _fileHandle->read(_objectRoomTable, num); |