diff options
-rw-r--r-- | engines/kyra/script_v2.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/engines/kyra/script_v2.cpp b/engines/kyra/script_v2.cpp index 6f8f2962e8..0fe07ab93a 100644 --- a/engines/kyra/script_v2.cpp +++ b/engines/kyra/script_v2.cpp @@ -274,8 +274,8 @@ int KyraEngine_v2::o2_defineItem(ScriptState *script) { } int KyraEngine_v2::o2_countItemInInventory(ScriptState *script) { - debugC(3, kDebugLevelScriptFuncs, "o2_countItemInInventory(%p) (%d)", (const void *)script, stackPos(0)); - uint16 item = stackPos(0); + debugC(3, kDebugLevelScriptFuncs, "o2_countItemInInventory(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); + uint16 item = stackPos(1); int count = 0; for (int i = 0; i < 20; ++i) { @@ -283,7 +283,7 @@ int KyraEngine_v2::o2_countItemInInventory(ScriptState *script) { ++count; } - if (_itemInHand == int16(item)) + if ((stackPos(0) == 0) && _itemInHand == int16(item)) ++count; return count; |