FS#6512 - Different costs when building canal on object with water

Attached to Project: OpenTTD
Opened by Ricardo (Samu) - Saturday, 17 September 2016, 11:04 GMT
Type Bug
Category NewGRF → NewObject
Status New
Assigned To No-one
Operating System Windows
Severity Very Low
Priority Normal
Reported Version 1.6.1
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


I used OpenGFX+ Landscape 1.1.2 to reproduce this bug.

Preparation steps:
- start a new game
- place a "rocky land" on water, costs £640

Cost A:
- demolish "rocky land" on water, costs £256
- build canal on water, costs £5000
result: a clean canal tile
total cost: £5256

Cost B:
- build canal on "rocky land" directly, costs £15256
result: a clean canal tile
total cost: £15256

Bug: same result, but for different costs.
This task depends upon

Comment by Grzegorz Duczyński (adf88) - Sunday, 18 September 2016, 08:02 GMT
That's f....ed up.

In r20748 (-Fix: overbuilding an object tile with sea under it with a canal didn't take the cost for clearing the sea into account) there was this extra cost added, even a special flag was added (DC_FORCE_CLEAR_TILE).

Then, r24972 (-Fix [  FS#5258  ]: do not make overbuilding rivers with canals insanely expensive; there is no real need to fill the river with dirt first, just excavate it a bit and build borders) seemed to be trying to also revert r20748 but is hasn't been done properly.

The solution would be not to use DC_FORCE_CLEAR_TILE flag when clearing land for a canal (like in other cases e.g. when building buoys). Perhaps we can get rid of the DC_FORCE_CLEAR_TILE flag entirely.