Skip to content

Commit

Permalink
Fix battle calc current player selection in history mode. (#11803)
Browse files Browse the repository at this point in the history
This is a corrected version of the change done in #10759.
  • Loading branch information
asvitkine committed Jul 22, 2023
1 parent 128dfce commit 849f33f
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,13 @@ public synchronized void removeAllHistoryAfterNode(final HistoryNode removeAfter
if (node instanceof Step) {
player = ((Step) node).getPlayerId();
}
int nodeChangeIndex = getNextChange(node);
if (seekingEnabled && nodeChangeIndex > nextChangeIndex) {
break;
if (node.isLeaf()) {
// Don't do this logic on non-leaf nodes as getNextChange() will return
// the next change after this non-leaf, skipping all the child nodes.
int nodeChangeIndex = getNextChange(node);
if (seekingEnabled && nodeChangeIndex > nextChangeIndex) {
break;
}
}
}
return player;
Expand Down

0 comments on commit 849f33f

Please sign in to comment.