Fix #7656: destroying a tunnel/bridge now first removes the tracks for cost calculation #8508
Conversation
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
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.
If you first removed the tram tracks and destroyed the road bridge, you gained 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.
Description
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).
Limitations
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.