summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-08-06 12:44:10 +0000
committersmatz <smatz@openttd.org>2009-08-06 12:44:10 +0000
commitadcc5338f3bb8e10e0af57009b3feeb48e798771 (patch)
tree71e5bf5c6220fc9004b34d6e5aca4b873baa097f /src
parent9c25f1bdb7c186207c3c07542be976bc40a91e40 (diff)
downloadopenttd-adcc5338f3bb8e10e0af57009b3feeb48e798771.tar.xz
(svn r17085) -Codechange: unify the place where vehicle's cargo ages
Diffstat (limited to 'src')
-rw-r--r--src/aircraft_cmd.cpp12
-rw-r--r--src/roadveh_cmd.cpp8
-rw-r--r--src/ship_cmd.cpp7
-rw-r--r--src/train_cmd.cpp2
-rw-r--r--src/vehicle.cpp2
5 files changed, 2 insertions, 29 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index f338d1631..87f462fd0 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -636,16 +636,6 @@ void Aircraft::OnNewDay()
InvalidateWindowClasses(WC_AIRCRAFT_LIST);
}
-static void AgeAircraftCargo(Aircraft *v)
-{
- if (_age_cargo_skip_counter != 0) return;
-
- do {
- v->cargo.AgeCargo();
- v = v->Next();
- } while (v != NULL);
-}
-
static void HelicopterTickHandler(Aircraft *v)
{
Aircraft *u = v->Next()->Next();
@@ -2034,8 +2024,6 @@ bool Aircraft::Tick()
if (this->subtype == AIR_HELICOPTER) HelicopterTickHandler(this);
- AgeAircraftCargo(this);
-
this->current_order_time++;
for (uint i = 0; i != 2; i++) {
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index 958ead338..782e10100 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -1826,16 +1826,8 @@ static bool RoadVehController(RoadVehicle *v)
return true;
}
-static void AgeRoadVehCargo(RoadVehicle *v)
-{
- if (_age_cargo_skip_counter != 0) return;
- v->cargo.AgeCargo();
-}
-
bool RoadVehicle::Tick()
{
- AgeRoadVehCargo(this);
-
if (this->IsRoadVehFront()) {
if (!(this->vehstatus & VS_STOPPED)) this->running_ticks++;
return RoadVehController(this);
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index 3a20d9197..9385259b6 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -719,17 +719,10 @@ reverse_direction:
goto getout;
}
-static void AgeShipCargo(Vehicle *v)
-{
- if (_age_cargo_skip_counter != 0) return;
- v->cargo.AgeCargo();
-}
-
bool Ship::Tick()
{
if (!(this->vehstatus & VS_STOPPED)) this->running_ticks++;
- AgeShipCargo(this);
ShipController(this);
return true;
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index ffb2dd7d1..4c4f142d6 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -4485,8 +4485,6 @@ Money Train::GetRunningCost() const
bool Train::Tick()
{
- if (_age_cargo_skip_counter == 0) this->cargo.AgeCargo();
-
this->tick_counter++;
if (this->IsFrontEngine()) {
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 886678e3a..11f75d17e 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -585,6 +585,8 @@ void CallVehicleTicks()
case VEH_ROAD:
case VEH_AIRCRAFT:
case VEH_SHIP:
+ if (_age_cargo_skip_counter == 0) v->cargo.AgeCargo();
+
if (v->type == VEH_TRAIN && Train::From(v)->IsWagon()) continue;
if (v->type == VEH_AIRCRAFT && v->subtype != AIR_HELICOPTER) continue;
if (v->type == VEH_ROAD && !RoadVehicle::From(v)->IsRoadVehFront()) continue;