Mercurial > hg > openttd
changeset 17138:562c2d5b012b draft
(svn r21876) -Codechange: typedef SpecializedVehicleBase and GroundVehicleBase to reduce typing
author | smatz <smatz@openttd.org> |
---|---|
date | Fri, 21 Jan 2011 14:43:38 +0000 |
parents | 0e25103841ef |
children | 1fd716ceadc8 |
files | src/aircraft.h src/effectvehicle_base.h src/ground_vehicle.hpp src/roadveh.h src/ship.h src/train.h src/vehicle_base.h |
diffstat | 7 files changed, 10 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/aircraft.h +++ b/src/aircraft.h @@ -50,7 +50,7 @@ byte turn_counter; ///< Ticks between each turn to prevent > 45 degree turns. /** We don't want GCC to zero our struct! It already is zeroed and has an index! */ - Aircraft() : SpecializedVehicle<Aircraft, VEH_AIRCRAFT>() {} + Aircraft() : SpecializedVehicleBase() {} /** We want to 'destruct' the right class. */ virtual ~Aircraft() { this->PreDestructor(); }
--- a/src/effectvehicle_base.h +++ b/src/effectvehicle_base.h @@ -27,7 +27,7 @@ byte animation_substate; /** We don't want GCC to zero our struct! It already is zeroed and has an index! */ - EffectVehicle() : SpecializedVehicle<EffectVehicle, VEH_EFFECT>() {} + EffectVehicle() : SpecializedVehicleBase() {} /** We want to 'destruct' the right class. */ virtual ~EffectVehicle() {}
--- a/src/ground_vehicle.hpp +++ b/src/ground_vehicle.hpp @@ -75,6 +75,8 @@ GroundVehicleCache gcache; ///< Cache of often calculated values. uint16 gv_flags; ///< @see GroundVehicleFlags. + typedef GroundVehicle<T, Type> GroundVehicleBase; ///< Our type + /** * The constructor at SpecializedVehicle must be called. */
--- a/src/roadveh.h +++ b/src/roadveh.h @@ -93,7 +93,7 @@ RoadTypes compatible_roadtypes; /** We don't want GCC to zero our struct! It already is zeroed and has an index! */ - RoadVehicle() : GroundVehicle<RoadVehicle, VEH_ROAD>() {} + RoadVehicle() : GroundVehicleBase() {} /** We want to 'destruct' the right class. */ virtual ~RoadVehicle() { this->PreDestructor(); }
--- a/src/ship.h +++ b/src/ship.h @@ -23,7 +23,7 @@ TrackBitsByte state; /** We don't want GCC to zero our struct! It already is zeroed and has an index! */ - Ship() : SpecializedVehicle<Ship, VEH_SHIP>() {} + Ship() : SpecializedVehicleBase() {} /** We want to 'destruct' the right class. */ virtual ~Ship() { this->PreDestructor(); }
--- a/src/train.h +++ b/src/train.h @@ -97,7 +97,7 @@ uint16 wait_counter; /** We don't want GCC to zero our struct! It already is zeroed and has an index! */ - Train() : GroundVehicle<Train, VEH_TRAIN>() {} + Train() : GroundVehicleBase() {} /** We want to 'destruct' the right class. */ virtual ~Train() { this->PreDestructor(); }
--- a/src/vehicle_base.h +++ b/src/vehicle_base.h @@ -644,6 +644,8 @@ struct SpecializedVehicle : public Vehicle { static const VehicleType EXPECTED_TYPE = Type; ///< Specialized type + typedef SpecializedVehicle<T, Type> SpecializedVehicleBase; ///< Our type + /** * Set vehicle type correctly */ @@ -758,7 +760,7 @@ VehicleID big_ufo_destroyer_target; /** We don't want GCC to zero our struct! It already is zeroed and has an index! */ - DisasterVehicle() : SpecializedVehicle<DisasterVehicle, VEH_DISASTER>() {} + DisasterVehicle() : SpecializedVehicleBase() {} /** We want to 'destruct' the right class. */ virtual ~DisasterVehicle() {}