|
static void | DisasterClearSquare (TileIndex tile) |
|
static bool | DisasterTick_Zeppeliner (DisasterVehicle *v) |
| Zeppeliner handling, v->state states: 0: Zeppeliner initialization has found a small airport, go there and crash 1: Create crash and animate falling down for extra dramatic effect 2: Create more smoke and leave debris on ground 2: Clear the runway after some time and remove crashed zeppeliner If not airport was found, only state 0 is reached until zeppeliner leaves map.
|
|
static bool | DisasterTick_Ufo (DisasterVehicle *v) |
| (Small) Ufo handling, v->state states: 0: Fly around to the middle of the map, then randomly, after a while target a road vehicle 1: Home in on a road vehicle and crash it >:) If not road vehicle was found, only state 0 is used and Ufo disappears after a while
|
|
static void | DestructIndustry (Industry *i) |
|
static bool | DisasterTick_Aircraft (DisasterVehicle *v, uint16_t image_override, bool leave_at_top, StringID news_message, IndustryBehaviour industry_flag) |
| Aircraft handling, v->state states: 0: Fly towards the targeted industry 1: If within 15 tiles, fire away rockets and destroy industry 2: Industry explosions 3: Fly out of the map If the industry was removed in the meantime just fly to the end of the map.
|
|
static bool | DisasterTick_Airplane (DisasterVehicle *v) |
| Airplane handling.
|
|
static bool | DisasterTick_Helicopter (DisasterVehicle *v) |
| Helicopter handling.
|
|
static bool | DisasterTick_Helicopter_Rotors (DisasterVehicle *v) |
| Helicopter rotor blades; keep these spinning.
|
|
static bool | DisasterTick_Big_Ufo (DisasterVehicle *v) |
| (Big) Ufo handling, v->state states: 0: Fly around to the middle of the map, then randomly for a while and home in on a piece of rail 1: Land there and breakdown all trains in a radius of 12 tiles; and now we wait... because as soon as the Ufo lands, a fighter jet, a Skyranger, is called to clear up the mess
|
|
static bool | DisasterTick_Big_Ufo_Destroyer (DisasterVehicle *v) |
| Skyranger destroying (Big) Ufo handling, v->state states: 0: Home in on landed Ufo and shoot it down.
|
|
static bool | DisasterTick_Submarine (DisasterVehicle *v) |
| Submarine, v->state states: Unused, just float around aimlessly and pop up at different places, turning around.
|
|
static bool | DisasterTick_NULL (DisasterVehicle *) |
|
static void | Disaster_Zeppeliner_Init () |
| Zeppeliner which crashes on a small airport if one found, otherwise crashes on a random tile.
|
|
static void | Disaster_Small_Ufo_Init () |
| Ufo which flies around aimlessly from the middle of the map a bit until it locates a road vehicle which it targets and then destroys.
|
|
static void | Disaster_Airplane_Init () |
|
static void | Disaster_Helicopter_Init () |
| Combat helicopter that destroys a factory.
|
|
static void | Disaster_Big_Ufo_Init () |
|
static void | Disaster_Submarine_Init (DisasterSubType subtype) |
|
static void | Disaster_Small_Submarine_Init () |
|
static void | Disaster_Big_Submarine_Init () |
|
static void | Disaster_CoalMine_Init () |
| Coal mine catastrophe, destroys a stretch of 30 tiles of land in a certain direction.
|
|
static void | DoDisaster () |
|
static void | ResetDisasterDelay () |
|
void | StartupDisasters () |
|
void | ReleaseDisastersTargetingIndustry (IndustryID i) |
| Marks all disasters targeting this industry in such a way they won't call Industry::Get(v->dest_tile) on invalid industry anymore.
|
|
void | ReleaseDisasterVehicle (VehicleID vehicle) |
| Notify disasters that we are about to delete a vehicle.
|
|
|
uint16_t | _disaster_delay |
| Delay counter for considering the next disaster.
|
|
static const SpriteID | _disaster_images_1 [] = {SPR_BLIMP, SPR_BLIMP, SPR_BLIMP, SPR_BLIMP, SPR_BLIMP, SPR_BLIMP, SPR_BLIMP, SPR_BLIMP} |
|
static const SpriteID | _disaster_images_2 [] = {SPR_UFO_SMALL_SCOUT, SPR_UFO_SMALL_SCOUT, SPR_UFO_SMALL_SCOUT, SPR_UFO_SMALL_SCOUT, SPR_UFO_SMALL_SCOUT, SPR_UFO_SMALL_SCOUT, SPR_UFO_SMALL_SCOUT, SPR_UFO_SMALL_SCOUT} |
|
static const SpriteID | _disaster_images_3 [] = {SPR_F_15, SPR_F_15, SPR_F_15, SPR_F_15, SPR_F_15, SPR_F_15, SPR_F_15, SPR_F_15} |
|
static const SpriteID | _disaster_images_4 [] = {SPR_SUB_SMALL_NE, SPR_SUB_SMALL_NE, SPR_SUB_SMALL_SE, SPR_SUB_SMALL_SE, SPR_SUB_SMALL_SW, SPR_SUB_SMALL_SW, SPR_SUB_SMALL_NW, SPR_SUB_SMALL_NW} |
|
static const SpriteID | _disaster_images_5 [] = {SPR_SUB_LARGE_NE, SPR_SUB_LARGE_NE, SPR_SUB_LARGE_SE, SPR_SUB_LARGE_SE, SPR_SUB_LARGE_SW, SPR_SUB_LARGE_SW, SPR_SUB_LARGE_NW, SPR_SUB_LARGE_NW} |
|
static const SpriteID | _disaster_images_6 [] = {SPR_UFO_HARVESTER, SPR_UFO_HARVESTER, SPR_UFO_HARVESTER, SPR_UFO_HARVESTER, SPR_UFO_HARVESTER, SPR_UFO_HARVESTER, SPR_UFO_HARVESTER, SPR_UFO_HARVESTER} |
|
static const SpriteID | _disaster_images_7 [] = {SPR_XCOM_SKYRANGER, SPR_XCOM_SKYRANGER, SPR_XCOM_SKYRANGER, SPR_XCOM_SKYRANGER, SPR_XCOM_SKYRANGER, SPR_XCOM_SKYRANGER, SPR_XCOM_SKYRANGER, SPR_XCOM_SKYRANGER} |
|
static const SpriteID | _disaster_images_8 [] = {SPR_AH_64A, SPR_AH_64A, SPR_AH_64A, SPR_AH_64A, SPR_AH_64A, SPR_AH_64A, SPR_AH_64A, SPR_AH_64A} |
|
static const SpriteID | _disaster_images_9 [] = {SPR_ROTOR_MOVING_1, SPR_ROTOR_MOVING_1, SPR_ROTOR_MOVING_1, SPR_ROTOR_MOVING_1, SPR_ROTOR_MOVING_1, SPR_ROTOR_MOVING_1, SPR_ROTOR_MOVING_1, SPR_ROTOR_MOVING_1} |
|
static const SpriteID *const | _disaster_images [] |
|
static DisasterVehicleTickProc *const | _disastervehicle_tick_procs [] |
|
static const Disaster | _disasters [] |
|
static IntervalTimer< TimerGameEconomy > | _economy_disaster_daily ({TimerGameEconomy::DAY, TimerGameEconomy::Priority::DISASTER}, [](auto) { if(--_disaster_delay !=0) return;ResetDisasterDelay();if(_settings_game.difficulty.disasters !=0) DoDisaster();}) |
|
All disaster/easter egg vehicles are handled here.
The general flow of control for the disaster vehicles is as follows:
-
Initialize the disaster in a disaster specific way (eg start position, possible target, etc.) Disaster_XXX_Init() function
-
Add a subtype to a disaster, which is an index into the function array that handles the vehicle's ticks.
-
Run the disaster vehicles each tick until their target has been reached, this happens in the DisasterTick_XXX() functions. In here, a vehicle's state is kept by v->state variable. Each achieved sub-target will increase this value, and the last one will remove the disaster itself
Definition in file disaster_vehicle.cpp.
Aircraft handling, v->state states: 0: Fly towards the targeted industry 1: If within 15 tiles, fire away rockets and destroy industry 2: Industry explosions 3: Fly out of the map If the industry was removed in the meantime just fly to the end of the map.
- Parameters
-
v | The disaster vehicle. |
image_override | The image at the time the aircraft is firing. |
leave_at_top | True iff the vehicle leaves the map at the north side. |
news_message | The string that's used as news message. |
industry_flag | Only attack industries that have this flag set. |
Definition at line 432 of file disaster_vehicle.cpp.
References _settings_client, Vehicle::age, CreateEffectVehicleAbove(), Vehicle::dest_tile, SoundSettings::disaster, EV_EXPLOSION_SMALL, GB(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_industry_pool >::Get(), GetIndustryIndex(), GetIndustrySpec(), GetNewVehiclePos(), HasBit(), DisasterVehicle::image_override, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, IsTileType(), Industry::location, Map::MaxX(), TimerGameConst< struct Calendar >::MIN_DATE, MP_INDUSTRY, NT_ACCIDENT, Random, SetDParam(), Map::SizeX(), SND_12_EXPLOSION, ClientSettings::sound, DisasterVehicle::state, Vehicle::tick_counter, OrthogonalTileArea::tile, TILE_SIZE, TileVirtXY(), TileX(), TileY(), Industry::town, DisasterVehicle::UpdatePosition(), Vehicle::x_pos, GetNewVehiclePosResult::y, and Vehicle::y_pos.
Referenced by DisasterTick_Airplane(), and DisasterTick_Helicopter().
(Big) Ufo handling, v->state states: 0: Fly around to the middle of the map, then randomly for a while and home in on a piece of rail 1: Land there and breakdown all trains in a radius of 12 tiles; and now we wait... because as soon as the Ufo lands, a fighter jet, a Skyranger, is called to clear up the mess
Definition at line 525 of file disaster_vehicle.cpp.
References Vehicle::age, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::CanAllocateItem(), ClosestTownFromTile(), Delta(), Vehicle::dest_tile, DIR_SW, Vehicle::direction, GetNewVehiclePos(), GetSlopePixelZ(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Company::IsHumanID(), IsPlainRailTile(), IsValidTile(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Iterate(), SpecializedVehicle< T, Type >::Iterate(), TimerGameConst< struct Calendar >::MIN_DATE, NT_ACCIDENT, RandomRange(), RandomTile, SetDParam(), Vehicle::SetNext(), ST_BIG_UFO_DESTROYER, ST_BIG_UFO_DESTROYER_SHADOW, DisasterVehicle::state, Vehicle::tick_counter, Vehicle::tile, TILE_SIZE, TileX(), TileY(), DisasterVehicle::UpdatePosition(), VS_CRASHED, Vehicle::x_pos, GetNewVehiclePosResult::y, Vehicle::y_pos, and Vehicle::z_pos.
(Small) Ufo handling, v->state states: 0: Fly around to the middle of the map, then randomly, after a while target a road vehicle 1: Home in on a road vehicle and crash it >:) If not road vehicle was found, only state 0 is used and Ufo disappears after a while
Definition at line 316 of file disaster_vehicle.cpp.
References _settings_client, Vehicle::age, Vehicle::breakdown_ctr, Vehicle::breakdown_delay, RoadVehicle::Crash(), RoadVehicle::crashed_ctr, CreateEffectVehicleRel(), Delta(), Vehicle::dest_tile, Vehicle::direction, SoundSettings::disaster, RoadVehicle::disaster_vehicle, EV_EXPLOSION_LARGE, SpecializedVehicle< T, Type >::Get(), GetNewVehiclePos(), HasBit(), DisasterVehicle::image_override, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_VEHICLE, Vehicle::IsFrontEngine(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Iterate(), SpecializedVehicle< T, Type >::Iterate(), TimerGameConst< struct Calendar >::MIN_DATE, Game::NewEvent(), AI::NewEvent(), NT_ACCIDENT, Vehicle::owner, RandomRange(), RandomTile, SND_12_EXPLOSION, ClientSettings::sound, DisasterVehicle::state, Vehicle::tick_counter, Vehicle::tile, TILE_SIZE, TileX(), TileY(), BaseVehicle::type, DisasterVehicle::UpdatePosition(), VEH_ROAD, Vehicle::vehstatus, VS_HIDDEN, Vehicle::x_pos, GetNewVehiclePosResult::y, Vehicle::y_pos, and Vehicle::z_pos.
Zeppeliner handling, v->state states: 0: Zeppeliner initialization has found a small airport, go there and crash 1: Create crash and animate falling down for extra dramatic effect 2: Create more smoke and leave debris on ground 2: Clear the runway after some time and remove crashed zeppeliner If not airport was found, only state 0 is reached until zeppeliner leaves map.
Definition at line 224 of file disaster_vehicle.cpp.
References _settings_client, Vehicle::age, Station::airport, CLRBITS, CreateEffectVehicleRel(), SoundSettings::disaster, EV_CRASH_SMOKE, EV_EXPLOSION_LARGE, EV_EXPLOSION_SMALL, Airport::flags, GB(), BaseStation::GetByTile(), GetNewVehiclePos(), GetSlopePixelZ(), GetStationIndex(), GetTileOwner(), HasBit(), DisasterVehicle::image_override, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, IsAirportTile(), IsValidTile(), TimerGameConst< struct Calendar >::MIN_DATE, AI::NewEvent(), NT_ACCIDENT, Random, SETBITS, SetDParam(), Map::SizeY(), SND_12_EXPLOSION, ClientSettings::sound, DisasterVehicle::state, Vehicle::tick_counter, Vehicle::tile, TILE_SIZE, DisasterVehicle::UpdatePosition(), Vehicle::x_pos, GetNewVehiclePosResult::y, Vehicle::y_pos, and Vehicle::z_pos.