From 05508d8dcd9589b6c083a2849630af8fd3bf8f53 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 27 Oct 2009 00:36:56 +0000 Subject: TINSEL: Change MemoryAllocFixed to return a (kind of fake) MEM_NODE pointer; add MemoryDeinit() svn-id: r45426 --- engines/tinsel/dialogs.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'engines/tinsel/dialogs.cpp') 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 -- cgit v1.2.3