diff options
author | Max Horn | 2010-07-01 16:04:48 +0000 |
---|---|---|
committer | Max Horn | 2010-07-01 16:04:48 +0000 |
commit | 36799dc83f59674de8956ea2ec29029783633f45 (patch) | |
tree | 9ec0125138383f900c2bcdac1a7c6cf8203efb58 /engines/sci/engine/kernel32.cpp | |
parent | 3f429d64a2ef826782bf9af8971ba397b0e2743c (diff) | |
download | scummvm-rg350-36799dc83f59674de8956ea2ec29029783633f45.tar.gz scummvm-rg350-36799dc83f59674de8956ea2ec29029783633f45.tar.bz2 scummvm-rg350-36799dc83f59674de8956ea2ec29029783633f45.zip |
SCI: Add SegManager::getSystemString() method
svn-id: r50550
Diffstat (limited to 'engines/sci/engine/kernel32.cpp')
-rw-r--r-- | engines/sci/engine/kernel32.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/engines/sci/engine/kernel32.cpp b/engines/sci/engine/kernel32.cpp index 5975c7b3bc..25a822f77d 100644 --- a/engines/sci/engine/kernel32.cpp +++ b/engines/sci/engine/kernel32.cpp @@ -609,13 +609,15 @@ reg_t kString(EngineState *s, int argc, reg_t *argv) { if (argv[1].segment == s->_segMan->getSysStringsSegment()) { // Resize if necessary const uint16 sysStringId = argv[1].toUint16(); - if ((uint32)s->_segMan->_sysStrings->_strings[sysStringId]._maxSize < index1 + count) { - free(s->_segMan->_sysStrings->_strings[sysStringId]._value); - s->_segMan->_sysStrings->_strings[sysStringId]._maxSize = index1 + count; - s->_segMan->_sysStrings->_strings[sysStringId]._value = (char *)calloc(index1 + count, sizeof(char)); + SystemString *sysString = s->_segMan->getSystemString(sysStringId); + assert(sysString); + if ((uint32)sysString->_maxSize < index1 + count) { + free(sysString->_value); + sysString->_maxSize = index1 + count; + sysString->_value = (char *)calloc(index1 + count, sizeof(char)); } - strncpy(s->_segMan->_sysStrings->_strings[sysStringId]._value + index1, string2 + index2, count); + strncpy(sysString->_value + index1, string2 + index2, count); } else { SciString *string1 = s->_segMan->lookupString(argv[1]); |