aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2018-03-31 18:29:52 -0400
committerPaul Gilbert2018-03-31 18:29:52 -0400
commit263df996b60ea9b505be18f5eeeb3ce4c27d0fd2 (patch)
treef5b23918c612200afcb3b398aad964629b481e36
parent6abead118e782139f94fdc81cd1638a636f8857e (diff)
downloadscummvm-rg350-263df996b60ea9b505be18f5eeeb3ce4c27d0fd2.tar.gz
scummvm-rg350-263df996b60ea9b505be18f5eeeb3ce4c27d0fd2.tar.bz2
scummvm-rg350-263df996b60ea9b505be18f5eeeb3ce4c27d0fd2.zip
XEEN: Properly clear misc item treasure list afterwards
-rw-r--r--engines/xeen/party.cpp24
-rw-r--r--engines/xeen/party.h5
2 files changed, 16 insertions, 13 deletions
diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp
index dc90863b8c..f60c532872 100644
--- a/engines/xeen/party.cpp
+++ b/engines/xeen/party.cpp
@@ -78,6 +78,15 @@ Treasure::Treasure() {
_categories[3] = &_misc[0];
}
+void Treasure::clear() {
+ for (int idx = 0; idx < MAX_TREASURE_ITEMS; ++idx) {
+ _weapons[idx].clear();
+ _armor[idx].clear();
+ _accessories[idx].clear();
+ _misc[idx].clear();
+ }
+}
+
/*------------------------------------------------------------------------*/
const int BLACKSMITH_DATA1[4][4] = {
@@ -719,12 +728,7 @@ void Party::giveTreasure() {
} else {
// Otherwise, clear all the remaining treasure items,
// since all the party's packs are full
- for (int idx = 0; idx < MAX_TREASURE_ITEMS; ++idx) {
- _treasure._weapons[idx].clear();
- _treasure._armor[idx].clear();
- _treasure._accessories[idx].clear();
- _treasure._armor[idx].clear();
- }
+ _treasure.clear();
}
}
@@ -787,13 +791,7 @@ void Party::giveTreasure() {
_treasure._gems = 0;
_treasure._hasItems = false;
- for (int idx = 0; idx < MAX_TREASURE_ITEMS; ++idx) {
- _treasure._weapons[idx].clear();
- _treasure._armor[idx].clear();
- _treasure._accessories[idx].clear();
- _treasure._armor[idx].clear();
- }
-
+ _treasure.clear();
combat._combatTarget = 1;
}
diff --git a/engines/xeen/party.h b/engines/xeen/party.h
index 322ae2b052..ef3a67ff62 100644
--- a/engines/xeen/party.h
+++ b/engines/xeen/party.h
@@ -81,6 +81,11 @@ public:
* Returns a particular category's array
*/
XeenItem *operator[](int category) { return _categories[category]; }
+
+ /**
+ * Clears the treasure list
+ */
+ void clear();
};
/**