diff options
author | Paul Gilbert | 2014-11-23 17:55:55 -0500 |
---|---|---|
committer | Paul Gilbert | 2014-12-12 22:40:44 -0500 |
commit | d2d75dd4a7b3b7d2a90186adf82d45c1c18e3c2a (patch) | |
tree | b207931742275131ecd1a328faf334c90e4efb0c /engines/access | |
parent | 08c65399002ffa7c1d5f055c242996ff0f416fad (diff) | |
download | scummvm-rg350-d2d75dd4a7b3b7d2a90186adf82d45c1c18e3c2a.tar.gz scummvm-rg350-d2d75dd4a7b3b7d2a90186adf82d45c1c18e3c2a.tar.bz2 scummvm-rg350-d2d75dd4a7b3b7d2a90186adf82d45c1c18e3c2a.zip |
ACCESS: Workaround for original game bug doing inventory check
In scene 31, moving the corrugated metal does a check on an invalid item
index
Diffstat (limited to 'engines/access')
-rw-r--r-- | engines/access/inventory.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/engines/access/inventory.cpp b/engines/access/inventory.cpp index 34470ace1e..11baa8fc08 100644 --- a/engines/access/inventory.cpp +++ b/engines/access/inventory.cpp @@ -87,7 +87,10 @@ InventoryManager::InventoryManager(AccessEngine *vm) : Manager(vm) { } int &InventoryManager::operator[](int idx) { - return _inv[idx]._value; + // WORKAROUND: At least in Amazon, some game scripts accidentally do reads + // beyond the length of the inventory array + static int invalid = 0; + return (idx >= _inv.size()) ? invalid : _inv[idx]._value; } int InventoryManager::useItem() { |