Mercurial > hg > openttd
changeset 12095:330c67eebb69 draft
(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.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Tue, 02 Jun 2009 19:12:28 +0000 |
parents | cbc3f4302215 |
children | f8d1c7749ab0 |
files | src/aircraft.h src/effectvehicle_base.h src/roadveh.h src/ship.h src/train.h src/vehicle_base.h |
diffstat | 6 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/aircraft.h +++ b/src/aircraft.h @@ -100,6 +100,8 @@ 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(); }
--- a/src/effectvehicle_base.h +++ b/src/effectvehicle_base.h @@ -19,6 +19,8 @@ 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() {}
--- a/src/roadveh.h +++ b/src/roadveh.h @@ -133,6 +133,8 @@ 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(); }
--- a/src/ship.h +++ b/src/ship.h @@ -20,6 +20,8 @@ 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(); }
--- a/src/train.h +++ b/src/train.h @@ -314,6 +314,8 @@ 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(); }
--- a/src/vehicle_base.h +++ b/src/vehicle_base.h @@ -584,6 +584,8 @@ 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() {}