diff options
-rw-r--r-- | engines/gob/hotspots.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp index d47c31840d..fb8e29f528 100644 --- a/engines/gob/hotspots.cpp +++ b/engines/gob/hotspots.cpp @@ -1795,23 +1795,24 @@ uint32 Hotspots::getCurrentHotspot() const { } void Hotspots::cleanFloatString(const Hotspot &spot) const { - static char tempStr[256]; //the static keyword is unnecessary, but was added to work around a PSP compiler ICE. + char *to, *from; - // Get the string - strncpy0(tempStr, GET_VARO_STR(spot.key), 255); + to = from = GET_VARO_STR(spot.key); + for (int i = 0; (i < 257) && (*from != '\0'); i++, from++) { + char c = *from; + + // Skip spaces + if (c == ' ') + continue; - // Remove spaces - char *ptr; - while ((ptr = strchr(tempStr, ' '))) - _vm->_util->cutFromStr(tempStr, (ptr - tempStr), 1); + // Convert decimal separator if necessary + if ((_vm->_global->_language == kLanguageBritish) && (c == '.')) + c = ','; - // Exchange decimal separator if needed - if (_vm->_global->_language == kLanguageBritish) - while ((ptr = strchr(tempStr, '.'))) - *ptr = ','; + *to++ = c; + } - // Write it back - WRITE_VARO_STR(spot.key, tempStr); + *to = '\0'; } void Hotspots::checkStringMatch(const Hotspot &spot, const InputDesc &input, |