Skip to content

12051 Movement Trail option to only keep last position per location#14342

Open
rlament wants to merge 4 commits intovassalengine:release-3.7from
rlament:12051-movement-trail
Open

12051 Movement Trail option to only keep last position per location#14342
rlament wants to merge 4 commits intovassalengine:release-3.7from
rlament:12051-movement-trail

Conversation

@rlament
Copy link
Copy Markdown
Contributor

@rlament rlament commented Nov 8, 2025

This is an alternate implementation to pull request #14231 which addresses and closes #12051

Add an option to keep the last movement trail position only when location name or mat change.
All off-board movement is always appended to the movement trail.
Check for mat to mat movement within a location.
Add unit tests for movement trails.
Update movement trails documentation adding the new option.

Closes #12051

Add an option to keep the last movement trail position only when location name or mat change.
All off-board movement is always appended to the movement trail.
Check for mat to mat movement within a location.
Add unit tests for movement trails.
Update movement trails documentation adding the new option.
@rlament rlament changed the base branch from master to release-3.7 November 10, 2025 00:39
@riverwanderer riverwanderer added this to the 3.7.19 milestone Dec 9, 2025
@uckelman uckelman modified the milestones: 3.7.19, 3.7.20 Dec 30, 2025
@Niedowidek
Copy link
Copy Markdown

@rlament Ray, you made the same mistake as I did.

Step 1: I move some unit from area1 to area2 and then to area3 (green one, extreme left)
image

Step 2: I move this unit inside area3

image

Point in area2 is deleted too unfortunately.

I will look into my code as I found a solution to this problem. To be honest when I was finishing this feature my mind was cooked because of such details ;-)

Comment thread vassal-app/src/main/java/VASSAL/build/module/map/PieceMover.java
Comment thread vassal-app/src/main/java/VASSAL/counters/Footprint.java Outdated
@Niedowidek
Copy link
Copy Markdown

@rlament However I agree that your solution seems simpler and more elegant and I think we should go with it. Just this one problem described above to fix. I will look into it now.

@Niedowidek
Copy link
Copy Markdown

Also if I move inside area2 the trail dissapears entirely.

Step 1:
image

Step 2:
image

@Niedowidek
Copy link
Copy Markdown

Niedowidek commented Jan 15, 2026

@rlament Ray, I think I more or less remember my problem.

We want to compare locationName for actual position (place where you moved your piece) with the locationName of the last position on the trail.

