summaryrefslogtreecommitdiff
path: root/src/aircraft_cmd.cpp
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2009-01-22 21:33:08 +0000
committerglx <glx@openttd.org>2009-01-22 21:33:08 +0000
commit12c89708cb463660d9e39c738471b1c018096cf0 (patch)
tree593969317bbdfd30857464beb43cbc118db5897d /src/aircraft_cmd.cpp
parent4ce7be6490c571d41fc1e49ecc2c15edb302a736 (diff)
downloadopenttd-12c89708cb463660d9e39c738471b1c018096cf0.tar.xz
(svn r15210) -Fix: Vehicle::GetRunningCost() was wrong for ships and aircraft
Diffstat (limited to 'src/aircraft_cmd.cpp')
-rw-r--r--src/aircraft_cmd.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index f901306f5..2effe517a 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -629,6 +629,11 @@ static void CheckIfAircraftNeedsService(Vehicle *v)
}
}
+Money Aircraft::GetRunningCost() const
+{
+ return GetVehicleProperty(this, 0x0E, AircraftVehInfo(this->engine_type)->running_cost) * _price.aircraft_running;
+}
+
void Aircraft::OnNewDay()
{
if (!IsNormalAircraft(this)) return;
@@ -643,7 +648,7 @@ void Aircraft::OnNewDay()
if (this->running_ticks == 0) return;
- CommandCost cost(EXPENSES_AIRCRAFT_RUN, GetVehicleProperty(this, 0x0E, AircraftVehInfo(this->engine_type)->running_cost) * _price.aircraft_running * this->running_ticks / (DAYS_IN_YEAR * DAY_TICKS));
+ CommandCost cost(EXPENSES_AIRCRAFT_RUN, this->GetRunningCost() * this->running_ticks / (DAYS_IN_YEAR * DAY_TICKS));
this->profit_this_year -= cost.GetCost();
this->running_ticks = 0;