From eeca348953d851d11f98b9b78d9bba0043937614 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 21 Dec 2013 19:09:57 +0100 Subject: AVALANCHE: Move freeing of the used surfaces in Nim to a better place. --- engines/avalanche/graphics.cpp | 12 +++++++----- engines/avalanche/graphics.h | 1 + engines/avalanche/nim.cpp | 2 ++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index f23ef2a78c..4b8d667fbf 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -60,11 +60,6 @@ GraphicManager::~GraphicManager() { _scrolls.free(); _backup.free(); - _nimStone.free(); - for (int i = 0; i < 3; i++) - _nimInitials[i].free(); - _nimLogo.free(); - for (int i = 0; i < 10; i++) _digits[i].free(); for (int i = 0; i < 9; i++) @@ -494,6 +489,13 @@ void GraphicManager::nimDrawLogo() { drawPicture(_surface, _nimLogo, 392, 5); } +void GraphicManager::nimFree() { + _nimStone.free(); + for (int i = 0; i < 3; i++) + _nimInitials[i].free(); + _nimLogo.free(); +} + /** * This function mimics Pascal's getimage(). */ diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index e230896ce2..0de23612a7 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -84,6 +84,7 @@ public: void nimDrawStone(int x, int y); void nimDrawInitials(); void nimDrawLogo(); + void nimFree(); void clearAlso(); void clearTextBar(); diff --git a/engines/avalanche/nim.cpp b/engines/avalanche/nim.cpp index 6b36ab8b17..be32f7cf3a 100644 --- a/engines/avalanche/nim.cpp +++ b/engines/avalanche/nim.cpp @@ -424,6 +424,8 @@ void Nim::endOfGame() { } } } + + _vm->_graphics->nimFree(); } bool Nim::find(byte x) { -- cgit v1.2.3