Ticket #1600: mi2-newnames.diff

File mi2-newnames.diff, 1.3 KB (added by eriktorbjorn, 20 years ago)

Patch against an April 18 CVS snapshot

  • scumm/resource.cpp

    diff -ur --exclude=CVS ScummVM/scumm/resource.cpp ScummVM+hack/scumm/resource.cpp
    old new  
    21112111                _numLocalObjects = _fileHandle.readUint16LE();   // 200
    21122112                _numArray = 50;
    21132113                _numVerbs = 100;
    2114                 _numNewNames = 50;
     2114                // 50 isn't enough for MI2. See bug #936323.
     2115                _numNewNames = (_gameId == GID_MONKEY2) ? 100 : 50;
    21152116                _objectRoomTable = NULL;
    21162117
    21172118                _fileHandle.readUint16LE();                      // 50
  • scumm/saveload.cpp

    diff -ur --exclude=CVS ScummVM/scumm/saveload.cpp ScummVM+hack/scumm/saveload.cpp
    old new  
    823823                                        _inventory[idx] = ser->loadUint16();
    824824                                }
    825825                                if (type == rtObjectName && ser->getVersion() >= VER(25)) {
    826                                         _newNames[idx] = ser->loadUint16();
     826                                        // Paranoia: We increased the possible number of new names
     827                                        // for MI2 to fix bug #936323. The savegame format didn't
     828                                        // change, but at least during the transition period there
     829                                        // is a slight chance that we try to load more names than
     830                                        // we have allocated space for. If so, discard them.
     831                                        if (idx < _numNewNames)
     832                                                _newNames[idx] = ser->loadUint16();
    827833                                }
    828834                        }
    829835                }