diff options
Diffstat (limited to 'engines/cge')
-rw-r--r-- | engines/cge/cge.cpp | 10 | ||||
-rw-r--r-- | engines/cge/cge.h | 1 | ||||
-rw-r--r-- | engines/cge/cge_main.cpp | 4 |
3 files changed, 9 insertions, 6 deletions
diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp index 603352d8a0..2a4ea6bea2 100644 --- a/engines/cge/cge.cpp +++ b/engines/cge/cge.cpp @@ -99,6 +99,12 @@ void CGEEngine::initCaveValues() { } } +void CGEEngine::freeCaveValues() { + delete[] _mini; + free(_heroXY); + free(_barriers); +} + void CGEEngine::setup() { debugC(1, kCGEDebugEngine, "CGEEngine::setup()"); @@ -209,10 +215,8 @@ CGEEngine::~CGEEngine() { delete _snail; delete _snail_; delete _hero; - delete[] _mini; - free(_heroXY); - free(_barriers); + freeCaveValues(); } Common::Error CGEEngine::run() { diff --git a/engines/cge/cge.h b/engines/cge/cge.h index 54ea9e37f6..54bbadfef7 100644 --- a/engines/cge/cge.h +++ b/engines/cge/cge.h @@ -219,6 +219,7 @@ public: void postMiniStep(int stp); void showBak(int ref); void initCaveValues(); + void freeCaveValues(); void snBackPt(Sprite *spr, int stp); void snBarrier(int cav, int bar, bool horz); diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp index 3d1c451862..b17f40b863 100644 --- a/engines/cge/cge_main.cpp +++ b/engines/cge/cge_main.cpp @@ -113,9 +113,7 @@ void CGEEngine::syncHeader(Common::Serializer &s) { if (s.isLoading()) { // Reinitialise cave values - free(_heroXY); - free(_barriers); - + freeCaveValues(); initCaveValues(); } |