Skip to content

Conversation

@CAHEK7
Copy link
Contributor

@CAHEK7 CAHEK7 commented Nov 15, 2025

Summary

Bugfixes "loops on autodrive routes"

Purpose of change

Fixes #83776

Describe the solution

Detailed problem description is in the issue, and the solution is removing not just the last matching node from the global path, but whole section of the global path from the end to the current vehicle position.
It scans the path from the end, so in the most cases it matches the first encountered element and removes it. But in case if we jumped over a few (most probably just one) path nodes, it removes the whole section to avoid "visiting" that skipped node.

Describe alternatives you've considered

Don't know.

Testing

Using bug report save

Additional context

There is a single-line kind of unrelated change where I removed unnecessary pop_back just before explicit clear call. I don't feel that it requires separated PR, but it's doable.

@github-actions github-actions bot added Vehicles Vehicles, parts, mechanics & interactions [C++] Changes (can be) made in C++. Previously named `Code` <Bugfix> This is a fix for a bug (or closes open issue) json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions labels Nov 15, 2025
@RenechCDDA
Copy link
Member

So if I'm reading this correctly your patch essentially clears all 'passed' nodes if it detects that the vehicle is on a later one.

What if the vehicle is on a 'passed' node but the orientation makes it impossible to continue on the path? In other words, if the loop occurs regardless.

@RenechCDDA
Copy link
Member

After some consultation on the development discord, I'm tentatively going to assign this to be a 0.I backport.

The issue being fixed is present on 0.I and the fix isn't too invasive, so assuming it passes testing I'm relatively confident in it.

@RenechCDDA RenechCDDA added the target/0.I-branch Tag to trigger trop bot to port a PR to the 0.I branch. label Nov 15, 2025
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Nov 15, 2025
@CAHEK7
Copy link
Contributor Author

CAHEK7 commented Nov 15, 2025

So if I'm reading this correctly your patch essentially clears all 'passed' nodes if it detects that the vehicle is on a later one.

Basically it doesn't care about 'passed' nodes, the only point is that - if we've managed to occur later on the global path, no need to visit any previous nodes. Whatever the reasons were, like we probably got teleported almost to the end of the route never touching any of the previous nodes - it doesn't matter.
But I can hardly image the case where we can skip more than one node. It could be a teleport, or super fast flying vehicle, which can still have its own problems.

What if the vehicle is on a 'passed' node but the orientation makes it impossible to continue on the path? In other words, if the loop occurs regardless.

Given the current way how it works, only skidding can lead to that situation, and we stop autodrive in this case. In the other cases it looks mostly like broken pathfinding (or we've got suddenly teleported, but it's a legit reason to turn around and form a loop).

@CAHEK7
Copy link
Contributor Author

CAHEK7 commented Nov 15, 2025

It looks like failed tests are a bit unrelated to any of the changes - like some problems with items and pockets.

@GuardianDll GuardianDll merged commit b1e321c into CleverRaven:master Nov 17, 2025
28 checks passed
@migo-chan
Copy link

migo-chan bot commented Nov 17, 2025

I have automatically backported this PR to "0.I-branch", please check out #83806

@migo-chan migo-chan bot added in-flight/0.I-branch and removed target/0.I-branch Tag to trigger trop bot to port a PR to the 0.I branch. labels Nov 17, 2025
@migo-chan
Copy link

migo-chan bot commented Nov 17, 2025

I was unable to backport this PR to "0.I-branch" cleanly;
you will need to perform this backport manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` json-styled JSON lint passed, label assigned by github actions merged/0.I-branch Vehicles Vehicles, parts, mechanics & interactions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Autodrive forms loops while there is a clear path ahead

3 participants