DRASCULA: Fix invalid memory access on inventory screen

When clicking outside of all inventory objects, the whichObject()
function would return 43, which is an invalid inventoryObjects[]
index. I think that's what caused it to crash for me. There are a
few other inventoryObjects[]-related changes as well.

svn-id: r52843
This commit is contained in:
Torbjörn Andersson 2010-09-21 17:18:32 +00:00
parent ca767d5913
commit 88e25e6f25
3 changed files with 12 additions and 12 deletions

View file

@ -210,7 +210,7 @@ bool DrasculaEngine::loadGame(const char *gameName) {
curY = sav->readSint32LE();
trackProtagonist = sav->readSint32LE();
for (l = 1; l < 43; l++) {
for (l = 1; l < ARRAYSIZE(inventoryObjects); l++) {
inventoryObjects[l] = sav->readSint32LE();
}
@ -241,7 +241,7 @@ void DrasculaEngine::saveGame(char gameName[]) {
out->writeSint32LE(curY);
out->writeSint32LE(trackProtagonist);
for (l = 1; l < 43; l++) {
for (l = 1; l < ARRAYSIZE(inventoryObjects); l++) {
out->writeSint32LE(inventoryObjects[l]);
}