diff options
Diffstat (limited to 'engines/draci')
-rw-r--r-- | engines/draci/draci.cpp | 1 | ||||
-rw-r--r-- | engines/draci/game.cpp | 9 |
2 files changed, 6 insertions, 4 deletions
diff --git a/engines/draci/draci.cpp b/engines/draci/draci.cpp index f759cad4a3..25ae48a857 100644 --- a/engines/draci/draci.cpp +++ b/engines/draci/draci.cpp @@ -222,6 +222,7 @@ void DraciEngine::handleEvents() { case Common::EVENT_QUIT: case Common::EVENT_RTL: _game->setQuit(true); + _script->endCurrentProgram(true); break; case Common::EVENT_KEYDOWN: switch (event.kbd.keycode) { diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index 1f3245a31b..82bddb6f9d 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -24,6 +24,7 @@ */ #include "common/stream.h" +#include "common/util.h" #include "draci/draci.h" #include "draci/game.h" @@ -332,12 +333,12 @@ void Game::handleInventoryLoop() { // Otherwise, if we are holding an item, try to place it inside the // inventory } else if (_currentItem) { - const int column = scummvm_lround( + const int column = CLIP(scummvm_lround( (_vm->_mouse->getPosX() - kInventoryX + kInventoryItemWidth / 2.) / - kInventoryItemWidth) - 1; - const int line = scummvm_lround( + kInventoryItemWidth) - 1, 0L, (long) kInventoryColumns - 1); + const int line = CLIP(scummvm_lround( (_vm->_mouse->getPosY() - kInventoryY + kInventoryItemHeight / 2.) / - kInventoryItemHeight) - 1; + kInventoryItemHeight) - 1, 0L, (long) kInventoryLines - 1); const int index = line * kInventoryColumns + column; putItem(_currentItem, index); |