Fix #7656: destroying a tunnel/bridge now first removes the tracks for cost calculation #8508
Fixes #7656 .
Motivation / Problem
When you build a road bridge, put tram tracks on it, and destroy the road+tram bridge, you had to pay money.
This is rather unfair, to expect a player to know the difference.
This is an effect of allowing road + tram on the same bridge, where you can build either/or on them. A player that pays attention will, without a solution like this, always notice a discrepancy. If you build a road bridge and a tram bridge and a road+tram bridge, you notice quickly enough that something is not adding up.
To not over-complicate the code, I went for a simple approach: destroying a bridge is now a fixed-free + the price to remove the road/tram/rail from the bridge. In most cases this benefits the player, in some it does not.
Removing rail and tram makes you receive money, so bridges that have either of the two, are now (a lot) cheaper to destroy. Road bridges on the other hand are now slightly more expensive. I consider this an acceptable compromise.
While looking into this, I also found that destroying a bridge didn't asked you money for the end-tile (off-by-one).
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.
Note the test results (discrepancy coming from a £360 extra cost on bridge removal):
Also, why are there the stray apostrophes next to the number?
So I have not only the CI telling me regression failed, but also a user that tells me .. now I feel even worse for forgetting to run the regression before commit :'(
It only considered the end-tile (or start-tile) for the bridge, instead of both. This is obvious in the rest of the code which constantly does "+ 2"; this being the only place that does a "+ 1".
…r cost calculation This means that for rail tunnel/bridges, the rail is first sold, and the tunnel/bridge is destroyed after. This means destroying tunnels/ bridges now often makes you money, instead of costing. Similar, with road/tram tracks. Destroying a road+tram tunnel/bridge now costs the same amount of money as first removing the tram tracks and than destroying the road tunnel/bridge. Especially as tram tracks generate money when removing, this is a noticeable difference.