From 7b6dd298e4b1afbe3d58fbe75dd686d78de15ba8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 14 Apr 2018 15:03:15 -0400 Subject: XEEN: Clear prior pending treasure when loading savegame --- engines/xeen/party.cpp | 6 ++++++ engines/xeen/party.h | 5 +++++ engines/xeen/saves.cpp | 1 + 3 files changed, 12 insertions(+) diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp index eafc026e34..db73a475bc 100644 --- a/engines/xeen/party.cpp +++ b/engines/xeen/party.cpp @@ -87,6 +87,12 @@ void Treasure::clear() { } } +void Treasure::reset() { + clear(); + _hasItems = false; + _gold = _gems = 0; +} + /*------------------------------------------------------------------------*/ const int BLACKSMITH_DATA1[4][4] = { diff --git a/engines/xeen/party.h b/engines/xeen/party.h index 4b0616bfc6..3d6142451c 100644 --- a/engines/xeen/party.h +++ b/engines/xeen/party.h @@ -87,6 +87,11 @@ public: * Clears the treasure list */ void clear(); + + /** + * Completely reset the treasure data + */ + void reset(); }; /** diff --git a/engines/xeen/saves.cpp b/engines/xeen/saves.cpp index 4aee1a6a34..60cac91b75 100644 --- a/engines/xeen/saves.cpp +++ b/engines/xeen/saves.cpp @@ -190,6 +190,7 @@ Common::Error SavesManager::loadGameState(int slot) { // Reset any combat information from the previous game combat.reset(); + party._treasure.reset(); // Load the new map map.clearMaze(); -- cgit v1.2.3