Doing the animations on the EDT. This fixes a concurrent modification exception that sometimes prevented animations from displaying properly.

This commit is contained in:
Stian Grenborgen 2023-05-02 18:32:22 +02:00
parent 55c7beabc0
commit 3345d42808
1 changed files with 6 additions and 3 deletions

View File

@ -2679,8 +2679,9 @@ public final class InGameController extends FreeColClientHolder {
public void animateAttackHandler(Unit attacker, Unit defender,
Tile attackerTile, Tile defenderTile,
boolean success) {
getGUI().animateUnitAttack(attacker, defender,
attackerTile, defenderTile, success);
invokeLater(() -> {
getGUI().animateUnitAttack(attacker, defender, attackerTile, defenderTile, success);
});
}
/**
@ -2691,7 +2692,9 @@ public final class InGameController extends FreeColClientHolder {
* @param newTile The {@code Tile} the move ends at.
*/
public void animateMoveHandler(Unit unit, Tile oldTile, Tile newTile) {
getGUI().animateUnitMove(unit, oldTile, newTile);
invokeLater(() -> {
getGUI().animateUnitMove(unit, oldTile, newTile);
});
}
/**