Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix #7226: No ship track due to "forbid 90 deg turns"-> Do not call pathfinders. #7230
It could be up to the pathfinder to return INVALID_TRACKDIR to say there is no path ahead, there is no problem with that.
But most controllers (ship and train at least) don't call the pathfinder if there is no available option (if there is only one track or no track at all, they don't call the pathfinder because there is no necessity of doing so). The train controller checks for the 90 deg turns setting before executing its pathfinders. This commit tries to be consistent with the approach in train_cmd and part of the code in ship_cmd.
So, I think it is better to be consistent with the approach in train_cmd. Moreover, we can keep the asserts on NPF by now, to ensure everything on the pathfinder (or in previously executed functions) work as expected.
I know the asserts on NPF are really tight, but those asserts are a good way of finding out situations where NPF (or something outside the pathfinder) don't work well. I would keep them for the time being and expect bug reports. If someone finds situations where it is necessary to remove them, they will be removed in the future, but not yet.
To sum up, those asserts are there to find out pathfinder bugs instead of sweeping them under the carpet. And in my opinion, this approach is consistent with the existing code and gives NPF the responsibility of throwing an assert in some cases where something goes wrong.