aboutsummaryrefslogtreecommitdiff
path: root/engines/mads/debugger.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2014-04-10 20:04:58 -0400
committerPaul Gilbert2014-04-10 20:04:58 -0400
commitdbbfdeec8fb2d042844cee67c91c7d639f2a8eaa (patch)
treeae2b368a73282e81237aa282f8730de619e81045 /engines/mads/debugger.cpp
parent99f947fbc3fab233afdb1974503222c4b6a28e49 (diff)
downloadscummvm-rg350-dbbfdeec8fb2d042844cee67c91c7d639f2a8eaa.tar.gz
scummvm-rg350-dbbfdeec8fb2d042844cee67c91c7d639f2a8eaa.tar.bz2
scummvm-rg350-dbbfdeec8fb2d042844cee67c91c7d639f2a8eaa.zip
MADS: Added an item command to the debugger
Diffstat (limited to 'engines/mads/debugger.cpp')
-rw-r--r--engines/mads/debugger.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/engines/mads/debugger.cpp b/engines/mads/debugger.cpp
index 276340f240..7d66b56989 100644
--- a/engines/mads/debugger.cpp
+++ b/engines/mads/debugger.cpp
@@ -38,6 +38,7 @@ Debugger::Debugger(MADSEngine *vm) : GUI::Debugger(), _vm(vm) {
DCmd_Register("show_codes", WRAP_METHOD(Debugger, Cmd_ShowCodes));
DCmd_Register("dump_file", WRAP_METHOD(Debugger, Cmd_DumpFile));
DCmd_Register("show_quote", WRAP_METHOD(Debugger, Cmd_ShowQuote));
+ DCmd_Register("item", WRAP_METHOD(Debugger, Cmd_Item));
}
static int strToInt(const char *s) {
@@ -178,4 +179,21 @@ bool Debugger::Cmd_ShowQuote(int argc, const char **argv) {
return true;
}
+bool Debugger::Cmd_Item(int argc, const char **argv) {
+ InventoryObjects &objects = _vm->_game->_objects;
+
+ if (argc != 2) {
+ DebugPrintf("Usage: %s <item number>\n", argv[0]);
+ return true;
+ } else {
+ int objectId = strToInt(argv[1]);
+
+ if (!objects.isInInventory(objectId))
+ objects.addToInventory(objectId);
+
+ DebugPrintf("Item added.\n");
+ return false;
+ }
+}
+
} // End of namespace MADS