Skip to content
Permalink
Browse files

BLADERUNNER: Move shutdown() in Engine destructor

  • Loading branch information...
antoniou79 committed Sep 10, 2019
1 parent bef3f90 commit 2003c12bc3fcdd8540cbe8942c86980f2d1b2131
Showing with 9 additions and 5 deletions.
  1. +9 −5 engines/bladerunner/bladerunner.cpp
@@ -226,6 +226,7 @@ BladeRunnerEngine::BladeRunnerEngine(OSystem *syst, const ADGameDescription *des
}

BladeRunnerEngine::~BladeRunnerEngine() {
shutdown();
}

bool BladeRunnerEngine::hasFeature(EngineFeature f) const {
@@ -322,7 +323,7 @@ Common::Error BladeRunnerEngine::run() {
}
missingFileStr += missingFiles[i];
}

// shutting down
return Common::Error(Common::kNoGameDataFoundError, missingFileStr);
}

@@ -335,7 +336,7 @@ Common::Error BladeRunnerEngine::run() {
bool hasSavegames = !SaveFileManager::list(_targetName).empty();

if (!startup(hasSavegames)) {
shutdown();
// shutting down
return Common::Error(Common::kUnknownError, _("Failed to initialize resources"));
}

@@ -402,8 +403,7 @@ Common::Error BladeRunnerEngine::run() {
}
} while (_gameOver); // if main game loop ended and _gameOver == false, then shutdown

shutdown();

// shutting down
return Common::kNoError;
}

@@ -798,7 +798,11 @@ void BladeRunnerEngine::shutdown() {
_playerActor = nullptr;
delete _actors[kActorVoiceOver];
_actors[kActorVoiceOver] = nullptr;
int actorCount = (int)_gameInfo->getActorCount();
int actorCount = kActorCount;
if (_gameInfo) {
actorCount = (int)_gameInfo->getActorCount();
}

for (int i = 0; i < actorCount; ++i) {
delete _actors[i];
_actors[i] = nullptr;

0 comments on commit 2003c12

Please sign in to comment.
You can’t perform that action at this time.