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
{{ message }}
Repository navigation
Newobjects on river slopes - unintended behavior #5441
As of OTTD 1.3.0 beta1, clearing a Newobject on a river slope also destroys the river beneath it. Normally, clearing a Newobject on an unsloped water tile using the dynamite tool preserves the water underneath, and I believe this is also the intended behavior for sloped river tiles, so the current behavior seems to be a bug.
Additionally, building an object that normally has zero cost on a river slope incurs a small cost. I'm not sure where this cost comes from, and it seems to be unintended behavior.
Steps to reproduce the unintended behavior, either:
1a) Load the attached .grf in OTTD 1.3.0 beta1 and load the attached .sav
2a) Clear a Newobject (circling seagulls) on a river slope using the dynamite tool; the river beneath is destroyed.
3a) Build a Newobject on a river slope to observe a small cost, whilst building it on an unsloped water tile has no cost.
Or, alternatively:
1b) Load the attached GRF in OTTD 1.3.0 beta1
2b) Generate a map with sloped river tiles
3b) Build one of the Newobjects on a sloped river tile to observe a small cost, whilst building it on an unsloped water tile has no cost.
4b) Clear the object using the dynamite tool; the river beneath is destroyed.
In case it helps, the Newobjects in question have the following NML flags set:
Ok, I'm pretty sure I've identified the river-clearing problem, it is in the MakeWaterKeepingClass function in water_cmd.cpp:
That function checks if (GetTileSlope(tile, &z) != SLOPE_FLAT) and then always sets wc = WATER_CLASS_INVALID;
Commenting out line 173:
wc = WATER_CLASS_INVALID;
stops the unintended river-destruction and cost when clearing the sloped river tile. Of course, just commenting that out is not a real fix, as there likely is a reason that line is there, but it does appear to be the source of the problem.
... add the observed cost for slopes as observed in the steps detailed above. Setting the tile_check callback removes the build cost, so that's not directly an OTTD bug, but a bug in the grf, I suppose.
The action sequence as shown in the three screenshots will lead to invalid river slopes. Thus if autoslope for the object is enabled, the river should not be restored, if its restoration would result in a slope forbidden for water.
Thus you might want to check for allowed water slopes before WATER_CLASS_RIVER is restored. The check is not needed for WATER_CLASS_CANAL, but could be applied there just the same.
Also configure your editor so that it automatically removes trailing whitespace :-)
Activity
DorpsGek commentedon Jan 15, 2013
Supercheese wrote:
This comment was imported from FlySpray: https://bugs.openttd.org/task/5441#comment11868
DorpsGek commentedon Jan 15, 2013
Supercheese wrote:
This comment was imported from FlySpray: https://bugs.openttd.org/task/5441#comment11869
DorpsGek commentedon Jan 15, 2013
Supercheese wrote:
Attachments
This comment was imported from FlySpray: https://bugs.openttd.org/task/5441#comment11871
DorpsGek commentedon Jan 20, 2013
planetmaker wrote:
Attachments
This comment was imported from FlySpray: https://bugs.openttd.org/task/5441#comment11881
DorpsGek commentedon Jan 20, 2013
planetmaker closed the ticket.
Reason for closing: Fixed
This comment was imported from FlySpray: https://bugs.openttd.org/task/5441