aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/lastexpress/game/logic.cpp4
-rw-r--r--engines/lastexpress/game/state.cpp12
-rw-r--r--engines/lastexpress/game/state.h2
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; }