Skip to content

Commit

Permalink
ACCESS: Fix compiler warnings and deallocation crash on exit
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Aug 14, 2014
1 parent 28bfe73 commit d6404a1
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 20 deletions.
12 changes: 1 addition & 11 deletions engines/access/access.cpp
Expand Up @@ -114,9 +114,6 @@ AccessEngine::~AccessEngine() {
delete _scripts;
delete _sound;

_buffer1.free();
_buffer2.free();

freeCells();
delete[] _man1;
delete[] _inactive;
Expand Down Expand Up @@ -198,16 +195,9 @@ void AccessEngine::loadCells(Common::Array<RoomInfo::CellIdent> &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;
}
}
Expand Down
9 changes: 2 additions & 7 deletions engines/access/access.h
Expand Up @@ -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"
Expand Down Expand Up @@ -213,12 +213,7 @@ class AccessEngine : public Engine {
void loadCells(Common::Array<RoomInfo::CellIdent> &cells);

/**
* Clear the cell table
*/
void clearCellTable();

/**
* Free the cell data
* Free the sprites list
*/
void freeCells();

Expand Down
1 change: 0 additions & 1 deletion engines/access/amazon/amazon_game.cpp
Expand Up @@ -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 };
Expand Down
4 changes: 4 additions & 0 deletions engines/access/asurface.cpp
Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion engines/access/asurface.h
Expand Up @@ -46,8 +46,10 @@ class ASurface : public Graphics::Surface {

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); }
Expand Down
2 changes: 2 additions & 0 deletions engines/access/screen.h
Expand Up @@ -83,6 +83,8 @@ class Screen: public ASurface {
public:
Screen(AccessEngine *vm);

virtual ~Screen() {}

void setDisplayScan();

void setPanel(int num);
Expand Down

0 comments on commit d6404a1

Please sign in to comment.