summaryrefslogtreecommitdiff
path: root/src/vehicle.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-07-01 19:24:54 +0000
committerrubidium <rubidium@openttd.org>2007-07-01 19:24:54 +0000
commitec137f60edec89392a19fc078bf47d2ee291dc1c (patch)
treefb5afab9eaa026a83642f983053acfabe1d9f492 /src/vehicle.cpp
parentc0e341ee05792cc692d19a8ed80aeebc05d3af0e (diff)
downloadopenttd-ec137f60edec89392a19fc078bf47d2ee291dc1c.tar.xz
(svn r10409) -Codechange: replace (Aircraft|RoadVeh|Ship|Train)_Tick with a Tick method in the Vehicle class.
Diffstat (limited to 'src/vehicle.cpp')
-rw-r--r--src/vehicle.cpp24
1 files changed, 3 insertions, 21 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 8b17afdb9..dea86bc01 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -726,14 +726,6 @@ void DeleteVehicleChain(Vehicle *v)
} while (v != NULL);
}
-
-void Aircraft_Tick(Vehicle *v);
-void RoadVeh_Tick(Vehicle *v);
-void Ship_Tick(Vehicle *v);
-void Train_Tick(Vehicle *v);
-static void EffectVehicle_Tick(Vehicle *v);
-void DisasterVehicle_Tick(Vehicle *v);
-
/** head of the linked list to tell what vehicles that visited a depot in a tick */
static Vehicle* _first_veh_in_depot_list;
@@ -763,16 +755,6 @@ void VehicleEnteredDepotThisTick(Vehicle *v)
}
}
-typedef void VehicleTickProc(Vehicle*);
-static VehicleTickProc* _vehicle_tick_procs[] = {
- Train_Tick,
- RoadVeh_Tick,
- Ship_Tick,
- Aircraft_Tick,
- EffectVehicle_Tick,
- DisasterVehicle_Tick,
-};
-
void CallVehicleTicks()
{
_first_veh_in_depot_list = NULL; // now we are sure it's initialized at the start of each tick
@@ -782,7 +764,7 @@ void CallVehicleTicks()
Vehicle *v;
FOR_ALL_VEHICLES(v) {
- _vehicle_tick_procs[v->type](v);
+ v->Tick();
switch (v->type) {
default: break;
@@ -1532,9 +1514,9 @@ Vehicle *CreateEffectVehicleRel(const Vehicle *v, int x, int y, int z, EffectVeh
return CreateEffectVehicle(v->x_pos + x, v->y_pos + y, v->z_pos + z, type);
}
-static void EffectVehicle_Tick(Vehicle *v)
+void SpecialVehicle::Tick()
{
- _effect_tick_procs[v->subtype](v);
+ _effect_tick_procs[this->subtype](this);
}
Vehicle *CheckClickOnVehicle(const ViewPort *vp, int x, int y)