diff options
author | Filippos Karapetis | 2010-05-18 12:16:48 +0000 |
---|---|---|
committer | Filippos Karapetis | 2010-05-18 12:16:48 +0000 |
commit | 46af5a5162db4c2b5c238f02465ee226c04e834f (patch) | |
tree | 30a4919d95dff23137bb0f626ec2d24a271b36d1 /engines/sci/engine/kstring.cpp | |
parent | 75f4791a4a97889cd01663e9cc882682e58b6177 (diff) | |
download | scummvm-rg350-46af5a5162db4c2b5c238f02465ee226c04e834f.tar.gz scummvm-rg350-46af5a5162db4c2b5c238f02465ee226c04e834f.tar.bz2 scummvm-rg350-46af5a5162db4c2b5c238f02465ee226c04e834f.zip |
- Moved kernel_lookup_text inside the Kernel class
- Added a pointer to the segment manager from within the Kernel class, thus simplifying the calls to it
svn-id: r49076
Diffstat (limited to 'engines/sci/engine/kstring.cpp')
-rw-r--r-- | engines/sci/engine/kstring.cpp | 38 |
1 files changed, 2 insertions, 36 deletions
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp index 55873efc8b..426c682e11 100644 --- a/engines/sci/engine/kstring.cpp +++ b/engines/sci/engine/kstring.cpp @@ -33,40 +33,6 @@ namespace Sci { -/* Returns the string the script intended to address */ -Common::String kernel_lookup_text(EngineState *s, reg_t address, int index) { - char *seeker; - Resource *textres; - - if (address.segment) - return s->_segMan->getString(address); - else { - int textlen; - int _index = index; - textres = g_sci->getResMan()->findResource(ResourceId(kResourceTypeText, address.offset), 0); - - if (!textres) { - error("text.%03d not found", address.offset); - return NULL; /* Will probably segfault */ - } - - textlen = textres->size; - seeker = (char *) textres->data; - - while (index--) - while ((textlen--) && (*seeker++)) - ; - - if (textlen) - return seeker; - else { - error("Index %d out of bounds in text.%03d", _index, address.offset); - return 0; - } - - } -} - reg_t kStrEnd(EngineState *s, int argc, reg_t *argv) { reg_t address = argv[0]; address.offset += s->_segMan->strlen(address); @@ -211,7 +177,7 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) { else startarg = 3; /* First parameter to use for formatting */ - Common::String source_str = kernel_lookup_text(s, position, index); + Common::String source_str = g_sci->getKernel()->lookupText(position, index); const char* source = source_str.c_str(); debugC(2, kDebugLevelStrings, "Formatting \"%s\"", source); @@ -278,7 +244,7 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) { reg = GET_SEL32(s->_segMan, reg, SELECTOR(data)); #endif - Common::String tempsource = (reg == NULL_REG) ? "" : kernel_lookup_text(s, reg, + Common::String tempsource = (reg == NULL_REG) ? "" : g_sci->getKernel()->lookupText(reg, arguments[paramindex + 1]); int slen = strlen(tempsource.c_str()); int extralen = str_leng - slen; |