aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen/interface.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2018-04-29 17:50:14 -0400
committerPaul Gilbert2018-04-29 17:50:14 -0400
commitd9efbee9e374b7be2a11063469c5e97266c19730 (patch)
treee9af175970ac11e3a436da2a452451f0ca2a65da /engines/xeen/interface.cpp
parent359e7d53b22ececf5bece2d367adbd16ed826033 (diff)
downloadscummvm-rg350-d9efbee9e374b7be2a11063469c5e97266c19730.tar.gz
scummvm-rg350-d9efbee9e374b7be2a11063469c5e97266c19730.tar.bz2
scummvm-rg350-d9efbee9e374b7be2a11063469c5e97266c19730.zip
XEEN: Add FIXME to hopefully prevent a rare combat failure condition
Diffstat (limited to 'engines/xeen/interface.cpp')
-rw-r--r--engines/xeen/interface.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp
index 079c82fdb5..c288bbbe4b 100644
--- a/engines/xeen/interface.cpp
+++ b/engines/xeen/interface.cpp
@@ -1461,6 +1461,7 @@ void Interface::doCombat() {
Windows &windows = *_vm->_windows;
bool upDoorText = _upDoorText;
bool reloadMap = false;
+ int index = 0;
_upDoorText = false;
combat._combatMode = COMBATMODE_2;
@@ -1506,6 +1507,12 @@ void Interface::doCombat() {
bool breakFlag = false;
while (!_vm->shouldExit() && !breakFlag && !party._dead && _vm->_mode == MODE_COMBAT) {
+ // FIXME: I've had a rare issue where the loop starts with a non-party _whosTurn. Unfortunately,
+ // I haven't been able to consistently replicate and diagnose the problem, so for now,
+ // I'm simply detecting if it happens and resetting the combat round
+ if (combat._whosTurn >= party._activeParty.size())
+ goto new_round;
+
highlightChar(combat._whosTurn);
combat.setSpeedTable();
@@ -1516,7 +1523,7 @@ void Interface::doCombat() {
w.update();
// Wait for keypress
- int index = 0;
+ index = 0;
do {
events.updateGameCounter();
draw3d(true);
@@ -1662,6 +1669,7 @@ void Interface::doCombat() {
// Handling for if the combat turn is complete
if (combat.allHaveGone()) {
+new_round:
Common::fill(&combat._charsGone[0], &combat._charsGone[PARTY_AND_MONSTERS], false);
combat.clearBlocked();
combat.setSpeedTable();