From a0ddc43e92c33436bccc0d16ae935237e02a357e Mon Sep 17 00:00:00 2001 From: smatz Date: Wed, 13 Feb 2008 19:24:40 +0000 Subject: (svn r12134) -Change: count the number of ticks a vehicle was running this day to calculate running cost -Fix [FS#1739]: vehicle profit is now counted with 8bit fract, so it is now shown properly in the vehicle details window --- src/ai/default/default.cpp | 4 ++-- src/ai/trolly/trolly.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/ai') diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp index 7bddaa2cb..95fab9619 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 < _price.station_value * 5 && - v->profit_this_year < _price.station_value * 5) { + v->profit_last_year >> 8 < _price.station_value * 5 && + v->profit_this_year >> 8 < _price.station_value * 5) { _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 01792f527..8f62b7e95 100644 --- a/src/ai/trolly/trolly.cpp +++ b/src/ai/trolly/trolly.cpp @@ -1252,7 +1252,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 < AI_MINIMUM_ROUTE_PROFIT || + if ((v->profit_last_year + v->profit_this_year) >> 8 < 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) { -- cgit v1.2.3-70-g09d2