AIRoad.RemoveRoad() failing
Moderator: OpenTTD Developers
- MinchinWeb
- Traffic Manager
- Posts: 225
- Joined: 01 Feb 2011 12:41
- Contact:
AIRoad.RemoveRoad() failing
I was trying to remove extra roads using AIRoad.RemoveRoad(), but it kept leaving little bits of road, almost all (all?) on steep slopes. The road would have originally been a straight line down the hill, with the road tiles removed in a random order. Using AIRoad.RemoveRoadFull() seems to fix it. Is this a feature, or a bug?
- Attachments
-
- Road Removal Fail 2.png (119.67 KiB) Viewed 2019 times
-
- Road Removal Fail.png (164.05 KiB) Viewed 2019 times
Alberta Town Names - 1500+ real names from 'Acme' to 'Zama City'
MinchinWeb's Random Town Name Generator - providing 2 million plus names...
WmDOT v13 - An AI that doubles as your highway department
MinchinWeb's Random Town Name Generator - providing 2 million plus names...
WmDOT v13 - An AI that doubles as your highway department
Re: AIRoad.RemoveRoad() failing
It's a bug of your AI, not a big in OpenTTD. The upper part of a sloped road tile can't be removed without the lower part of the same tile. If you use AIRoad,RemoveRoad() in a random order, you'll try to remove the upper part of a tile before the lower part of that tile. That'll fail partially, so the upper part of that tile stays while the lower part of the adjacent tile will be removed (and AIRoad.RemoveRoad() returns True since part of the road is removed).Later you'll remove the lower part of the same tile, which will succeed, leaving a half-tile road at the upper half of the tile as you can see in your screenshots. Using AIRoad.RemoveRoadFull() is one solution, however using that you might remove a roadbit too much at the connecting road. Another solution that works in every case would to first call AIRoad.RemoveRoad() form the tile connection the stray road tile to the existing road and call AIRoad.RmoeveRoadFull() for the rest of the road you want to remove.
- MinchinWeb
- Traffic Manager
- Posts: 225
- Joined: 01 Feb 2011 12:41
- Contact:
Re: AIRoad.RemoveRoad() failing
If I were to use RemoveRoad() going up the hill, would that solve the problem (thus removing the lower part of the road before the top part)?
Alberta Town Names - 1500+ real names from 'Acme' to 'Zama City'
MinchinWeb's Random Town Name Generator - providing 2 million plus names...
WmDOT v13 - An AI that doubles as your highway department
MinchinWeb's Random Town Name Generator - providing 2 million plus names...
WmDOT v13 - An AI that doubles as your highway department
Re: AIRoad.RemoveRoad() failing
Yes. Be aware of roads that go uphill, downhill and uphill again.
Who is online
Users browsing this forum: No registered users and 11 guests