diff options
author | rubidium <rubidium@openttd.org> | 2009-06-02 19:12:28 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-06-02 19:12:28 +0000 |
commit | 2fc0cb3e76ec36826056c661555b925b3ce43fe3 (patch) | |
tree | 3abde6b4e39242c5d4c8f255f5f4b8d4403b0b47 /src | |
parent | 78a25e84e9d7935404f13c041e8a93c4e9b6ff47 (diff) | |
download | openttd-2fc0cb3e76ec36826056c661555b925b3ce43fe3.tar.xz |
(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.
Diffstat (limited to 'src')
-rw-r--r-- | src/aircraft.h | 2 | ||||
-rw-r--r-- | src/effectvehicle_base.h | 2 | ||||
-rw-r--r-- | src/roadveh.h | 2 | ||||
-rw-r--r-- | src/ship.h | 2 | ||||
-rw-r--r-- | src/train.h | 2 | ||||
-rw-r--r-- | src/vehicle_base.h | 2 |
6 files changed, 12 insertions, 0 deletions
diff --git a/src/aircraft.h b/src/aircraft.h index 1977b8249..b782aae50 100644 --- a/src/aircraft.h +++ b/src/aircraft.h @@ -100,6 +100,8 @@ struct Aircraft : public SpecializedVehicle<Aircraft, VEH_AIRCRAFT> { 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(); } diff --git a/src/effectvehicle_base.h b/src/effectvehicle_base.h index 15c100b06..1f99661eb 100644 --- a/src/effectvehicle_base.h +++ b/src/effectvehicle_base.h @@ -19,6 +19,8 @@ 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() {} diff --git a/src/roadveh.h b/src/roadveh.h index 7a248b8e7..687cbd313 100644 --- a/src/roadveh.h +++ b/src/roadveh.h @@ -133,6 +133,8 @@ struct RoadVehicle : public SpecializedVehicle<RoadVehicle, VEH_ROAD> { 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(); } diff --git a/src/ship.h b/src/ship.h index 7e1b2ec6d..01e337eea 100644 --- a/src/ship.h +++ b/src/ship.h @@ -20,6 +20,8 @@ void GetShipSpriteSize(EngineID engine, uint &width, uint &height); 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(); } diff --git a/src/train.h b/src/train.h index bcf005472..b52b52396 100644 --- a/src/train.h +++ b/src/train.h @@ -314,6 +314,8 @@ struct Train : public SpecializedVehicle<Train, VEH_TRAIN> { 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(); } diff --git a/src/vehicle_base.h b/src/vehicle_base.h index b4a43e2ae..b6bcbb4b6 100644 --- a/src/vehicle_base.h +++ b/src/vehicle_base.h @@ -584,6 +584,8 @@ 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() {} |