aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorMax Horn2004-11-27 13:10:41 +0000
committerMax Horn2004-11-27 13:10:41 +0000
commitdce059eebf0d329de2d8a142782c366cfb11eaed (patch)
tree054885a60d04856d28f2126a019f91c2f83600bc /scumm
parent6bcb1ce7d9015772fabeb8a764aa901b099d5686 (diff)
downloadscummvm-rg350-dce059eebf0d329de2d8a142782c366cfb11eaed.tar.gz
scummvm-rg350-dce059eebf0d329de2d8a142782c366cfb11eaed.tar.bz2
scummvm-rg350-dce059eebf0d329de2d8a142782c366cfb11eaed.zip
Reduce code duplication
svn-id: r15908
Diffstat (limited to 'scumm')
-rw-r--r--scumm/resource.cpp27
1 files changed, 6 insertions, 21 deletions
diff --git a/scumm/resource.cpp b/scumm/resource.cpp
index 6b8884bb7e..67fdf23327 100644
--- a/scumm/resource.cpp
+++ b/scumm/resource.cpp
@@ -1958,35 +1958,20 @@ byte *ScummEngine::getResourceAddress(int type, int idx) {
}
byte *ScummEngine::getStringAddress(int i) {
- byte *b = getResourceAddress(rtString, i);
- if (!b)
+ byte *addr = getResourceAddress(rtString, i);
+ if (addr == NULL)
return NULL;
if (_heversion >= 72)
- return (b + 0x14); // ArrayHeader->data
+ return (addr + 0x14); // ArrayHeader->data
if (_features & GF_NEW_OPCODES)
- return ((ArrayHeader *)b)->data;
- return b;
+ return (addr + 0x6); // ArrayHeader->data
+ return addr;
}
byte *ScummEngine::getStringAddressVar(int i) {
- byte *addr;
-
- addr = getResourceAddress(rtString, _scummVars[i]);
- if (addr == NULL)
- // as this is used for string mapping in the gui
- // it must be allowed to return NULL
- // error("NULL string var %d slot %d", i, _scummVars[i]);
- return NULL;
-
- if (_heversion >= 72)
- return (addr + 0x14); // ArrayHeader->data
-
- if (_features & GF_NEW_OPCODES)
- return ((ArrayHeader *)addr)->data;
-
- return (addr);
+ return getStringAddress(_scummVars[i]);
}
void ScummEngine::setResourceCounter(int type, int idx, byte flag) {