aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorRobert Špalek2009-11-10 23:21:29 +0000
committerRobert Špalek2009-11-10 23:21:29 +0000
commit9ba6e8138c9eb1c4fc603a7dfebd70d781cc3872 (patch)
treedc603e978d6e14dbeff8e9a94bbd4b935dcce416 /engines
parent6a9024b1e31d2d24c93d0209116b3f87a175072a (diff)
downloadscummvm-rg350-9ba6e8138c9eb1c4fc603a7dfebd70d781cc3872.tar.gz
scummvm-rg350-9ba6e8138c9eb1c4fc603a7dfebd70d781cc3872.tar.bz2
scummvm-rg350-9ba6e8138c9eb1c4fc603a7dfebd70d781cc3872.zip
Fixed two bugs.
Putting items back to the inventory into clipped coordinates, and exiting running GPL2 programs when the game engine it to be interrupted. svn-id: r45822
Diffstat (limited to 'engines')
-rw-r--r--engines/draci/draci.cpp1
-rw-r--r--engines/draci/game.cpp9
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);