I could reproduce the bug, did two runs and the move/undo command pairs looked like this (2nd run in brackets, where the values were different):
* move command
- MovePiece
- oldPosition: java.awt.Point[x=75,y=316]
- newPosition: java.awt.Point[x=185,y=309] [2nd: 195/299]
- seq
- 0: NullCommand
- seq
- 0: ChangePropertyCommand
- property
- name: Blockade
- oldValue: 0
- newValue: 1
- seq
- 0: NullCommand
- seq
- 0: MovePiece
- oldPosition: java.awt.Point[x=185,y=309] [2nd: 195/299]
- newPosition: java.awt.Point[x=189,y=316]
- seq
- 0: AddPiece
- state: Map;189;316;1590737932607
- 1: DisplayText
- msg: Union Naval Blockade Level set to 1.
* undo command
- DisplayText
- msg: * UNDO: * Union Naval Blockade Level set to 1.
- seq
- 0: RemovePiece
- target: TheStack
- seq
- 0: MovePiece
- oldPosition: java.awt.Point[x=189,y=316] [2nd: 195/299]
- newPosition: java.awt.Point[x=185,y=309] [2nd: 75/316]
- 1: ChangePropertyCommand
- name: Blockade
- oldValue: 1
- newValue: 0
- 1: MovePiece
- oldPosition: java.awt.Point[x=185,y=309] [2nd: 195/299]
- newPosition: java.awt.Point[x=75,y=316]
First questions that come to mind:
- The oldPosition (75/316) is the same for both runs, the newPosition is different as I am obviously not able to drop the counter at the exact same point, but what is this third position, the (189/316) that is the same for both runs? Is it a predefined position on the map, the one that the counter is supposed to snap to?
- Why is the tree structure of the initial MoveCommand so weird, why are MovePiece and AddPiece children of the ChangePropertyCommand, shouldn’t they be siblings if anything?
And the Undo command is even more weird, its structure is nothing like the Move command, it is missing all these NullCommands, and the positions are even more messed up, between the Move and Undo commands, and between both runs - why is (189/316) which seems to be a fixed position on the map present in the 1st run’s Undo but not present in the 2nd run’s Undo? Why does the 2nd test run have the same old/new position values for both MovePiece commands inside the Undo command, while the 1st test run has different ones? Is this possibly the source of the bug, that the positions get messed up when the Undo command is created?