ASYLUM: clean up destructors

This commit is contained in:
alxpnv 2021-05-14 13:26:59 +03:00 committed by Eugene Sandulenko
parent ca1d780730
commit c81c046450
No known key found for this signature in database
GPG Key ID: 014D387312D34F08
29 changed files with 9 additions and 104 deletions

View File

@ -219,9 +219,6 @@ Console::Console(AsylumEngine *engine) : _vm(engine) {
Console::~Console() {
DebugMan.clearAllDebugChannels();
// Zero passed pointers
_vm = NULL;
}
//////////////////////////////////////////////////////////////////////////

View File

@ -38,11 +38,6 @@ namespace Asylum {
Puzzle::Puzzle(AsylumEngine *engine): _vm(engine) {
}
Puzzle::~Puzzle() {
// Zero passed pointers
_vm = NULL;
}
void Puzzle::saveLoadWithSerializer(Common::Serializer &) {
// By default, we do not save any data
}

View File

@ -42,7 +42,7 @@ struct GraphicQueueItem;
class Puzzle : public EventHandler, public Common::Serializable {
public:
Puzzle(AsylumEngine *engine);
virtual ~Puzzle();
virtual ~Puzzle() {};
bool handleEvent(const AsylumEvent &evt);

View File

@ -50,9 +50,6 @@ Puzzles::~Puzzles() {
// Cleanup puzzles
for (uint i = 0; i < ARRAYSIZE(_puzzles); i++)
delete _puzzles[i];
// Zero passed pointers
_vm = NULL;
}
void Puzzles::reset() {

View File

@ -113,13 +113,6 @@ Actor::Actor(AsylumEngine *engine, ActorIndex index) : _vm(engine), _index(index
_frameNumber = 0;
}
Actor::~Actor() {
// TODO destroy data
// Zero passed pointers
_vm = NULL;
}
/////////////////////////////////////////////////////////////////////////
// Loading
//////////////////////////////////////////////////////////////////////////

View File

@ -85,7 +85,7 @@ struct ActorData : public Common::Serializable {
class Actor : public Common::Serializable {
public:
Actor(AsylumEngine *engine, ActorIndex index);
virtual ~Actor();
virtual ~Actor() {};
//////////////////////////////////////////////////////////////////////////
// Public variables & accessors

View File

@ -105,14 +105,6 @@ Encounter::Encounter(AsylumEngine *engine) : _vm(engine),
load();
}
Encounter::~Encounter() {
// Pointing to existing data
_item = NULL;
// Zero-out passed pointers
_vm = NULL;
}
//////////////////////////////////////////////////////////////////////////
// Data
//////////////////////////////////////////////////////////////////////////

View File

@ -85,7 +85,7 @@ public:
class Encounter : public EventHandler {
public:
Encounter(AsylumEngine *engine);
virtual ~Encounter();
virtual ~Encounter() {};
void run(int32 encounterIndex, ObjectId objectId1, ObjectId objectId2, ActorIndex actorIndex);

View File

@ -47,11 +47,6 @@ Object::Object(AsylumEngine *engine) : x(0), y(0), flags(0), actionType(0),
memset(&_randomResourceIds, 0, sizeof(_randomResourceIds));
}
Object::~Object() {
// Zero passed pointers
_vm = NULL;
}
/////////////////////////////////////////////////////////////////////////
// Loading & destroying
/////////////////////////////////////////////////////////////////////////

View File

@ -39,7 +39,7 @@ class AsylumEngine;
class Object : public Common::Serializable {
public:
Object(AsylumEngine *engine);
virtual ~Object();
virtual ~Object() {};
//////////////////////////////////////////////////////////////////////////
// Public variables & accessors

View File

@ -218,12 +218,6 @@ ScriptManager::~ScriptManager() {
_scripts.clear();
_queue.reset();
_currentScript = NULL;
_currentQueueEntry = NULL;
// Zero-out passed pointers
_vm = NULL;
}
void ScriptManager::load(Common::SeekableReadStream *stream) {

View File

@ -71,12 +71,6 @@ Special::Special(AsylumEngine *engine) : _vm(engine) {
_chapter5Counter = 0;
}
Special::~Special() {
// Zero-out passed pointers
_vm = NULL;
}
void Special::run(Object* object, ActorIndex index) {
switch (getWorld()->chapter) {
default:

View File

@ -37,7 +37,7 @@ class Special {
public:
Special(AsylumEngine *engine);
virtual ~Special();
~Special() {};
void run(Object* object, ActorIndex index);

View File

@ -99,9 +99,6 @@ WorldStats::~WorldStats() {
CLEAR_ARRAY(Object, objects);
CLEAR_ARRAY(Actor, actors);
CLEAR_ARRAY(ActionArea, actions);
// Zero-out passed pointers
_vm = NULL;
}
// Load necessary World Stats content

View File

@ -40,9 +40,6 @@ Cursor::Cursor(AsylumEngine *engine) : _vm(engine),
Cursor::~Cursor() {
delete _cursorRes;
// Zero-out passed pointers
_vm = NULL;
}
void Cursor::hide() const {

View File

@ -37,9 +37,6 @@ GraphicResource::GraphicResource(AsylumEngine *engine, ResourceId id) : _vm(engi
GraphicResource::~GraphicResource() {
clear();
// Zero passed pointers
_vm = NULL;
}
bool GraphicResource::load(ResourceId id) {

View File

@ -59,11 +59,6 @@ Savegame::Savegame(AsylumEngine *engine) : _vm(engine), _index(0), _valid(false)
memset(&_savegameToScene, 0, sizeof(_savegameToScene));
}
Savegame::~Savegame() {
// Zero passed pointers
_vm = NULL;
}
bool Savegame::hasSavegames() const {
for (uint i = 0; i < SAVEGAME_COUNT; i++)
if (isSavegamePresent(getFilename(i)))

View File

@ -38,7 +38,7 @@ class AsylumEngine;
class Savegame {
public:
Savegame(AsylumEngine *engine);
~Savegame();
~Savegame() {};
/**
* Checks if saved games are present

View File

@ -66,12 +66,6 @@ Screen::~Screen() {
_backBuffer.free();
clearTransTables();
_transTableBuffer = NULL;
_transTable = NULL;
// Zero-out passed pointers
_vm = NULL;
}
//////////////////////////////////////////////////////////////////////////

View File

@ -44,10 +44,6 @@ Sound::Sound(AsylumEngine *engine, Audio::Mixer *mixer) : _vm(engine), _mixer(mi
Sound::~Sound() {
cleanupQueue();
// Zero-out passed pointers
_vm = NULL;
_mixer = NULL;
}
//////////////////////////////////////////////////////////////////////////

View File

@ -40,15 +40,6 @@ Speech::Speech(AsylumEngine *engine): _vm(engine), _textData(0), _textDataPos(0)
_textResourceId = kResourceNone;
}
Speech::~Speech() {
// Text resource data is disposed as part of the resource manager
_textData = 0;
_textDataPos = 0;
// Zero-out passed pointers
_vm = NULL;
}
ResourceId Speech::play(ResourceId soundResourceId, ResourceId textResourceId) {
if (soundResourceId)
if (getSound()->isPlaying(_soundResourceId))

View File

@ -34,7 +34,7 @@ class AsylumEngine;
class Speech {
public:
Speech(AsylumEngine *engine);
virtual ~Speech();
~Speech() {};
/**
* Play speech

View File

@ -40,9 +40,6 @@ Text::Text(AsylumEngine *engine) : _vm(engine) {
Text::~Text() {
delete _fontResource;
// Zero-out passed pointers
_vm = NULL;
}
ResourceId Text::loadFont(ResourceId resourceId) {

View File

@ -73,11 +73,6 @@ Menu::Menu(AsylumEngine *vm): _vm(vm) {
_prefixWidth = 0;
}
Menu::~Menu() {
// Zero-out passed pointers
_vm = NULL;
}
//////////////////////////////////////////////////////////////////////////
// Loading and setup
//////////////////////////////////////////////////////////////////////////

View File

@ -38,7 +38,7 @@ class Text;
class Menu : public EventHandler {
public:
Menu(AsylumEngine *vm);
~Menu();
virtual ~Menu() {};
/**
* Shows the menu

View File

@ -84,9 +84,6 @@ Scene::~Scene() {
delete _polygons;
delete _ws;
// Zero passed pointers
_vm = NULL;
}
void Scene::enter(ResourcePackId packId) {

View File

@ -39,11 +39,6 @@ SceneTitle::SceneTitle(AsylumEngine *engine): _vm(engine),
_start(0), _done(false), _spinnerFrameIndex(0), _spinnerProgress(0), _spinnerFrameCount(0) {
}
SceneTitle::~SceneTitle() {
// Zero passed pointers
_vm = NULL;
}
void SceneTitle::load() {
_start = _vm->getTick();

View File

@ -33,7 +33,7 @@ class GraphicResource;
class SceneTitle {
public:
SceneTitle(AsylumEngine *engine);
~SceneTitle();
~SceneTitle() {};
void load();

View File

@ -43,9 +43,6 @@ VideoPlayer::VideoPlayer(AsylumEngine *engine, Audio::Mixer *mixer) : _vm(engine
VideoPlayer::~VideoPlayer() {
delete _smkDecoder;
// Zero-out passed pointers
_vm = NULL;
}
//////////////////////////////////////////////////////////////////////////