SCI: Handle objects with a dot in their name

An example is the object 'dominoes.opt' in Hoyle 3, script 101
This commit is contained in:
Filippos Karapetis 2013-10-30 08:39:20 +02:00
parent 27281d1566
commit 82b52fc644

View File

@ -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