Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Incorrect value for "Cost to Clear" for Company Headquarters in tile inspector #6938
I notice that when I use the tile inspector on my company headquarters (if I have one), then the "Cost to Clear" value is incorrect. Specifically, it shows up as £92 quadrillion instead of (for a company value of £1 million) £10,000. If I were to a actually demolish/relocate the headquarters, it would deduct £10,000 (for a company value of £1 million) from my bank balance.
What should have happened was that the "Cost to Clear" shows up as 1% of my company value for my headquarters, or "N/A" for another company's headquarters. What actually happened was it still shows "N/A" for another company's headquarters (expected), but it always shows £92 quadrillion as the "Cost to Clear" for my headquarters, regardless of my company's value.
To reproduce this unexpected behaviour, do the following:
A possible cause of this bug is that the Land Area Information tool gives the "Cost to Clear" as if your company value is always £9 quintillion (64-bit signed max) instead of (for example) £1 million. If that's the case, possible solutions include:
I'm leaning towards the following: If the magic bulldozer cheat is enabled, use plan B. Otherwise, use plan A.
It seems the issue is here:
I guess the logic is to raise temporarily the company value to its maximum, so no operation can fail. Anyway 1% of INT64_MAX are the 92,233,720,368,546,758 here in question.
I'm not really seasoned in the openttd code, but why can't
Summary of IRC:
This bug only appears when magic bulldozer is enabled. Otherwise, the HQ is unmovable and doesn't have a removal cost associated with it
Using git blame on misc_gui.cpp, you can see that