Fixed an issue where an in motion unit would use the wrong starting location for pathing requests. #1128
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.