Changeset - r12060:f99d2e8d78fc
[Not reviewed]
master
0 7 0
smatz - 15 years ago 2009-05-30 20:13:12
smatz@openttd.org
(svn r16472) -Codechange: set vehicle type in SpecializedVehicle constructor instead of constructor of each vehicle type
7 files changed with 8 insertions and 21 deletions:
0 comments (0 inline, 0 general)
src/aircraft.h
Show inline comments
 
@@ -100,9 +100,6 @@ struct Aircraft : public SpecializedVehi
 
	StationID targetairport;
 
	byte state;
 

	
 
	/** Initializes the Vehicle to an aircraft */
 
	Aircraft() { this->type = VEH_AIRCRAFT; }
 

	
 
	/** We want to 'destruct' the right class. */
 
	virtual ~Aircraft() { this->PreDestructor(); }
 

	
src/effectvehicle_base.h
Show inline comments
 
@@ -19,9 +19,6 @@ struct EffectVehicle : public Specialize
 
	uint16 animation_state;
 
	byte animation_substate;
 

	
 
	/** Initializes the Vehicle to a special vehicle */
 
	EffectVehicle() { this->type = VEH_EFFECT; }
 

	
 
	/** We want to 'destruct' the right class. */
 
	virtual ~EffectVehicle() {}
 

	
src/roadveh.h
Show inline comments
 
@@ -133,9 +133,6 @@ struct RoadVehicle : public SpecializedV
 
	RoadType roadtype;
 
	RoadTypes compatible_roadtypes;
 

	
 
	/** Initializes the Vehicle to a road vehicle */
 
	RoadVehicle() { this->type = VEH_ROAD; }
 

	
 
	/** We want to 'destruct' the right class. */
 
	virtual ~RoadVehicle() { this->PreDestructor(); }
 

	
src/ship.h
Show inline comments
 
@@ -20,9 +20,6 @@ void GetShipSpriteSize(EngineID engine, 
 
struct Ship: public SpecializedVehicle<Ship, VEH_SHIP> {
 
	TrackBitsByte state;
 

	
 
	/** Initializes the Vehicle to a ship */
 
	Ship() { this->type = VEH_SHIP; }
 

	
 
	/** We want to 'destruct' the right class. */
 
	virtual ~Ship() { this->PreDestructor(); }
 

	
src/train.h
Show inline comments
 
@@ -310,9 +310,6 @@ struct Train : public SpecializedVehicle
 
	RailTypeByte railtype;
 
	RailTypes compatible_railtypes;
 

	
 
	/** Initializes the Vehicle to a train */
 
	Train() { this->type = VEH_TRAIN; }
 

	
 
	/** We want to 'destruct' the right class. */
 
	virtual ~Train() { this->PreDestructor(); }
 

	
src/vehicle.cpp
Show inline comments
 
@@ -188,9 +188,9 @@ bool HasVehicleOnTunnelBridge(TileIndex 
 
}
 

	
 

	
 
Vehicle::Vehicle()
 
Vehicle::Vehicle(VehicleType type)
 
{
 
	this->type               = VEH_INVALID;
 
	this->type               = type;
 
	this->coord.left         = INVALID_COORD;
 
	this->group_id           = DEFAULT_GROUP;
 
	this->fill_percent_te_id = INVALID_TE_ID;
src/vehicle_base.h
Show inline comments
 
@@ -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();
 
@@ -503,6 +503,11 @@ struct SpecializedVehicle : public Vehic
 
	static const VehicleType EXPECTED_TYPE = Type; ///< Specialized type
 

	
 
	/**
 
	 * Set vehicle type correctly
 
	 */
 
	FORCEINLINE SpecializedVehicle<T, Type>() : Vehicle(Type) { }
 

	
 
	/**
 
	 * Get the first vehicle in the chain
 
	 * @return first vehicle in the chain
 
	 */
 
@@ -559,9 +564,6 @@ struct DisasterVehicle : public Speciali
 
	uint16 image_override;
 
	VehicleID big_ufo_destroyer_target;
 

	
 
	/** Initializes the Vehicle to a disaster vehicle */
 
	DisasterVehicle() { this->type = VEH_DISASTER; }
 

	
 
	/** We want to 'destruct' the right class. */
 
	virtual ~DisasterVehicle() {}
 

	
0 comments (0 inline, 0 general)