Skip to content

Commit

Permalink
SONIC: Use ScopedPtr in Game
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMcCoy committed Oct 26, 2016
1 parent 9a92bed commit 04306ad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 3 additions & 5 deletions src/engines/sonic/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace Engines {
namespace Sonic {

Game::Game(SonicEngine &engine, ::Engines::Console &console) :
_engine(&engine), _module(0), _console(&console) {
_engine(&engine), _console(&console) {

Aurora::Language language = Aurora::kLanguageInvalid;
_engine->getLanguage(language);
Expand All @@ -60,7 +60,6 @@ Game::Game(SonicEngine &engine, ::Engines::Console &console) :
}

Game::~Game() {
delete _module;
}

Module &Game::getModule() {
Expand All @@ -81,12 +80,11 @@ void Game::run() {
if (!showChapter1())
return;

_module = new Module(*_console);
_module.reset(new Module(*_console));

runModule();

delete _module;
_module = 0;
_module.reset();
}

void Game::runModule() {
Expand Down
5 changes: 4 additions & 1 deletion src/engines/sonic/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#ifndef ENGINES_SONIC_GAME_H
#define ENGINES_SONIC_GAME_H

#include "src/common/scopedptr.h"

#include "src/graphics/aurora/fonthandle.h"

namespace Engines {
Expand All @@ -48,7 +50,8 @@ class Game {

private:
SonicEngine *_engine;
Module *_module;

Common::ScopedPtr<Module> _module;

::Engines::Console *_console;

Expand Down

0 comments on commit 04306ad

Please sign in to comment.