diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/draci/game.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index efa7d8bf86..f9eb55fb0e 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -690,13 +690,15 @@ void Game::putItem(int itemID, int position) { return; if (position >= 0 && - position < kInventoryLines * kInventoryColumns && + position < kInventorySlots && (_inventory[position] == kNoItem || _inventory[position] == itemID)) { _inventory[position] = itemID; } else { - for (position = 0; position < kInventorySlots; ++position) { - if (_inventory[position] == kNoItem) { - _inventory[position] = itemID; + for (int i = 0; i < kInventorySlots; ++i) { + int pos = (position + i) % kInventorySlots; + if (_inventory[pos] == kNoItem) { + _inventory[pos] = itemID; + position = pos; break; } } |