From 8c11d612e44c30e124881ca47e15eda9ef0c5491 Mon Sep 17 00:00:00 2001 From: smatz Date: Sat, 30 May 2009 20:13:12 +0000 Subject: (svn r16472) -Codechange: set vehicle type in SpecializedVehicle constructor instead of constructor of each vehicle type --- src/vehicle_base.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/vehicle_base.h') diff --git a/src/vehicle_base.h b/src/vehicle_base.h index e3659a009..581a55135 100644 --- a/src/vehicle_base.h +++ b/src/vehicle_base.h @@ -182,7 +182,7 @@ public: VehicleCache vcache; ///< Cache of often used calculated values /** Create a new vehicle */ - Vehicle(); + Vehicle(VehicleType type = VEH_INVALID); /** Destroy all stuff that (still) needs the virtual functions to work properly */ void PreDestructor(); @@ -502,6 +502,11 @@ template struct SpecializedVehicle : public Vehicle { static const VehicleType EXPECTED_TYPE = Type; ///< Specialized type + /** + * Set vehicle type correctly + */ + FORCEINLINE SpecializedVehicle() : Vehicle(Type) { } + /** * Get the first vehicle in the chain * @return first vehicle in the chain @@ -559,9 +564,6 @@ struct DisasterVehicle : public SpecializedVehicletype = VEH_DISASTER; } - /** We want to 'destruct' the right class. */ virtual ~DisasterVehicle() {} -- cgit v1.2.3-54-g00ecf