diff options
author | rubidium <rubidium@openttd.org> | 2007-07-01 19:24:54 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-07-01 19:24:54 +0000 |
commit | 90f85c957ad8e8d2dfd23535701b3079fc2d2718 (patch) | |
tree | fb5afab9eaa026a83642f983053acfabe1d9f492 /src/vehicle.cpp | |
parent | 83a880c882992efb1b949b26ac881abc3825964f (diff) | |
download | openttd-90f85c957ad8e8d2dfd23535701b3079fc2d2718.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.cpp | 24 |
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) |