Open kwvanderlinde opened 10 months ago
Something else that may be related is that we draw waypoints wherever a token is dragged back over its path, e.g., by dragging it right, setting a waypoint, then dragging back left:
The waypoint is only visible if the token has some transparency.
Edit: Actually this just looks like a pure rendering issue due to start and end points internally being treated as waypoints.
I'm looking at addressing this via a refactoring of the zone walkers. It's hard to verify the correctness of the existing ZoneWalker
in the presence of multithreading, because of how much it does and the differing behaviour in its various mutators.
What I'm hoping to do is reduce the ZoneWalker
interface to the bare minimum needed to provide different pathfinding behaviour. It would explicitly not be safe to use concurrently, but could still be used with different threads. It would look something like:
public interface ZoneWalker {
/** Updates topology, terrain modifiers, and flags. */
void update( /* some state */ );
/** Calculates the partial path from start to end */
SomeResultType calculatePath(CellPoint start, CellPoint end);
The update()
method would always be called on the EDT, which is important since it sources data from the Zone
. Meanwhile, calculatePath()
can be run on a background thread if desired, provided it never runs concurrently with update()
for the same walker.
The above interface deliberately doesn't understand waypoints or anything about how to manage them. That will fall to Selectionset
and RenderPathWorker
to figure out. RenderPathWorker
will certainly have a list of waypoints it needs to get through, and will iteratively call ZoneWalker#update()
until it is canceled or a complete path has been calculated.
Describe the Bug
If waypoints are being set quickly during a token drag, it is possible for the path to have multiple branches, for waypoints to not match the path, or for CMEs to the thrown and shown to the user. Any of these symptoms seem to be achievable without the others or in conjunction with the others.
Waypoint issues include missing waypoints and repeated waypoints when they should be unique.
To Reproduce
Expected Behaviour
Pathfinding should produce true paths (no branches) and should include all waypoints necessary to produce the path. Waypoints should not be duplicated within a path. Errors should not be produced.
Screenshots
Here is an example problem path found in this campaign:
There's a few weird things going on with this case. The path distances show a branch in the path when stepping out of cell (17, 8) (the step from distance=185 to distance=190). The actual list of cells steps normally all the way to the left at (-2, 8), but then jumps back to to (18, 8) (where distance = 180) to continue down the second branch. A waypoint was set at (-2, 8), but that waypoint was either lost or toggled back off (I'm not sure). Another oddity is that waypoint (14, 6) is repeated at two different points in the path.
MapTool Info
1.13.2, develop
Desktop
Linux 21.2
Additional Context
Here is an example CME as generated on latest develop (efc31d943):