summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-08-06 12:33:13 +0000
committersmatz <smatz@openttd.org>2009-08-06 12:33:13 +0000
commit9c25f1bdb7c186207c3c07542be976bc40a91e40 (patch)
tree3a372b5b7bd4c4aa6873546b2dab5b6eb7feee7f
parent7fcebf09971a00010237cd3dccc54572449356b8 (diff)
downloadopenttd-9c25f1bdb7c186207c3c07542be976bc40a91e40.tar.xz
(svn r17084) -Codechange: _age_cargo_skip_counter is common to all vehicle types
-rw-r--r--src/landscape.cpp2
-rw-r--r--src/misc.cpp1
-rw-r--r--src/train_cmd.cpp11
-rw-r--r--src/variables.h3
-rw-r--r--src/vehicle.cpp5
-rw-r--r--src/vehicle_func.h2
6 files changed, 6 insertions, 18 deletions
diff --git a/src/landscape.cpp b/src/landscape.cpp
index bf1d4414e..e5ff3257f 100644
--- a/src/landscape.cpp
+++ b/src/landscape.cpp
@@ -928,7 +928,6 @@ void OnTick_Station();
void OnTick_Industry();
void OnTick_Companies();
-void OnTick_Train();
void CallLandscapeTick()
{
@@ -938,5 +937,4 @@ void CallLandscapeTick()
OnTick_Industry();
OnTick_Companies();
- OnTick_Train();
}
diff --git a/src/misc.cpp b/src/misc.cpp
index 839ee0b5f..24bad8255 100644
--- a/src/misc.cpp
+++ b/src/misc.cpp
@@ -99,7 +99,6 @@ void InitializeGame(uint size_x, uint size_y, bool reset_date)
InitializeIndustries();
InitializeBuildingCounts();
- InitializeTrains();
InitializeNPF();
InitializeCompanies();
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 59850b0c3..ffb2dd7d1 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -2292,12 +2292,6 @@ CommandCost CmdSendTrainToDepot(TileIndex tile, DoCommandFlag flags, uint32 p1,
return v->SendToDepot(flags, (DepotCommand)(p2 & DEPOT_COMMAND_MASK));
}
-
-void OnTick_Train()
-{
- _age_cargo_skip_counter = (_age_cargo_skip_counter == 0) ? 184 : (_age_cargo_skip_counter - 1);
-}
-
static const int8 _vehicle_smoke_pos[8] = {
1, 1, 1, 0, -1, -1, -1, 0
};
@@ -4602,8 +4596,3 @@ Trackdir Train::GetVehicleTrackdir() const
return TrackDirectionToTrackdir(FindFirstTrack(this->track), this->direction);
}
-
-void InitializeTrains()
-{
- _age_cargo_skip_counter = 1;
-}
diff --git a/src/variables.h b/src/variables.h
index 6a4c9f527..996ac4ecb 100644
--- a/src/variables.h
+++ b/src/variables.h
@@ -12,9 +12,6 @@
/* Amount of game ticks */
VARDEF uint16 _tick_counter;
-/* Skip aging of cargo? */
-VARDEF byte _age_cargo_skip_counter;
-
/* Also save scrollpos_x, scrollpos_y and zoom */
VARDEF uint16 _disaster_delay;
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 794b36eb4..886678e3a 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -49,6 +49,7 @@ VehicleID _vehicle_id_ctr_day;
const Vehicle *_place_clicked_vehicle;
VehicleID _new_vehicle_id;
uint16 _returned_refit_capacity;
+byte _age_cargo_skip_counter; ///< Skip aging of cargo?
/* Initialize the vehicle-pool */
@@ -439,6 +440,8 @@ void InitializeVehicles()
_vehicle_pool.CleanPool();
_cargo_payment_pool.CleanPool();
+ _age_cargo_skip_counter = 1;
+
_vehicles_to_autoreplace.Reset();
ResetVehiclePosHash();
}
@@ -560,6 +563,8 @@ void CallVehicleTicks()
{
_vehicles_to_autoreplace.Clear();
+ _age_cargo_skip_counter = (_age_cargo_skip_counter == 0) ? 184 : (_age_cargo_skip_counter - 1);
+
Station *st;
FOR_ALL_STATIONS(st) LoadUnloadStation(st);
diff --git a/src/vehicle_func.h b/src/vehicle_func.h
index 061b4ddd8..92f946e15 100644
--- a/src/vehicle_func.h
+++ b/src/vehicle_func.h
@@ -31,7 +31,6 @@ bool HasVehicleOnPosXY(int x, int y, void *data, VehicleFromPosProc *proc);
void CallVehicleTicks();
uint8 CalcPercentVehicleFilled(const Vehicle *v, StringID *colour);
-void InitializeTrains();
byte VehicleRandomBits();
void ResetVehiclePosHash();
void ResetVehicleColourMap();
@@ -160,6 +159,7 @@ extern VehicleID _vehicle_id_ctr_day;
extern const Vehicle *_place_clicked_vehicle;
extern VehicleID _new_vehicle_id;
extern uint16 _returned_refit_capacity;
+extern byte _age_cargo_skip_counter;
bool CanVehicleUseStation(EngineID engine_type, const struct Station *st);
bool CanVehicleUseStation(const Vehicle *v, const struct Station *st);