aboutsummaryrefslogtreecommitdiff
path: root/engines/teenagent
diff options
context:
space:
mode:
authorVladimir Menshakov2010-03-20 22:03:28 +0000
committerVladimir Menshakov2010-03-20 22:03:28 +0000
commit933299f6b9360299e5799d835d1cff7acfe93cf6 (patch)
tree4948532759b799bd93ce848b569705e2f62d69cc /engines/teenagent
parent22dd1a616f4c763936e9227fbc96a2414c5acb7c (diff)
downloadscummvm-rg350-933299f6b9360299e5799d835d1cff7acfe93cf6.tar.gz
scummvm-rg350-933299f6b9360299e5799d835d1cff7acfe93cf6.tar.bz2
scummvm-rg350-933299f6b9360299e5799d835d1cff7acfe93cf6.zip
fixed inventory object overflow
svn-id: r48341
Diffstat (limited to 'engines/teenagent')
-rw-r--r--engines/teenagent/inventory.cpp5
-rw-r--r--engines/teenagent/inventory.h2
2 files changed, 4 insertions, 3 deletions
diff --git a/engines/teenagent/inventory.cpp b/engines/teenagent/inventory.cpp
index 3e04dcdd7e..b0fe6a009a 100644
--- a/engines/teenagent/inventory.cpp
+++ b/engines/teenagent/inventory.cpp
@@ -56,12 +56,13 @@ void Inventory::init(TeenAgentEngine *engine) {
byte offsets = items[0];
assert(offsets == 92);
- for (byte i = 0; i <= offsets; ++i) {
+ for (byte i = 0; i < offsets; ++i) {
offset[i] = READ_LE_UINT16(items + i * 2 + 1);
}
+ offset[92] = items_size;
Resources *res = Resources::instance();
- for (byte i = 0; i <= 92; ++i) {
+ for (byte i = 0; i < 92; ++i) {
InventoryObject io;
uint16 obj_addr = res->dseg.get_word(0xc4a4 + i * 2);
if (obj_addr != 0)
diff --git a/engines/teenagent/inventory.h b/engines/teenagent/inventory.h
index 8b302055b8..bce27c0cce 100644
--- a/engines/teenagent/inventory.h
+++ b/engines/teenagent/inventory.h
@@ -59,7 +59,7 @@ private:
TeenAgentEngine *_engine;
Surface background;
byte *items;
- uint16 offset[93];
+ uint offset[93];
Common::Array<InventoryObject> objects;
byte *inventory;