mirror of https://github.com/OpenTTD/OpenTTD
(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.
parent
78a25e84e9
commit
2fc0cb3e76
|
@ -100,6 +100,8 @@ struct Aircraft : public SpecializedVehicle<Aircraft, VEH_AIRCRAFT> {
|
||||||
StationID targetairport;
|
StationID targetairport;
|
||||||
byte state;
|
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. */
|
/** We want to 'destruct' the right class. */
|
||||||
virtual ~Aircraft() { this->PreDestructor(); }
|
virtual ~Aircraft() { this->PreDestructor(); }
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,8 @@ struct EffectVehicle : public SpecializedVehicle<EffectVehicle, VEH_EFFECT> {
|
||||||
uint16 animation_state;
|
uint16 animation_state;
|
||||||
byte animation_substate;
|
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. */
|
/** We want to 'destruct' the right class. */
|
||||||
virtual ~EffectVehicle() {}
|
virtual ~EffectVehicle() {}
|
||||||
|
|
||||||
|
|
|
@ -133,6 +133,8 @@ struct RoadVehicle : public SpecializedVehicle<RoadVehicle, VEH_ROAD> {
|
||||||
RoadType roadtype;
|
RoadType roadtype;
|
||||||
RoadTypes compatible_roadtypes;
|
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. */
|
/** We want to 'destruct' the right class. */
|
||||||
virtual ~RoadVehicle() { this->PreDestructor(); }
|
virtual ~RoadVehicle() { this->PreDestructor(); }
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@ void GetShipSpriteSize(EngineID engine, uint &width, uint &height);
|
||||||
struct Ship: public SpecializedVehicle<Ship, VEH_SHIP> {
|
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! */
|
||||||
|
Ship() : SpecializedVehicle<Ship, VEH_SHIP>() {}
|
||||||
/** We want to 'destruct' the right class. */
|
/** We want to 'destruct' the right class. */
|
||||||
virtual ~Ship() { this->PreDestructor(); }
|
virtual ~Ship() { this->PreDestructor(); }
|
||||||
|
|
||||||
|
|
|
@ -314,6 +314,8 @@ struct Train : public SpecializedVehicle<Train, VEH_TRAIN> {
|
||||||
RailTypeByte railtype;
|
RailTypeByte railtype;
|
||||||
RailTypes compatible_railtypes;
|
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. */
|
/** We want to 'destruct' the right class. */
|
||||||
virtual ~Train() { this->PreDestructor(); }
|
virtual ~Train() { this->PreDestructor(); }
|
||||||
|
|
||||||
|
|
|
@ -584,6 +584,8 @@ struct DisasterVehicle : public SpecializedVehicle<DisasterVehicle, VEH_DISASTER
|
||||||
uint16 image_override;
|
uint16 image_override;
|
||||||
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! */
|
||||||
|
DisasterVehicle() : SpecializedVehicle<DisasterVehicle, VEH_DISASTER>() {}
|
||||||
/** We want to 'destruct' the right class. */
|
/** We want to 'destruct' the right class. */
|
||||||
virtual ~DisasterVehicle() {}
|
virtual ~DisasterVehicle() {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue