Add game event flag for disaster vehicles

This commit is contained in:
Jonathan G Rennison
2019-05-20 00:55:57 +01:00
parent e001f4e8c1
commit e2251999ce
4 changed files with 11 additions and 1 deletions

View File

@@ -116,6 +116,12 @@ void DisasterVehicle::UpdateImage()
this->UpdateSpriteSeqBound(); this->UpdateSpriteSeqBound();
} }
DisasterVehicle::DisasterVehicle() :
SpecializedVehicleBase()
{
RegisterGameEvents(GEF_DISASTER_VEH);
}
/** /**
* Construct the disaster vehicle. * Construct the disaster vehicle.
* @param x The X coordinate. * @param x The X coordinate.
@@ -127,6 +133,8 @@ void DisasterVehicle::UpdateImage()
DisasterVehicle::DisasterVehicle(int x, int y, Direction direction, DisasterSubType subtype, VehicleID big_ufo_destroyer_target) : DisasterVehicle::DisasterVehicle(int x, int y, Direction direction, DisasterSubType subtype, VehicleID big_ufo_destroyer_target) :
SpecializedVehicleBase(), big_ufo_destroyer_target(big_ufo_destroyer_target) SpecializedVehicleBase(), big_ufo_destroyer_target(big_ufo_destroyer_target)
{ {
RegisterGameEvents(GEF_DISASTER_VEH);
this->vehstatus = VS_UNCLICKABLE; this->vehstatus = VS_UNCLICKABLE;
this->x_pos = x; this->x_pos = x;

View File

@@ -42,7 +42,7 @@ struct DisasterVehicle FINAL : public SpecializedVehicle<DisasterVehicle, VEH_DI
byte flags; ///< Flags about the state of the vehicle, @see AirVehicleFlags byte flags; ///< Flags about the state of the vehicle, @see AirVehicleFlags
/** For use by saveload. */ /** For use by saveload. */
DisasterVehicle() : SpecializedVehicleBase() {} DisasterVehicle();
DisasterVehicle(int x, int y, Direction direction, DisasterSubType subtype, VehicleID big_ufo_destroyer_target = VEH_INVALID); DisasterVehicle(int x, int y, Direction direction, DisasterSubType subtype, VehicleID big_ufo_destroyer_target = VEH_INVALID);
/** We want to 'destruct' the right class. */ /** We want to 'destruct' the right class. */
virtual ~DisasterVehicle() {} virtual ~DisasterVehicle() {}

View File

@@ -1734,5 +1734,6 @@ char *DumpGameEventFlags(GameEventFlags events, char *b, const char *last)
dump('m', GEF_COMPANY_MERGE); dump('m', GEF_COMPANY_MERGE);
dump('n', GEF_RELOAD_NEWGRF); dump('n', GEF_RELOAD_NEWGRF);
dump('t', GEF_TBTR_REPLACEMENT); dump('t', GEF_TBTR_REPLACEMENT);
dump('D', GEF_DISASTER_VEH);
return b; return b;
} }

View File

@@ -92,6 +92,7 @@ enum GameEventFlags : uint32 {
GEF_COMPANY_MERGE = 1 << 1, ///< (m) A company has been bought by another GEF_COMPANY_MERGE = 1 << 1, ///< (m) A company has been bought by another
GEF_RELOAD_NEWGRF = 1 << 2, ///< (n) ReloadNewGRFData() has been called GEF_RELOAD_NEWGRF = 1 << 2, ///< (n) ReloadNewGRFData() has been called
GEF_TBTR_REPLACEMENT = 1 << 3, ///< (t) CMD_TEMPLATE_REPLACE_VEHICLE has been called GEF_TBTR_REPLACEMENT = 1 << 3, ///< (t) CMD_TEMPLATE_REPLACE_VEHICLE has been called
GEF_DISASTER_VEH = 1 << 4, ///< (D) A disaster vehicle exists or has been created
}; };
DECLARE_ENUM_AS_BIT_SET(GameEventFlags) DECLARE_ENUM_AS_BIT_SET(GameEventFlags)