Skip to content

Commit

Permalink
WITCHER: Use ScopedPtr for WitcherEngine::_game
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMcCoy committed Oct 26, 2016
1 parent b870873 commit 0fa7935
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
10 changes: 3 additions & 7 deletions src/engines/witcher/witcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,12 @@ namespace Engines {
namespace Witcher {

WitcherEngine::WitcherEngine() :
_languageText(Aurora::kLanguageInvalid), _languageVoice(Aurora::kLanguageInvalid),
_game(0) {
_languageText(Aurora::kLanguageInvalid), _languageVoice(Aurora::kLanguageInvalid) {

_console.reset(new Console(*this));
}

WitcherEngine::~WitcherEngine() {
delete _game;
}

bool WitcherEngine::detectLanguages(Aurora::GameID UNUSED(game), const Common::UString &target,
Expand Down Expand Up @@ -152,7 +150,7 @@ void WitcherEngine::run() {

CursorMan.showCursor();

_game = new Game(*this, *_console);
_game.reset(new Game(*this, *_console));
_game->run();

deinit();
Expand Down Expand Up @@ -322,9 +320,7 @@ void WitcherEngine::loadLanguageFiles(Aurora::Language langText, Aurora::Languag
}

void WitcherEngine::deinit() {
delete _game;

_game = 0;
_game.reset();

LuaScriptMan.deinit();
::Aurora::Lua::ScriptManager::destroy();
Expand Down
3 changes: 2 additions & 1 deletion src/engines/witcher/witcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include <list>

#include "src/common/scopedptr.h"
#include "src/common/ustring.h"
#include "src/common/changeid.h"

Expand Down Expand Up @@ -70,7 +71,7 @@ class WitcherEngine : public Engines::Engine {
std::list<Common::ChangeID> _languageResources;
Common::ChangeID _languageTLK;

Game *_game;
Common::ScopedPtr<Game> _game;


void init();
Expand Down

0 comments on commit 0fa7935

Please sign in to comment.