Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed an issue where an in motion unit would use the wrong starting location for pathing requests. #1128

Merged
merged 3 commits into from
Apr 3, 2024

Conversation

hemoridos
Copy link
Contributor

Fixed an issue where an in motion unit would use the wrong starting location for pathing requests.
This caused that unit could walk through non-passable locations if a new move order (or pathing request) was given when the unit is in the process of moving to the next cell but technically is still in it's starting point cell. When the unit arrived in the next cell it would follow the new path bee-lining to the new path's first location walking through everything in between.

Now when a new pathing request is made, if the unit is in motion but is still located in the starting cell, then the nextMove(soon to be current) cell will be used as the starting point of the new pathing request, so the unit can continue moving seamlessly once arriving in nextMove cell.

Also changed the unit path to use LinkedList instead of ArrayList as in all cases only the first and last elements are accessed.
This somehow also fixed #1121. How this fixed it I have no idea but since using a LinkedList I could not reproduce that problem.

Renamed a few fields and variables while debugging to be a bit more specific.

@akarnokd akarnokd merged commit a76bfe1 into akarnokd:master Apr 3, 2024
@hemoridos hemoridos deleted the pathing_fix branch April 12, 2024 14:10
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.

földi csata AI
2 participants