From 5d90c6fb3efd4e5c6544a550ff603b96db23f331 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 22 Jan 2013 01:53:50 +0200 Subject: 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" --- engines/sci/console.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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()) -- cgit v1.2.3