summaryrefslogtreecommitdiff
path: root/src/economy.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-02-20 17:06:58 +0000
committersmatz <smatz@openttd.org>2008-02-20 17:06:58 +0000
commita190606f2e7567898b71c663989cd47bed7eab91 (patch)
treea0fa27513f3db7b29c7cab369a56629ef6c457ce /src/economy.cpp
parente95a85315ce8aeb40b1dd28cf6f5607032be9a7b (diff)
downloadopenttd-a190606f2e7567898b71c663989cd47bed7eab91.tar.xz
(svn r12197) -Fix [FS#1788](r12134): show correct last year profit when the train had negative income
-Codechange: use GetDisplayProfitThisYear() to convert vehicle profit to readable form
Diffstat (limited to 'src/economy.cpp')
-rw-r--r--src/economy.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/economy.cpp b/src/economy.cpp
index dc055dd5e..401948dba 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -163,14 +163,16 @@ int UpdateCompanyRatingAndValue(Player *p, bool update)
num++;
if (v->age > 730) {
/* Find the vehicle with the lowest amount of profit */
- if (min_profit_first || min_profit > v->profit_last_year >> 8) {
- min_profit = v->profit_last_year >> 8;
+ if (min_profit_first || min_profit > v->profit_last_year) {
+ min_profit = v->profit_last_year;
min_profit_first = false;
}
}
}
}
+ min_profit >>= 8; // remove the fract part
+
_score_part[owner][SCORE_VEHICLES] = num;
/* Don't allow negative min_profit to show */
if (min_profit > 0)