aboutsummaryrefslogtreecommitdiff
path: root/engines/tinsel/dialogs.cpp
diff options
context:
space:
mode:
authorMax Horn2009-10-27 00:36:56 +0000
committerMax Horn2009-10-27 00:36:56 +0000
commit05508d8dcd9589b6c083a2849630af8fd3bf8f53 (patch)
tree0ff2d6a74e5282b4359f107c4da7f4ebf4dc9f58 /engines/tinsel/dialogs.cpp
parent76942d6c86d11fb1a3a5fead501b544920763760 (diff)
downloadscummvm-rg350-05508d8dcd9589b6c083a2849630af8fd3bf8f53.tar.gz
scummvm-rg350-05508d8dcd9589b6c083a2849630af8fd3bf8f53.tar.bz2
scummvm-rg350-05508d8dcd9589b6c083a2849630af8fd3bf8f53.zip
TINSEL: Change MemoryAllocFixed to return a (kind of fake) MEM_NODE pointer; add MemoryDeinit()
svn-id: r45426
Diffstat (limited to 'engines/tinsel/dialogs.cpp')
-rw-r--r--engines/tinsel/dialogs.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/engines/tinsel/dialogs.cpp b/engines/tinsel/dialogs.cpp
index c5686378c5..1b318e69c2 100644
--- a/engines/tinsel/dialogs.cpp
+++ b/engines/tinsel/dialogs.cpp
@@ -5526,7 +5526,10 @@ void RegisterIcons(void *cptr, int num) {
if (TinselV0) {
// In Tinsel 0, the INV_OBJECT structure doesn't have an attributes field, so we
// need to 'unpack' the source structures into the standard Tinsel v1/v2 format
- invObjects = (INV_OBJECT *)MemoryAllocFixed(numObjects * sizeof(INV_OBJECT));
+ MEM_NODE *node = MemoryAllocFixed(numObjects * sizeof(INV_OBJECT));
+ assert(node);
+ invObjects = (INV_OBJECT *)MemoryDeref(node);
+ assert(invObjects);
byte *srcP = (byte *)cptr;
INV_OBJECT *destP = (INV_OBJECT *)invObjects;
@@ -5537,12 +5540,14 @@ void RegisterIcons(void *cptr, int num) {
} else if (TinselV2) {
if (invFilms == NULL) {
// First time - allocate memory
- invFilms = (SCNHANDLE *)MemoryAllocFixed(numObjects * sizeof(SCNHANDLE));
+ MEM_NODE *node = MemoryAllocFixed(numObjects * sizeof(SCNHANDLE));
+ assert(node);
+ invFilms = (SCNHANDLE *)MemoryDeref(node);
+ if (invFilms == NULL)
+ error(NO_MEM, "inventory scripts");
memset(invFilms, 0, numObjects * sizeof(SCNHANDLE));
}
- if (invFilms == NULL)
- error(NO_MEM, "inventory scripts");
// Add defined permanent conversation icons
// and store all the films separately