aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/xeen/combat.cpp9
-rw-r--r--engines/xeen/combat.h5
-rw-r--r--engines/xeen/party.cpp5
3 files changed, 15 insertions, 4 deletions
diff --git a/engines/xeen/combat.cpp b/engines/xeen/combat.cpp
index 2bd0187fed..e8ae670288 100644
--- a/engines/xeen/combat.cpp
+++ b/engines/xeen/combat.cpp
@@ -2087,4 +2087,13 @@ void Combat::shootRangedWeapon() {
rangedAttack(POW_ARROW);
}
+bool Combat::areMonstersPresent() const {
+ for (int idx = 0; idx < 26; ++idx) {
+ if (_attackMonsters[idx] != -1)
+ return true;
+ }
+
+ return false;
+}
+
} // End of namespace Xeen
diff --git a/engines/xeen/combat.h b/engines/xeen/combat.h
index 5d27dc5c4e..deefe33874 100644
--- a/engines/xeen/combat.h
+++ b/engines/xeen/combat.h
@@ -305,6 +305,11 @@ public:
* Fires off a ranged attack at all oncoming monsters
*/
void shootRangedWeapon();
+
+ /**
+ * Returns true if there are any monsters in the vacinity
+ */
+ bool areMonstersPresent() const;
};
} // End of namespace Xeen
diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp
index 8852b51ca2..d53c1f2450 100644
--- a/engines/xeen/party.cpp
+++ b/engines/xeen/party.cpp
@@ -689,10 +689,7 @@ void Party::giveTreasure() {
if (!_treasure._hasItems && !_treasure._gold && !_treasure._gems)
return;
- bool monstersPresent = false;
- for (int idx = 0; idx < 26 && !monstersPresent; ++idx)
- monstersPresent = combat._attackMonsters[idx] != -1;
-
+ bool monstersPresent = combat.areMonstersPresent();
if (_vm->_mode != MODE_RECORD_EVENTS && monstersPresent)
return;