diff options
author | Florian Kagerer | 2010-10-22 13:10:41 +0000 |
---|---|---|
committer | Florian Kagerer | 2010-10-22 13:10:41 +0000 |
commit | d6e4c07dac32cb184e69fa41772f13b6769933c6 (patch) | |
tree | 0dc7cb523d371e002e5a2f09b2574270436783d4 | |
parent | b816a81c028730c586e29045ac24e11d49e2ca0f (diff) | |
download | scummvm-rg350-d6e4c07dac32cb184e69fa41772f13b6769933c6.tar.gz scummvm-rg350-d6e4c07dac32cb184e69fa41772f13b6769933c6.tar.bz2 scummvm-rg350-d6e4c07dac32cb184e69fa41772f13b6769933c6.zip |
LOL: fix possible regressions
svn-id: r53700
-rw-r--r-- | engines/kyra/items_lol.cpp | 3 | ||||
-rw-r--r-- | engines/kyra/script_lol.cpp | 8 |
2 files changed, 8 insertions, 3 deletions
diff --git a/engines/kyra/items_lol.cpp b/engines/kyra/items_lol.cpp index 52c75f8b5e..5db4ff9f26 100644 --- a/engines/kyra/items_lol.cpp +++ b/engines/kyra/items_lol.cpp @@ -271,6 +271,9 @@ void LoLEngine::runItemScript(int charNum, int item, int flags, int next, int re } void LoLEngine::setHandItem(Item itemIndex) { + if (itemIndex == -1) + return; + if (itemIndex && _itemProperties[_itemsInPlay[itemIndex].itemPropertyIndex].flags & 0x80) { runItemScript(-1, itemIndex, 0x400, 0, 0); if (_itemsInPlay[itemIndex].shpCurFrame_flg & 0x8000) diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp index 1034e86d4e..104a135ff6 100644 --- a/engines/kyra/script_lol.cpp +++ b/engines/kyra/script_lol.cpp @@ -700,7 +700,7 @@ int LoLEngine::olol_setGlobalVar(EMCState *script) { break; case 3: - setHandItem(b); + setHandItem((Item)b); break; case 4: @@ -1065,7 +1065,9 @@ int LoLEngine::olol_createHandItem(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_createHandItem(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); if (_itemInHand) return 0; - setHandItem(makeItem(stackPos(0), stackPos(1), stackPos(2))); + + uint16 itm = makeItem(stackPos(0), stackPos(1), stackPos(2)); + setHandItem((Item)itm); return 1; } @@ -2085,7 +2087,7 @@ int LoLEngine::olol_placeInventoryItemInHand(EMCState *script) { _inventoryCurItem = i; int r = _itemInHand; - setHandItem(_inventory[i]); + setHandItem((Item)_inventory[i]); _inventory[i] = r; if (stackPos(1)) |