diff options
author | Johannes Schickel | 2005-12-31 15:41:37 +0000 |
---|---|---|
committer | Johannes Schickel | 2005-12-31 15:41:37 +0000 |
commit | a10097eaa41357beb2dc4be4f790717fe9fe70a3 (patch) | |
tree | 8c7fb60b2764b8b0b0e58ac665bbd3c374241514 /kyra/debugger.cpp | |
parent | 5afaad7869a252cabde3f8ec24957ca1e7c1684a (diff) | |
download | scummvm-rg350-a10097eaa41357beb2dc4be4f790717fe9fe70a3.tar.gz scummvm-rg350-a10097eaa41357beb2dc4be4f790717fe9fe70a3.tar.bz2 scummvm-rg350-a10097eaa41357beb2dc4be4f790717fe9fe70a3.zip |
Commited patches 1394374 and 1394374 with minor changes.
Thanks to clemmy for that.
svn-id: r19870
Diffstat (limited to 'kyra/debugger.cpp')
-rw-r--r-- | kyra/debugger.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/kyra/debugger.cpp b/kyra/debugger.cpp index 036c884af6..fa0207035f 100644 --- a/kyra/debugger.cpp +++ b/kyra/debugger.cpp @@ -59,9 +59,15 @@ bool Debugger::cmd_enterRoom(int argc, const char **argv) { if (argc > 1) { uint room = atoi(argv[1]); - if (argc > 2) + // game will crash if entering a non-existent room + if (room >= _vm->_roomTableSize) { + DebugPrintf("room number must be any value between (including) 0 and %d\n", _vm->_roomTableSize-1); + return true; + } + + if (argc > 2) { direction = atoi(argv[2]); - else { + } else { if (_vm->_roomTable[room].northExit != 0xff) direction = 3; else if (_vm->_roomTable[room].eastExit != 0xff) @@ -178,8 +184,15 @@ bool Debugger::cmd_setTimerCountdown(int argc, const char **argv) { } bool Debugger::cmd_giveItem(int argc, const char **argv) { - if (argc) { + if (argc == 2) { int item = atoi(argv[1]); + + // Kyrandia 1 has only 108 items (-1 to 106), otherwise it will crash + if (item < -1 || item > 106) { + DebugPrintf("itemid must be any value between (including) -1 and 106\n"); + return true; + } + _vm->setMouseItem(item); _vm->_itemInHand = item; } else |