Ticket #8497: kyra_debuger_fix_v3.diff

File kyra_debuger_fix_v3.diff, 869 bytes (added by SF/clemty, 18 years ago)

3rd version

  • debugger.

    old new  
    5959        if (argc > 1) {
    6060                uint room = atoi(argv[1]);
    6161
     62                /* Kyrandia 1 has only 246 rooms (0-245), otherwise it'll crash */
     63                if ((room<0) || (room>245)) {
     64                        DebugPrintf("room number must be any value between (including) 0 and 245\n");
     65                        return true;
     66                        }
     67
    6268                if (argc > 2)
    6369                        direction = atoi(argv[2]);
    6470                else {
     
    178184}
    179185
    180186bool Debugger::cmd_giveItem(int argc, const char **argv) {
    181         if (argc) {
     187        if (argc == 2) {
    182188                int item = atoi(argv[1]);
     189
     190                /* Kyrandia 1 has only 108 items (-1 to 106), otherwise it'll crash */
     191                if ((item<-1) || (item>106)) {
     192                        DebugPrintf("itemid must be any value between (including) -1 and 106\n");
     193                        return true;
     194                        }
     195
    183196                _vm->setMouseItem(item);
    184197                _vm->_itemInHand = item;
    185198        } else