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
This commit is contained in:
Robert Špalek 2009-11-10 23:21:29 +00:00
parent 6a9024b1e3
commit 9ba6e8138c
2 changed files with 6 additions and 4 deletions

View File

@ -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) {

View File

@ -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);