From d6404a10adc4a1b6973894291ffbc6d87ac96071 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 13 Aug 2014 22:45:15 -0400 Subject: ACCESS: Fix compiler warnings and deallocation crash on exit --- engines/access/access.cpp | 12 +----------- engines/access/access.h | 9 ++------- engines/access/amazon/amazon_game.cpp | 1 - engines/access/asurface.cpp | 4 ++++ engines/access/asurface.h | 4 +++- engines/access/screen.h | 2 ++ 6 files changed, 12 insertions(+), 20 deletions(-) diff --git a/engines/access/access.cpp b/engines/access/access.cpp index 3a773a94c1..2ffc479748 100644 --- a/engines/access/access.cpp +++ b/engines/access/access.cpp @@ -114,9 +114,6 @@ AccessEngine::~AccessEngine() { delete _scripts; delete _sound; - _buffer1.free(); - _buffer2.free(); - freeCells(); delete[] _man1; delete[] _inactive; @@ -198,16 +195,9 @@ void AccessEngine::loadCells(Common::Array &cells) { } } -void AccessEngine::clearCellTable() { - for (int i = 0; i < 100; ++i) { - delete _objectsTable[i]; - _objectsTable[i] = nullptr; - } -} - void AccessEngine::freeCells() { for (int i = 0; i < 100; ++i) { - delete[] _objectsTable[i]; + delete _objectsTable[i]; _objectsTable[i] = nullptr; } } diff --git a/engines/access/access.h b/engines/access/access.h index 08b5ae3935..d919ae83f9 100644 --- a/engines/access/access.h +++ b/engines/access/access.h @@ -30,7 +30,7 @@ #include "common/util.h" #include "engines/engine.h" #include "graphics/surface.h" -#include "access\/animation.h" +#include "access/animation.h" #include "access/data.h" #include "access/debugger.h" #include "access/events.h" @@ -213,12 +213,7 @@ public: void loadCells(Common::Array &cells); /** - * Clear the cell table - */ - void clearCellTable(); - - /** - * Free the cell data + * Free the sprites list */ void freeCells(); diff --git a/engines/access/amazon/amazon_game.cpp b/engines/access/amazon/amazon_game.cpp index fe158125b5..d0a5b6eecc 100644 --- a/engines/access/amazon/amazon_game.cpp +++ b/engines/access/amazon/amazon_game.cpp @@ -161,7 +161,6 @@ void AmazonEngine::doTent() { void AmazonEngine::setupGame() { _chapter = 1; - clearCellTable(); // Setup timers const int TIMER_DEFAULTS[] = { 3, 10, 8, 1, 1, 1, 1, 2 }; diff --git a/engines/access/asurface.cpp b/engines/access/asurface.cpp index ba75607637..619c4499e9 100644 --- a/engines/access/asurface.cpp +++ b/engines/access/asurface.cpp @@ -104,6 +104,10 @@ void ASurface::init() { _scrollX = _scrollY = 0; } +ASurface::~ASurface() { + free(); +} + void ASurface::clearBuffer() { byte *pSrc = (byte *)getPixels(); Common::fill(pSrc, pSrc + w * h, 0); diff --git a/engines/access/asurface.h b/engines/access/asurface.h index 776b9506e9..4f172ae309 100644 --- a/engines/access/asurface.h +++ b/engines/access/asurface.h @@ -46,8 +46,10 @@ public: static void init(); public: - virtual void ASurface::plotFrame(SpriteFrame *frame, const Common::Point &pt); + virtual void plotFrame(SpriteFrame *frame, const Common::Point &pt); public: + virtual ~ASurface(); + void clearBuffer(); void copyBuffer(Graphics::Surface *src) { copyFrom(*src); } diff --git a/engines/access/screen.h b/engines/access/screen.h index d759ae119e..ba1c22931c 100644 --- a/engines/access/screen.h +++ b/engines/access/screen.h @@ -83,6 +83,8 @@ public: public: Screen(AccessEngine *vm); + virtual ~Screen() {} + void setDisplayScan(); void setPanel(int num); -- cgit v1.2.3