Skip to content

Commit

Permalink
Fix battle calc current player selection in history mode.
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 acf0598 commit 25b9271
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 25b9271

Please sign in to comment.