triplea-game / triplea

TripleA is a turn based strategy game and board game engine, similar to Axis & Allies or Risk.
https://triplea-game.org/
GNU General Public License v3.0
1.36k stars 399 forks source link

GameStepPropertiesHelper#isCombatMove:114 - java.lang.IllegalStateException #11319

Open tripleabuilderbot opened 1 year ago

tripleabuilderbot commented 1 year ago

Log Message

Cannot determine combat or not: germansBattle

TripleA Version

2.6+14202

Java Version

11.0.9.1

Operating System

Windows 10

Stack Trace

Exception: java.lang.IllegalStateException Cannot determine combat or not: germansBattle
java.lang.Exception
    at games.strategy.triplea.delegate.GameStepPropertiesHelper.isCombatMove(GameStepPropertiesHelper.java:114)
    at games.strategy.triplea.delegate.GameStepPropertiesHelper.isCombatMove(GameStepPropertiesHelper.java:94)
    at games.strategy.triplea.delegate.move.validation.MoveValidator.getBestRoute(MoveValidator.java:1813)
    at games.strategy.triplea.ui.panel.move.MovePanel.getRouteNonForced(MovePanel.java:1048)
    at games.strategy.triplea.ui.panel.move.MovePanel.getRoute(MovePanel.java:1008)
    at games.strategy.triplea.ui.panel.move.MovePanel$3.mouseMoved(MovePanel.java:656)
    at games.strategy.triplea.ui.panels.map.MapPanel.notifyMouseMoved(MapPanel.java:497)
    at games.strategy.triplea.ui.panels.map.MapPanel.updateMouseHoverState(MapPanel.java:320)
    at games.strategy.triplea.ui.panels.map.MapPanel$4.mouseMoved(MapPanel.java:268)
    at java.desktop/java.awt.AWTEventMulticaster.mouseMoved(AWTEventMulticaster.java:338)
    at java.desktop/java.awt.Component.processMouseMotionEvent(Component.java:6680)
    at java.desktop/javax.swing.JComponent.processMouseMotionEvent(JComponent.java:3360)
    at java.desktop/java.awt.Component.processEvent(Component.java:6404)
    at java.desktop/java.awt.Container.processEvent(Container.java:2263)
    at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5011)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4843)
    at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
    at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4560)
    at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
    at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4843)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
asvitkine commented 1 year ago

So this is a case where the UI thinks we're making a move, so expects it to either be during combat move or non-combat move, but actually we're in the middle of a battle. So somehow the UI is out of sync with what's happening in the game.

It would be good if someone could find a way to repro. Is it something like ending the phase via a shortcut while doing a move in the UI?

asvitkine commented 1 year ago

I marked https://github.com/triplea-game/triplea/issues/10852 as a dupe, but notably that one is during a purchase phase.

frigoref commented 5 months ago

@asvitkine How do you know this is happening during a battle? If this is true shouldn't we limit the mouse over handling already before the exception location? I am also surprised that the MoveValidator is called from the MovePanel if this is really during a battle.