summaryrefslogtreecommitdiff
path: root/src/ai
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/ai
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/ai')
-rw-r--r--src/ai/default/default.cpp4
-rw-r--r--src/ai/trolly/trolly.cpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp
index 438ec6621..1c83d4edf 100644
--- a/src/ai/default/default.cpp
+++ b/src/ai/default/default.cpp
@@ -112,8 +112,8 @@ static void AiStateVehLoop(Player *p)
/* not profitable? */
if (v->age >= 730 &&
- v->profit_last_year >> 8 < _price.station_value * 5 &&
- v->profit_this_year >> 8 < _price.station_value * 5) {
+ v->profit_last_year < _price.station_value * 5 * 256 &&
+ v->profit_this_year < _price.station_value * 5 * 256) {
_players_ai[p->index].state_counter = 0;
_players_ai[p->index].state = AIS_SELL_VEHICLE;
_players_ai[p->index].cur_veh = v;
diff --git a/src/ai/trolly/trolly.cpp b/src/ai/trolly/trolly.cpp
index 1a5a0fce4..e85fc36c4 100644
--- a/src/ai/trolly/trolly.cpp
+++ b/src/ai/trolly/trolly.cpp
@@ -1251,7 +1251,7 @@ static void AiNew_CheckVehicle(Player *p, Vehicle *v)
if (v->age > 360) {
// If both years together are not more than AI_MINIMUM_ROUTE_PROFIT,
// it is not worth the line I guess...
- if ((v->profit_last_year + v->profit_this_year) >> 8 < AI_MINIMUM_ROUTE_PROFIT ||
+ if (v->profit_last_year + v->profit_this_year < (Money)256 * AI_MINIMUM_ROUTE_PROFIT ||
(v->reliability * 100 >> 16) < 40) {
// There is a possibility that the route is fucked up...
if (v->cargo.DaysInTransit() > AI_VEHICLE_LOST_DAYS) {