Skip to content

Commit

Permalink
AGI: Bugfix for script bug #3116541 - "AGI FAN Beyond the Titanic 2: …
Browse files Browse the repository at this point in the history
…Crash on Item Viewing"
  • Loading branch information
bluegr committed Sep 25, 2011
1 parent c02603f commit 0779018
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions engines/agi/objects.cpp
Expand Up @@ -68,15 +68,20 @@ int AgiEngine::decodeObjects(uint8 *mem, uint32 flen) {
for (i = 0, so = spos; i < _game.numObjects; i++, so += padsize) {
int offset;

(_objects + i)->location = *(mem + so + 2);
_objects[i].location = *(mem + so + 2);
offset = READ_LE_UINT16(mem + so) + spos;

if ((uint) offset < flen) {
(_objects + i)->name = (char *)strdup((const char *)mem + offset);
_objects[i].name = (char *)strdup((const char *)mem + offset);
} else {
warning("object %i name beyond object filesize (%04x > %04x)", i, offset, flen);
(_objects + i)->name = strdup("");
_objects[i].name = strdup("");
}

// Don't show the invalid "?" object in ego's inventory in the fanmade
// game Beyond the Titanic 2 (bug #3116541).
if (!strcmp(_objects[i].name, "?") && _objects[i].location == EGO_OWNED)
_objects[i].location = 0;
}
debug(0, "Reading objects: %d objects read.", _game.numObjects);

Expand Down

0 comments on commit 0779018

Please sign in to comment.