Changeset - r12090:c20f83257241
[Not reviewed]
master
0 6 0
rubidium - 15 years ago 2009-06-02 19:12:28
rubidium@openttd.org
(svn r16505) -Fix [FS#2951] (r16472): since g++ 4.4 the implicit (default) constructor will zero the whole class. This caused all vehicle indices to be 0, which causes all kinds of trouble.
6 files changed with 12 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/aircraft.h
Show inline comments
 
@@ -97,12 +97,14 @@ struct Aircraft : public SpecializedVehi
 
	uint16 crashed_counter;
 
	byte pos;
 
	byte previous_pos;
 
	StationID targetairport;
 
	byte state;
 

	
 
	/** We don't want GCC to zero our struct! It already is zeroed and has an index! */
 
	Aircraft() : SpecializedVehicle<Aircraft, VEH_AIRCRAFT>() {}
 
	/** We want to 'destruct' the right class. */
 
	virtual ~Aircraft() { this->PreDestructor(); }
 

	
 
	const char *GetTypeString() const { return "aircraft"; }
 
	void MarkDirty();
 
	void UpdateDeltaXY(Direction direction);
src/effectvehicle_base.h
Show inline comments
 
@@ -16,12 +16,14 @@
 
 *  - bubbles (industry)
 
 */
 
struct EffectVehicle : public SpecializedVehicle<EffectVehicle, VEH_EFFECT> {
 
	uint16 animation_state;
 
	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>() {}
 
	/** We want to 'destruct' the right class. */
 
	virtual ~EffectVehicle() {}
 

	
 
	const char *GetTypeString() const { return "special vehicle"; }
 
	void UpdateDeltaXY(Direction direction);
 
	bool Tick();
src/roadveh.h
Show inline comments
 
@@ -130,12 +130,14 @@ struct RoadVehicle : public SpecializedV
 
	struct RoadStop *slot;
 
	byte slot_age;
 

	
 
	RoadType roadtype;
 
	RoadTypes compatible_roadtypes;
 

	
 
	/** We don't want GCC to zero our struct! It already is zeroed and has an index! */
 
	RoadVehicle() : SpecializedVehicle<RoadVehicle, VEH_ROAD>() {}
 
	/** We want to 'destruct' the right class. */
 
	virtual ~RoadVehicle() { this->PreDestructor(); }
 

	
 
	const char *GetTypeString() const { return "road vehicle"; }
 
	void MarkDirty();
 
	void UpdateDeltaXY(Direction direction);
src/ship.h
Show inline comments
 
@@ -17,12 +17,14 @@ void GetShipSpriteSize(EngineID engine, 
 
/**
 
 * All ships have this type.
 
 */
 
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>() {}
 
	/** We want to 'destruct' the right class. */
 
	virtual ~Ship() { this->PreDestructor(); }
 

	
 
	const char *GetTypeString() const { return "ship"; }
 
	void MarkDirty();
 
	void UpdateDeltaXY(Direction direction);
src/train.h
Show inline comments
 
@@ -311,12 +311,14 @@ struct Train : public SpecializedVehicle
 
	uint16 flags;
 
	TrackBitsByte track;
 
	byte force_proceed;
 
	RailTypeByte railtype;
 
	RailTypes compatible_railtypes;
 

	
 
	/** We don't want GCC to zero our struct! It already is zeroed and has an index! */
 
	Train() : SpecializedVehicle<Train, VEH_TRAIN>() {}
 
	/** We want to 'destruct' the right class. */
 
	virtual ~Train() { this->PreDestructor(); }
 

	
 
	const char *GetTypeString() const { return "train"; }
 
	void MarkDirty();
 
	void UpdateDeltaXY(Direction direction);
src/vehicle_base.h
Show inline comments
 
@@ -581,12 +581,14 @@ struct SpecializedVehicle : public Vehic
 
 * Disasters, like submarines, skyrangers and their shadows, belong to this class.
 
 */
 
struct DisasterVehicle : public SpecializedVehicle<DisasterVehicle, VEH_DISASTER> {
 
	uint16 image_override;
 
	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>() {}
 
	/** We want to 'destruct' the right class. */
 
	virtual ~DisasterVehicle() {}
 

	
 
	const char *GetTypeString() const { return "disaster vehicle"; }
 
	void UpdateDeltaXY(Direction direction);
 
	bool Tick();
0 comments (0 inline, 0 general)