Moderator: OpenTTD Developers
I don't have a rock-steady case for reproducing the issue, but the AI I'm working on seems to run into it eventually on big enough maps. Where can I download your patch for testing?
Thanks for the guidance regarding making patches - I have a bit of knowledge of git but am still learning all the ins and outs, so I appreciate the information.
I forgot to attach the patch file. I've edited my post and added it now.
At a glance, it seems to match my changes. I'll spend some time testing your patch and report back.
Running your patch throws an error - the iterator falls out of scope after the end of the for... loop in DoPathfinding. The attached patch just moves the declaration if it a line earlier. With that applied, it looks like everything works well and the issues in my last post are all resolved.
I'm going to keep poking around and see if anything else comes up, but for now it looks good to me.
- Apply after zuu's patch
- (430 Bytes) Downloaded 112 times
I have made an update to SuperLib that fixes that RoadBuilder would not timeout.
If you use SuperLib.RoadPathFinder directly in your AI or library, you need to update your code, as I have fixed it to now behave as documented. If you only use RoadBuilder, then the interface has not changed.
Code: Select all
Fix: - RoadPathFinder::FindPath and ::GetFindPathError was not responding as documented - RoadBuilder timeout was not working - Road::GrowStation was connecting added stop in a suboptimal way - Town::GetTownProducedCargoList and Town::GetTownAcceptedCargoList now neturn a new list instance each time, so that if you modify the returned list, it will not affect the next call to the method. - A few debug messages printed using AILog was fixed to use the Log system Thanks to yorg for debugging and posting patches that contributed towards solving the timeout problem.
The update is available on bananas
Edit: Forgot to include Town::GetTownProducedCargoList and Town::GetTownAcceptedCargoList in changelog.
If your AI is using RoadBuilder and was using SuperLib pre 40 and then changed to 40, review your max_loops parameter if you set it explicitly when you call RoadBuilder.Init. If you used a too low limit in past versions of your AI it was not a problem in SuperLib 39 because it had a bug that it would not abort at max_loops, so you didn't notice that you used a too low limit. Now with SuperLib 40, you need to take care to not use a too low limit in relation to how long distance your routes are. The SuperLib default value is 4000, but please play around and find a value that suits your AI.
Parameters of the Init method:
Code: Select all
function Init(tile1, tile2, repair_existing = false, max_loops = 4000, forbidden_tiles = );
Users browsing this forum: No registered users and 2 guests