We wrote similar code.
I wrote Strings.CS.equals(map.locationName((Point) dropTarget), map.locationName(actualPoint) in FootPrint class.
You wrote locDefinitelyChanged = (previousLocation == null) || !(previousLocation.equals(map.locationName(loc))); in PieceMover.

I think it was like that (I don't remember everything precisely).
To compare I need:

  • last position in the trail which is Point p sent to addPoint in FootPrint
  • a place where user is moving his piece - let us call it dropTarget - which is Point loc sent to movedPiece in PieceMover

I can't compare in PieceMover because I don't have Point p yet.
I can't compare in FootPrint unless I somehow get Point loc (dropTarget) from PieceMover.
That's why I send Point loc / dropTarget using DROP_TARGET property.

I agree it's not elegant but seemed necessary.

Now I lean again to my solution but what I understand from your code I didn't take into account that off board moves should always be recorded by movement trails, right?

Please tell me what you think.


Some data from debug after moving a unit to another area:

PieceMover
protected Command movedPiece(GamePiece p, Point loc)
loc: java.awt.Point[x=744,y=693]
map.locationName(loc): Area 34
previousLocation = map.locationName(p.getPosition()): Area 61

FootPrint
protected void addPoint(Point p)
p: java.awt.Point[x=702,y=526]

@Niedowidek
Copy link
Copy Markdown

@rlament Regarding "off board moves should always be recorded by movement trails" - how can I reproduce that? Can I do this in Turning Point Stalingrad or should I use another mod?

@rlament
Copy link
Copy Markdown
Contributor Author

rlament commented Jan 16, 2026

Regarding "off board moves should always be recorded by movement trails" - how can I reproduce that? Can I do this in Turning Point Stalingrad or should I use another mod?

@Niedowidek Can be done with that module. Zoom out all the way and drag a piece off below or to the side of the map.

@Niedowidek
Copy link
Copy Markdown

@rlament Does Volga River qualify as off-map ? I moved my piece several times along the river and only one position registers as in a separate area. Should every position on the trail along the Volga be visible ? That's what you have in mind?

Also when I put my piece outside the map, the trail is only visible when still on the map, after passing map's edge it dissappears, as shown below.

image

@rlament
Copy link
Copy Markdown
Contributor Author

rlament commented Jan 17, 2026

Also when I put my piece outside the map, the trail is only visible when still on the map, after passing map's edge it disappears, as shown below.

Yes, that looks correct. Except for the square units in the river, there are no zones defined for the river area. Anything moving there is labelled offboard since there is no zone. And yes, every position on the trail in the Volga should be visible. Should test for both offboard and off-map. Moving off-map the trail stops at the map boundary. In my testing I'll move off-map, shift to another location off-map and then move back on the map. The test is to verify that multiple consecutive offboard or off-map points are not removed from the movement trail.

Align variable naming with MovementMarkable
Expand unit tests
@rlament
Copy link
Copy Markdown
Contributor Author

rlament commented Jan 17, 2026

Without any code changes, I got the movement trails working in the Stalingrad. It took the longest time to figure out what module change "fixed" it. It turns out there is a trueMovedSupport flag that must be set when ignoring moves within the same location. MovementMarkable shares functionality with Footprint. When I checked the 'Mark When Moved' checkbox Ignore moves which don't change either Location Name or Mat that unknowingly set the flag. Added setting of the flag in Footprint and that seems to fix it. I didn't see this earlier because my test module had the Ignore moves checkbox checked. In the latest commit I did some renaming to better align with the MovementMarkable terminology.

@Niedowidek
Copy link
Copy Markdown

@rlament Great ! Does it mean we can go with your solution ?

@rlament
Copy link
Copy Markdown
Contributor Author

rlament commented Jan 17, 2026

@Niedowidek If you have confirmed the latest change fixes the behaviour in your module then please mark your approval for this PR. Thanks for the review and leading the way in highlighting the relevant parts of the code. If you had not initiated a PR for this feature request, it would not have happened. Next time pick an easier "good first issue". 😄

@rlament rlament requested a review from Niedowidek January 17, 2026 16:53
@Niedowidek
Copy link
Copy Markdown

@rlament Works great for areas but doesn't register every position on Volga River (and you said "every position on the trail in the Volga should be visible"). So almost perfect but this Volga river is so hard to cross... ;-)
I suppose you would like to correct it, wouldn't you?

image

@Niedowidek
Copy link
Copy Markdown

Russian side which doesn't have the option selected registers all the positions on the trail (it is correct).

image

@Niedowidek
Copy link
Copy Markdown

FootprintTest works OK

Copy link
Copy Markdown

@Niedowidek Niedowidek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"every position on the trail in the Volga should be visible" still needs to be implemented.

Comment thread vassal-app/src/main/java/VASSAL/counters/Footprint.java
Comment thread vassal-app/src/main/java/VASSAL/counters/Footprint.java
Check if location is offboard instead of checking for null board
@Niedowidek
Copy link
Copy Markdown

Volga river movement looks fine. Off-board movement too. I can see that it registers every position on the trail off-board even though they are not visible.

image

With the option turned off it works fine too:

image

@Niedowidek
Copy link
Copy Markdown

@rlament I think it works OK now.

@Niedowidek
Copy link
Copy Markdown

Thank you for your help and developing complete solution.

@uckelman uckelman modified the milestones: 3.7.20, 3.7.21 Feb 6, 2026
@uckelman uckelman removed this from the 3.7.21 milestone Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhance Movement Trail to (optionally) remove last hop if Location Name does not change

4 participants