You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have another problem with the town ratings. Its change is not atomic.
Basically a dry run of building a bridge succeeds because town penalty ratings are not accumulated.
When a bridge is actually built (see attached savegame) the penalty for removing the tree is deducted but the town will not allow removing its road, thus the command fails for the execution run (res != res2). Without assertions you will get the following picture, and broken savegame.
A solution would be to somehow get the town penalties from the deep underlying function and check that in the dry run as well...any clever ideas?
Thankfully to reproduce this bug you need very specific circumstances that won't happen too often, but this should be fixed. The only problem is how to return back the town penalties from a tile-independent CMD_LANDSCAPE_CLEAR and deal with the possible multiple town authorities the tiles along the way might belong to.
I would have an idea for solvage that could include something similar to the SET_EXPENSES_MACRO but with a function for town ratings. The only problem is it wouldn't check ratings for the multiple towns the bridge might pass through...
It would be something like:
StartTownRatingModificationCount();
..
do commands
..
modification = GetTownRatingModificationCount();
if (t->ratings[player] - modification < 0) cmd_error;
Bug does not happen in trunk/ after bridge-merge because even half-road pieces are not removed. Only other thing that could be removed are trees, but those are not checked for permission by town-authority.
So this bug might be obsolete. Still it would be nice to have some access to the town-rating affect numbers as then the CMD_AUTO hacks can be removed.
Darkvater opened the ticket and wrote:
Attachments
Reported version: trunk
Operating system: All
This issue was imported from FlySpray: https://bugs.openttd.org/task/519
The text was updated successfully, but these errors were encountered: