aboutsummaryrefslogtreecommitdiff
path: root/engines/agi/console.cpp
diff options
context:
space:
mode:
authorTorbjörn Andersson2007-03-10 11:16:16 +0000
committerTorbjörn Andersson2007-03-10 11:16:16 +0000
commitc7ce7ec614213f5d30d02b08bd98da8947b9dc32 (patch)
tree931f771595e17b0b6884e392abb2c8bab6415845 /engines/agi/console.cpp
parentdbcf7fb0030faf37cd0ccc09e53c8bc86d525c4c (diff)
downloadscummvm-rg350-c7ce7ec614213f5d30d02b08bd98da8947b9dc32.tar.gz
scummvm-rg350-c7ce7ec614213f5d30d02b08bd98da8947b9dc32.tar.bz2
scummvm-rg350-c7ce7ec614213f5d30d02b08bd98da8947b9dc32.zip
Fixed error handling: we count the command itself in argc, and returning false
means "close the debug console" which probably isn't what we want. svn-id: r26050
Diffstat (limited to 'engines/agi/console.cpp')
-rw-r--r--engines/agi/console.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/engines/agi/console.cpp b/engines/agi/console.cpp
index c459fa7e4d..177a1b5882 100644
--- a/engines/agi/console.cpp
+++ b/engines/agi/console.cpp
@@ -65,7 +65,7 @@ void Console::postEnter() {
bool Console::Cmd_SetVar(int argc, const char **argv) {
if (argc != 3) {
DebugPrintf("Usage: setvar <varnum> <value>");
- return false;
+ return true;
}
int p1 = (int)atoi(argv[1]);
int p2 = (int)atoi(argv[2]);
@@ -77,7 +77,7 @@ bool Console::Cmd_SetVar(int argc, const char **argv) {
bool Console::Cmd_SetFlag(int argc, const char **argv) {
if (argc != 3) {
DebugPrintf("Usage: setvar <varnum> <value>");
- return false;
+ return true;
}
int p1 = (int)atoi(argv[1]);
int p2 = (int)atoi(argv[2]);
@@ -89,7 +89,7 @@ bool Console::Cmd_SetFlag(int argc, const char **argv) {
bool Console::Cmd_SetObj(int argc, const char **argv) {
if (argc != 3) {
DebugPrintf("Usage: setvar <varnum> <value>");
- return false;
+ return true;
}
int p1 = (int)atoi(argv[1]);
int p2 = (int)atoi(argv[2]);
@@ -102,7 +102,7 @@ bool Console::Cmd_RunOpcode(int argc, const char **argv) {
for (int i = 0; logicNamesCmd[i].name; i++) {
if (!strcmp(argv[1], logicNamesCmd[i].name)) {
uint8 p[16];
- if ((argc - 2)!= logicNamesCmd[i].numArgs) {
+ if ((argc - 2) != logicNamesCmd[i].numArgs) {
DebugPrintf("AGI command wants %d arguments\n", logicNamesCmd[i].numArgs);
return 0;
}
@@ -120,7 +120,7 @@ bool Console::Cmd_RunOpcode(int argc, const char **argv) {
}
}
- return false;
+ return true;
}
bool Console::Cmd_Crc(int argc, const char **argv) {
@@ -184,9 +184,9 @@ bool Console::Cmd_Objs(int argc, const char **argv) {
}
bool Console::Cmd_Opcode(int argc, const char **argv) {
- if (argc != 1 || (strcmp(argv[1], "on") && strcmp(argv[1], "off"))) {
+ if (argc != 2 || (strcmp(argv[1], "on") && strcmp(argv[1], "off"))) {
DebugPrintf("Usage: opcode on|off\n");
- return false;
+ return true;
}
_vm->_debug.opcodes = !strcmp(argv[1], "on");
@@ -195,9 +195,9 @@ bool Console::Cmd_Opcode(int argc, const char **argv) {
}
bool Console::Cmd_Logic0(int argc, const char **argv) {
- if (argc != 1 || (strcmp(argv[1], "on") && strcmp(argv[1], "off"))) {
+ if (argc != 2 || (strcmp(argv[1], "on") && strcmp(argv[1], "off"))) {
DebugPrintf("Usage: logic0 on|off\n");
- return false;
+ return true;
}
_vm->_debug.logic0 = !strcmp(argv[1], "on");
@@ -206,9 +206,9 @@ bool Console::Cmd_Logic0(int argc, const char **argv) {
}
bool Console::Cmd_Trigger(int argc, const char **argv) {
- if (argc != 1 || (strcmp(argv[1], "on") && strcmp(argv[1], "off"))) {
+ if (argc != 2 || (strcmp(argv[1], "on") && strcmp(argv[1], "off"))) {
DebugPrintf("Usage: trigger on|off\n");
- return false;
+ return true;
}
_vm->_debug.ignoretriggers = strcmp (argv[1], "on");
@@ -218,7 +218,7 @@ bool Console::Cmd_Trigger(int argc, const char **argv) {
bool Console::Cmd_Step(int argc, const char **argv) {
_vm->_debug.enabled = 1;
- if (argc == 0) {
+ if (argc == 1) {
_vm->_debug.steps = 1;
return true;
}