summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2011-01-21 14:43:38 +0000
committersmatz <smatz@openttd.org>2011-01-21 14:43:38 +0000
commit6dc24cf6431be66432d53f33d92ef5abbc80f88c (patch)
tree9f86818f99cf742d4ec14515b95baa1422c18962
parent656caf16dbf2010fc742b1dfabcf317f2ab19748 (diff)
downloadopenttd-6dc24cf6431be66432d53f33d92ef5abbc80f88c.tar.xz
(svn r21876) -Codechange: typedef SpecializedVehicleBase and GroundVehicleBase to reduce typing
-rw-r--r--src/aircraft.h2
-rw-r--r--src/effectvehicle_base.h2
-rw-r--r--src/ground_vehicle.hpp2
-rw-r--r--src/roadveh.h2
-rw-r--r--src/ship.h2
-rw-r--r--src/train.h2
-rw-r--r--src/vehicle_base.h4
7 files changed, 10 insertions, 6 deletions
diff --git a/src/aircraft.h b/src/aircraft.h
index ae48eb00e..4059d7ea5 100644
--- a/src/aircraft.h
+++ b/src/aircraft.h
@@ -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(); }
diff --git a/src/effectvehicle_base.h b/src/effectvehicle_base.h
index f38d100bc..8ad17adc8 100644
--- a/src/effectvehicle_base.h
+++ b/src/effectvehicle_base.h
@@ -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() {}
diff --git a/src/ground_vehicle.hpp b/src/ground_vehicle.hpp
index f616c39e0..0a17ea209 100644
--- a/src/ground_vehicle.hpp
+++ b/src/ground_vehicle.hpp
@@ -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.
*/
diff --git a/src/roadveh.h b/src/roadveh.h
index 92a5eab9e..c73575a13 100644
--- a/src/roadveh.h
+++ b/src/roadveh.h
@@ -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(); }
diff --git a/src/ship.h b/src/ship.h
index ca4cefa6d..7d47ae876 100644
--- a/src/ship.h
+++ b/src/ship.h
@@ -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(); }
diff --git a/src/train.h b/src/train.h
index f20bdd582..bfeffa554 100644
--- a/src/train.h
+++ b/src/train.h
@@ -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(); }
diff --git a/src/vehicle_base.h b/src/vehicle_base.h
index de592e798..ffbfb179f 100644
--- a/src/vehicle_base.h
+++ b/src/vehicle_base.h
@@ -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() {}