diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/parallaction/graphics.cpp | 3 | ||||
-rw-r--r-- | engines/parallaction/inventory.cpp | 6 | ||||
-rw-r--r-- | engines/parallaction/inventory.h | 1 | ||||
-rw-r--r-- | engines/parallaction/location.cpp | 11 | ||||
-rw-r--r-- | engines/parallaction/parallaction.cpp | 8 |
5 files changed, 24 insertions, 5 deletions
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index 388547e751..e11edf06c0 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -852,6 +852,9 @@ Gfx::~Gfx() { delete _fonts[kFontLabel]; delete _fonts[kFontMenu]; + freeStaticCnv(_mouseComposedArrow); + delete _mouseComposedArrow; + return; } diff --git a/engines/parallaction/inventory.cpp b/engines/parallaction/inventory.cpp index 39a89db580..52dbd50db0 100644 --- a/engines/parallaction/inventory.cpp +++ b/engines/parallaction/inventory.cpp @@ -339,6 +339,12 @@ void initInventory() { _buffer = (byte*)malloc(INVENTORY_WIDTH * INVENTORY_HEIGHT); } +void destroyInventory() { + if (_buffer) + free(_buffer); + _buffer = 0; +} + void cleanInventory() { for (uint16 slot = INVENTORY_FIRST_ITEM; slot < INVENTORY_MAX_ITEMS; slot++) { diff --git a/engines/parallaction/inventory.h b/engines/parallaction/inventory.h index 89ec6db01e..36ea39ed03 100644 --- a/engines/parallaction/inventory.h +++ b/engines/parallaction/inventory.h @@ -41,6 +41,7 @@ struct InventoryItem { extern InventoryItem _inventory[]; void initInventory(); +void destroyInventory(); void openInventory(); void closeInventory(); int16 isItemInInventory(int32 v); diff --git a/engines/parallaction/location.cpp b/engines/parallaction/location.cpp index da67c556af..012e351ab5 100644 --- a/engines/parallaction/location.cpp +++ b/engines/parallaction/location.cpp @@ -179,9 +179,14 @@ void Parallaction::freeLocation() { if (_localFlagNames) delete _localFlagNames; - _localFlagNames = new Table(120); - _localFlagNames->addData("visited"); - + + // HACK: prevents leakage. A routine like this + // should allocate memory at all, though. + if ((_engineFlags & kEngineQuit) == 0) { + _localFlagNames = new Table(120); + _localFlagNames->addData("visited"); + } + _location._walkNodes.clear(); // TODO (LIST): helperNode should be rendered useless by the use of a Common::List<> diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index 4e45bc4f90..1cf285ba57 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -140,6 +140,10 @@ Parallaction::~Parallaction() { delete _localFlagNames; delete _gfx; + + freeLocation(); + freeCharacter(); + destroyInventory(); } @@ -304,7 +308,7 @@ uint16 Parallaction::updateInput() { break; case Common::EVENT_QUIT: - _system->quit(); + _engineFlags |= kEngineQuit; break; default: @@ -334,7 +338,7 @@ void waitUntilLeftClick() { break; if (e.type == Common::EVENT_QUIT) { - g_system->quit(); + _engineFlags |= kEngineQuit; break; } |