summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Horta <MiguelHorta@users.noreply.github.com>2018-10-13 12:34:57 +0100
committerfrosch <github@elsenhans.name>2018-10-13 13:34:57 +0200
commit42b00c3b39c32dd063f9b3b88f76f9caa6935817 (patch)
tree9fa7ec2761708fa75e3a0a1ee7bb75684e5108bb
parente00908f5e900ac5314930b2775eb38f91a6c4abe (diff)
downloadopenttd-42b00c3b39c32dd063f9b3b88f76f9caa6935817.tar.xz
Fix #6938: Don't change company value to perform cost estimations (#6939)
These meddling kids dared to play with magic, but the ancients texts weren't ready for that. Refactors logic to estimate costs that dated to even before OpenTTD 0.1;
-rw-r--r--src/misc_gui.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index dd7541062..cb2e2d318 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -193,11 +193,8 @@ public:
StringID str = STR_LAND_AREA_INFORMATION_COST_TO_CLEAR_N_A;
Company *c = Company::GetIfValid(_local_company);
if (c != NULL) {
- Money old_money = c->money;
- c->money = INT64_MAX;
assert(_current_company == _local_company);
- CommandCost costclear = DoCommand(tile, 0, 0, DC_NONE, CMD_LANDSCAPE_CLEAR);
- c->money = old_money;
+ CommandCost costclear = DoCommand(tile, 0, 0, DC_QUERY_COST, CMD_LANDSCAPE_CLEAR);
if (costclear.Succeeded()) {
Money cost = costclear.GetCost();
if (cost < 0) {