From 396076c6fd9a74966357074ea9cc5b51f1181f96 Mon Sep 17 00:00:00 2001
From: Paul Gilbert
Date: Sun, 1 Apr 2018 17:18:37 -0400
Subject: XEEN: Fix combat crash when additional monsters join the front row

---
 engines/xeen/combat.h      |  2 +-
 engines/xeen/interface.cpp | 10 ++++------
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/engines/xeen/combat.h b/engines/xeen/combat.h
index 6dc20a01fb..5d27dc5c4e 100644
--- a/engines/xeen/combat.h
+++ b/engines/xeen/combat.h
@@ -151,7 +151,7 @@ private:
 public:
 	Common::Array<Character *> _combatParty;
 	bool _charsBlocked[PARTY_AND_MONSTERS];
-	Common::Array<int> _charsGone;
+	int _charsGone[PARTY_AND_MONSTERS];
 	SpriteResource _powSprites;
 	int _attackMonsters[ATTACK_MONSTERS_COUNT];
 	int _monster2Attack;
diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp
index 8e973f793e..8e52aae7ae 100644
--- a/engines/xeen/interface.cpp
+++ b/engines/xeen/interface.cpp
@@ -1462,7 +1462,6 @@ void Interface::doCombat() {
 	mainIconsPrint();
 
 	combat._combatParty.clear();
-	combat._charsGone.clear();
 	combat.clearBlocked();
 	combat._pow[0]._duration = 0;
 	combat._pow[1]._duration = 0;
@@ -1475,9 +1474,8 @@ void Interface::doCombat() {
 	combat.setSpeedTable();
 
 	// Initialize arrays for character/monster states
-	combat._charsGone.resize(combat._speedTable.size());
-	Common::fill(&combat._charsGone[0], &combat._charsGone[0] + combat._speedTable.size(), 0);
-	Common::fill(&combat._charsBlocked[0], &combat._charsBlocked[0] + combat._speedTable.size(), false);
+	Common::fill(&combat._charsGone[0], &combat._charsGone[PARTY_AND_MONSTERS], 0);
+	Common::fill(&combat._charsBlocked[0], &combat._charsBlocked[PARTY_AND_MONSTERS], false);
 
 	combat._whosSpeed = -1;
 	combat._whosTurn = -1;
@@ -1657,7 +1655,7 @@ void Interface::doCombat() {
 
 			// Handling for if the combat turn is complete
 			if (combat.allHaveGone()) {
-				Common::fill(&combat._charsGone[0], &combat._charsGone[0] + combat._charsGone.size(), false);
+				Common::fill(&combat._charsGone[0], &combat._charsGone[PARTY_AND_MONSTERS], false);
 				combat.clearBlocked();
 				combat.setSpeedTable();
 				combat._whosTurn = -1;
@@ -1796,7 +1794,7 @@ void Interface::nextChar() {
 			combat.setSpeedTable();
 			combat._whosTurn = -1;
 			combat._whosSpeed = -1;
-			Common::fill(&combat._charsGone[0], &combat._charsGone[0] + combat._charsGone.size(), 0);
+			Common::fill(&combat._charsGone[0], &combat._charsGone[PARTY_AND_MONSTERS], false);
 			continue;
 		}
 
-- 
cgit v1.2.3