[Scummvm-git-logs] scummvm master -> 263df996b60ea9b505be18f5eeeb3ce4c27d0fd2

dreammaster dreammaster at scummvm.org
Sun Apr 1 00:29:58 CEST 2018


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
263df996b6 XEEN: Properly clear misc item treasure list afterwards


Commit: 263df996b60ea9b505be18f5eeeb3ce4c27d0fd2
    https://github.com/scummvm/scummvm/commit/263df996b60ea9b505be18f5eeeb3ce4c27d0fd2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-03-31T18:29:52-04:00

Commit Message:
XEEN: Properly clear misc item treasure list afterwards

Changed paths:
    engines/xeen/party.cpp
    engines/xeen/party.h


diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp
index dc90863..f60c532 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 322ae2b..ef3a67f 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();
 };
 
 /**





More information about the Scummvm-git-logs mailing list