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

This commit is contained in:
smatz 2011-01-21 14:43:38 +00:00
parent 656caf16db
commit 6dc24cf643
7 changed files with 10 additions and 6 deletions

View File

@ -50,7 +50,7 @@ struct Aircraft : public SpecializedVehicle<Aircraft, VEH_AIRCRAFT> {
byte turn_counter; ///< Ticks between each turn to prevent > 45 degree turns. 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! */ /** 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. */ /** We want to 'destruct' the right class. */
virtual ~Aircraft() { this->PreDestructor(); } virtual ~Aircraft() { this->PreDestructor(); }

View File

@ -27,7 +27,7 @@ struct EffectVehicle : public SpecializedVehicle<EffectVehicle, VEH_EFFECT> {
byte animation_substate; byte animation_substate;
/** We don't want GCC to zero our struct! It already is zeroed and has an index! */ /** 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. */ /** We want to 'destruct' the right class. */
virtual ~EffectVehicle() {} virtual ~EffectVehicle() {}

View File

@ -75,6 +75,8 @@ struct GroundVehicle : public SpecializedVehicle<T, Type> {
GroundVehicleCache gcache; ///< Cache of often calculated values. GroundVehicleCache gcache; ///< Cache of often calculated values.
uint16 gv_flags; ///< @see GroundVehicleFlags. uint16 gv_flags; ///< @see GroundVehicleFlags.
typedef GroundVehicle<T, Type> GroundVehicleBase; ///< Our type
/** /**
* The constructor at SpecializedVehicle must be called. * The constructor at SpecializedVehicle must be called.
*/ */

View File

@ -93,7 +93,7 @@ struct RoadVehicle : public GroundVehicle<RoadVehicle, VEH_ROAD> {
RoadTypes compatible_roadtypes; RoadTypes compatible_roadtypes;
/** We don't want GCC to zero our struct! It already is zeroed and has an index! */ /** 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. */ /** We want to 'destruct' the right class. */
virtual ~RoadVehicle() { this->PreDestructor(); } virtual ~RoadVehicle() { this->PreDestructor(); }

View File

@ -23,7 +23,7 @@ struct Ship: public SpecializedVehicle<Ship, VEH_SHIP> {
TrackBitsByte state; TrackBitsByte state;
/** We don't want GCC to zero our struct! It already is zeroed and has an index! */ /** 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. */ /** We want to 'destruct' the right class. */
virtual ~Ship() { this->PreDestructor(); } virtual ~Ship() { this->PreDestructor(); }

View File

@ -97,7 +97,7 @@ struct Train : public GroundVehicle<Train, VEH_TRAIN> {
uint16 wait_counter; uint16 wait_counter;
/** We don't want GCC to zero our struct! It already is zeroed and has an index! */ /** 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. */ /** We want to 'destruct' the right class. */
virtual ~Train() { this->PreDestructor(); } virtual ~Train() { this->PreDestructor(); }

View File

@ -644,6 +644,8 @@ template <class T, VehicleType Type>
struct SpecializedVehicle : public Vehicle { struct SpecializedVehicle : public Vehicle {
static const VehicleType EXPECTED_TYPE = Type; ///< Specialized type static const VehicleType EXPECTED_TYPE = Type; ///< Specialized type
typedef SpecializedVehicle<T, Type> SpecializedVehicleBase; ///< Our type
/** /**
* Set vehicle type correctly * Set vehicle type correctly
*/ */
@ -758,7 +760,7 @@ struct DisasterVehicle : public SpecializedVehicle<DisasterVehicle, VEH_DISASTER
VehicleID big_ufo_destroyer_target; VehicleID big_ufo_destroyer_target;
/** We don't want GCC to zero our struct! It already is zeroed and has an index! */ /** 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. */ /** We want to 'destruct' the right class. */
virtual ~DisasterVehicle() {} virtual ~DisasterVehicle() {}