aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/console.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2013-10-30 08:39:20 +0200
committerFilippos Karapetis2013-10-30 08:47:46 +0200
commit82b52fc644f0af791c23e9fddace0256d82ca3b6 (patch)
tree91928015d457f70f55cdc1aedb4ac9643b0c5b15 /engines/sci/console.cpp
parent27281d15666e0217b7235413c4ecdac10d3c5de0 (diff)
downloadscummvm-rg350-82b52fc644f0af791c23e9fddace0256d82ca3b6.tar.gz
scummvm-rg350-82b52fc644f0af791c23e9fddace0256d82ca3b6.tar.bz2
scummvm-rg350-82b52fc644f0af791c23e9fddace0256d82ca3b6.zip
SCI: Handle objects with a dot in their name
An example is the object 'dominoes.opt' in Hoyle 3, script 101
Diffstat (limited to 'engines/sci/console.cpp')
-rw-r--r--engines/sci/console.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 50fae61de0..80d8ab8257 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -3840,10 +3840,15 @@ static int parse_reg_t(EngineState *s, const char *str, reg_t *dest, bool mayBeV
const char *tmp = Common::find(str_objname.begin(), str_objname.end(), '.');
if (tmp != str_objname.end()) {
index = strtol(tmp + 1, &endptr, 16);
- if (*endptr)
- return -1;
- // Chop off the index
- str_objname = Common::String(str_objname.c_str(), tmp);
+ if (*endptr) {
+ // The characters after the dot do not represent an index.
+ // This can happen if an object contains a dot in its name,
+ // like 'dominoes.opt' in Hoyle 3.
+ index = -1;
+ } else {
+ // Valid index found, chop it off
+ str_objname = Common::String(str_objname.c_str(), tmp);
+ }
}
// Replace all underscores in the name with spaces