(svn r21876) -Codechange: typedef SpecializedVehicleBase and GroundVehicleBase to reduce typing

replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
smatz 14 years ago
parent 656caf16db
commit 6dc24cf643

@ -50,7 +50,7 @@ struct Aircraft : public SpecializedVehicle<Aircraft, VEH_AIRCRAFT> {
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(); }

@ -27,7 +27,7 @@ struct EffectVehicle : public SpecializedVehicle<EffectVehicle, VEH_EFFECT> {
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() {}

@ -75,6 +75,8 @@ struct GroundVehicle : public SpecializedVehicle<T, Type> {
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.
*/

@ -93,7 +93,7 @@ struct RoadVehicle : public GroundVehicle<RoadVehicle, VEH_ROAD> {
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(); }

@ -23,7 +23,7 @@ struct Ship: public SpecializedVehicle<Ship, VEH_SHIP> {
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(); }

@ -97,7 +97,7 @@ struct Train : public GroundVehicle<Train, VEH_TRAIN> {
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(); }

@ -644,6 +644,8 @@ template <class T, VehicleType Type>
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 @@ struct DisasterVehicle : public SpecializedVehicle<DisasterVehicle, VEH_DISASTER
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() {}

Loading…
Cancel
Save