diff options
author | Littleboy | 2012-07-29 21:06:01 -0400 |
---|---|---|
committer | Littleboy | 2012-07-29 21:09:35 -0400 |
commit | 5df2bd896247a59d6166c5f69b93355b66b5f920 (patch) | |
tree | 5ff9d63bee4d1c083e6216a2d506a23055f16e12 | |
parent | 65565c891493ed6a54a347df8041a011512d5cb8 (diff) | |
download | scummvm-rg350-5df2bd896247a59d6166c5f69b93355b66b5f920.tar.gz scummvm-rg350-5df2bd896247a59d6166c5f69b93355b66b5f920.tar.bz2 scummvm-rg350-5df2bd896247a59d6166c5f69b93355b66b5f920.zip |
LASTEXPRESS: Fix regression with Logic::resetState()
-rw-r--r-- | engines/lastexpress/game/logic.cpp | 4 | ||||
-rw-r--r-- | engines/lastexpress/game/state.cpp | 12 | ||||
-rw-r--r-- | engines/lastexpress/game/state.h | 2 |
3 files changed, 16 insertions, 2 deletions
diff --git a/engines/lastexpress/game/logic.cpp b/engines/lastexpress/game/logic.cpp index a8619512cb..1696f100ff 100644 --- a/engines/lastexpress/game/logic.cpp +++ b/engines/lastexpress/game/logic.cpp @@ -406,9 +406,9 @@ void Logic::resetState() { getScenes()->setCoordinates(Common::Rect(80, 0, 559, 479)); SAFE_DELETE(_entities); - SAFE_DELETE(_state); _entities = new Entities(_engine); - _state = new State(_engine); + + _state->reset(); } /** diff --git a/engines/lastexpress/game/state.cpp b/engines/lastexpress/game/state.cpp index f3fd9720b1..02ede25595 100644 --- a/engines/lastexpress/game/state.cpp +++ b/engines/lastexpress/game/state.cpp @@ -49,6 +49,18 @@ State::~State() { _engine = NULL; } +void State::reset() { + SAFE_DELETE(_inventory); + SAFE_DELETE(_objects); + SAFE_DELETE(_savepoints); + SAFE_DELETE(_state); + + _inventory = new Inventory(_engine); + _objects = new Objects(_engine); + _savepoints = new SavePoints(_engine); + _state = new GameState(); +} + bool State::isNightTime() const { return (_state->progress.chapter == kChapter1 || _state->progress.chapter == kChapter4 diff --git a/engines/lastexpress/game/state.h b/engines/lastexpress/game/state.h index c937fdce9f..2c484f6976 100644 --- a/engines/lastexpress/game/state.h +++ b/engines/lastexpress/game/state.h @@ -621,6 +621,8 @@ public: State(LastExpressEngine *engine); ~State(); + void reset(); + // Accessors Inventory *getGameInventory() { return _inventory; } Objects *getGameObjects() { return _objects; } |