From ec137f60edec89392a19fc078bf47d2ee291dc1c Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 1 Jul 2007 19:24:54 +0000 Subject: (svn r10409) -Codechange: replace (Aircraft|RoadVeh|Ship|Train)_Tick with a Tick method in the Vehicle class. --- src/vehicle.cpp | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) (limited to 'src/vehicle.cpp') 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) -- cgit v1.2.3-54-g00ecf