aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/console.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2013-01-22 01:53:50 +0200
committerFilippos Karapetis2013-01-22 01:53:50 +0200
commit5d90c6fb3efd4e5c6544a550ff603b96db23f331 (patch)
tree98fc0ec4fa8c6df067f1e90022dedd86b2f1fe81 /engines/sci/console.cpp
parentdbb50219fbfcd6c08c4ee516460ea20918724344 (diff)
downloadscummvm-rg350-5d90c6fb3efd4e5c6544a550ff603b96db23f331.tar.gz
scummvm-rg350-5d90c6fb3efd4e5c6544a550ff603b96db23f331.tar.bz2
scummvm-rg350-5d90c6fb3efd4e5c6544a550ff603b96db23f331.zip
SCI: Use underscores as substitute characters for spaces in object names
This helps in debugging objects with spaces in their names (e.g. the "Glass Jar" object in Pepper - bug #3601090). Now, this object can be examined like "vo Glass_Jar"
Diffstat (limited to 'engines/sci/console.cpp')
-rw-r--r--engines/sci/console.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 5ae8245e5a..2019415ecc 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -3764,6 +3764,8 @@ static int parse_reg_t(EngineState *s, const char *str, reg_t *dest, bool mayBeV
charsCountObject++;
if ((*strLoop >= 'I') && (*strLoop <= 'Z'))
charsCountObject++;
+ if (*strLoop == '_') // underscores are used as substitutes for spaces in object names
+ charsCountObject++;
}
strLoop++;
}
@@ -3836,10 +3838,16 @@ static int parse_reg_t(EngineState *s, const char *str, reg_t *dest, bool mayBeV
index = strtol(tmp + 1, &endptr, 16);
if (*endptr)
return -1;
- // Chop of the index
+ // Chop off the index
str_objname = Common::String(str_objname.c_str(), tmp);
}
+ // Replace all underscores in the name with spaces
+ for (int i = 0; i < str_objname.size(); i++) {
+ if (str_objname[i] == '_')
+ str_objname.setChar(' ', i);
+ }
+
// Now all values are available; iterate over all objects.
*dest = s->_segMan->findObjectByName(str_objname, index);
if (dest->isNull())