diff options
author | rubidium <rubidium@openttd.org> | 2010-02-27 16:27:28 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-02-27 16:27:28 +0000 |
commit | e338c26504680156df196c10279c05342a2b76f6 (patch) | |
tree | 188e2e55a61d4785d8831a39c11d873a05dbcd27 /src | |
parent | d9b2bf78c51cb2bfe04819e69e428b46f4b10eef (diff) | |
download | openttd-e338c26504680156df196c10279c05342a2b76f6.tar.xz |
(svn r19277) -Fix [FS#3646]: [NewGRF] Ensure prices can't be set to zero. Zero prices break a lot of the internal logic to determine whether something has been done.
Diffstat (limited to 'src')
-rw-r--r-- | src/economy.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/economy.cpp b/src/economy.cpp index 48a6b63c8..de563910a 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -668,6 +668,16 @@ void RecomputePrices() price >>= -shift; } + /* Make sure the price does not get reduced to zero. + * Zero breaks quite a few commands that use a zero + * cost to see whether something got changed or not + * and based on that cause an error. When the price + * is zero that fails even when things are done. */ + if (price == 0) { + price = Clamp(_price_base_specs[i].start_price, -1, 1); + /* No base price should be zero, but be sure. */ + assert(price != 0); + } /* Store value */ _price[i] = price; } |