OpenTTD Source: src/disaster_vehicle.cpp File Reference

OpenTTD Source 15.3

Data Structures | Typedefs | Functions | Variables
disaster_vehicle.cpp File Reference

All disaster/easter egg vehicles are handled here. More...

`#include "stdafx.h"`
`#include "aircraft.h"`
`#include "disaster_vehicle.h"`
`#include "industry.h"`
`#include "station_base.h"`
`#include "command_func.h"`
`#include "news_func.h"`
`#include "town.h"`
`#include "company_func.h"`
`#include "strings_func.h"`
`#include "viewport_func.h"`
`#include "vehicle_func.h"`
`#include "sound_func.h"`
`#include "effectvehicle_func.h"`
`#include "roadveh.h"`
`#include "train.h"`
`#include "ai/ai.hpp"`
`#include "game/game.hpp"`
`#include "company_base.h"`
`#include "core/random_func.hpp"`
`#include "core/backup_type.hpp"`
`#include "landscape_cmd.h"`
`#include "timer/timer.h"`
`#include "timer/timer_game_economy.h"`
`#include "table/strings.h"`
`#include "safeguards.h"`

Go to the source code of this file.

## Data Structures
struct | Disaster

## Typedefs
typedef bool | DisasterVehicleTickProc(DisasterVehicle *v)
typedef void | DisasterInitProc()

## Functions
static void | DisasterClearSquare (TileIndex tile)
static bool | DisasterTick_Zeppeliner (DisasterVehicle *v)
| Zeppeliner handling, v->state states: 0: Zeppeliner initialization has found an 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 3: 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 *ufo)
| (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 behaviour)
| 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 an 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.

## Variables
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 const IntervalTimer< TimerGameEconomy > | _economy_disaster_daily ({TimerGameEconomy::DAY, TimerGameEconomy::Priority::DISASTER}, [](auto) { if(--_disaster_delay !=0) return;ResetDisasterDelay();if(_settings_game.difficulty.disasters !=0) DoDisaster();})

## Detailed Description

All disaster/easter egg vehicles are handled here.

The general flow of control for the disaster vehicles is as follows:

1. Initialize the disaster in a disaster specific way (eg start position, possible target, etc.) Disaster_XXX_Init() function
2. Add a subtype to a disaster, which is an index into the function array that handles the vehicle's ticks.
3. 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.

## Typedef Documentation

## ◆ DisasterInitProc

typedef void DisasterInitProc()

Definition at line 725 of file disaster_vehicle.cpp.

## ◆ DisasterVehicleTickProc

typedef bool DisasterVehicleTickProc(DisasterVehicle *v)

Definition at line 706 of file disaster_vehicle.cpp.

## Function Documentation

## ◆ DestructIndustry()

static void DestructIndustry | ( | Industry * | i | ) |
| static

Definition at line 412 of file disaster_vehicle.cpp.

## ◆ Disaster_Airplane_Init()

static void Disaster_Airplane_Init | ( |  | ) |
| static

Definition at line 772 of file disaster_vehicle.cpp.

## ◆ Disaster_Big_Submarine_Init()

static void Disaster_Big_Submarine_Init | ( |  | ) |
| static

Definition at line 873 of file disaster_vehicle.cpp.

## ◆ Disaster_Big_Ufo_Init()

static void Disaster_Big_Ufo_Init | ( |  | ) |
| static

Definition at line 827 of file disaster_vehicle.cpp.

## ◆ Disaster_CoalMine_Init()

static void Disaster_CoalMine_Init | ( |  | ) |
| static

Coal mine catastrophe, destroys a stretch of 30 tiles of land in a certain direction.

Definition at line 883 of file disaster_vehicle.cpp.

References Accident, IndustrySpec::behaviour, CanSubsidence, GB(), GetEncodedString(), GetIndustrySpec(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index, IsValidTile(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_industry_pool >::Iterate(), Industry::location, Random, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), OrthogonalTileArea::tile, TileDiffXY(), TileOffsByDiagDir(), Industry::town, and Industry::type.

## ◆ Disaster_Helicopter_Init()

static void Disaster_Helicopter_Init | ( |  | ) |
| static

Combat helicopter that destroys a factory.

Definition at line 798 of file disaster_vehicle.cpp.

References IndustrySpec::behaviour, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_vehicle_pool >::CanAllocateItem(), Chance16(), ChopperAttacks, DIR_SW, GetIndustrySpec(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_industry_pool >::Iterate(), Industry::location, Vehicle::SetNext(), ST_HELICOPTER, ST_HELICOPTER_ROTORS, ST_HELICOPTER_SHADOW, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), OrthogonalTileArea::tile, TILE_SIZE, TileY(), and Industry::type.

## ◆ Disaster_Small_Submarine_Init()

static void Disaster_Small_Submarine_Init | ( |  | ) |
| static

Definition at line 866 of file disaster_vehicle.cpp.

## ◆ Disaster_Small_Ufo_Init()

static void Disaster_Small_Ufo_Init | ( |  | ) |
| static

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.

Definition at line 757 of file disaster_vehicle.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_vehicle_pool >::CanAllocateItem(), Vehicle::dest_tile, DIR_SE, RandomTile, Vehicle::SetNext(), Map::SizeX(), Map::SizeY(), ST_SMALL_UFO, ST_SMALL_UFO_SHADOW, TILE_SIZE, TileX(), and TileXY().

## ◆ Disaster_Submarine_Init()

static void Disaster_Submarine_Init | ( | DisasterSubType | subtype | ) |
| static

Definition at line 843 of file disaster_vehicle.cpp.

## ◆ Disaster_Zeppeliner_Init()

static void Disaster_Zeppeliner_Init | ( |  | ) |
| static

Zeppeliner which crashes on an airport if one found, otherwise crashes on a random tile.

Definition at line 732 of file disaster_vehicle.cpp.

References AT_LARGE, AT_SMALL, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_vehicle_pool >::CanAllocateItem(), DIR_SE, INVALID_TILE, SpecializedStation< Station, false >::Iterate(), RandomTile, Vehicle::SetNext(), ST_ZEPPELINER, ST_ZEPPELINER_SHADOW, TILE_SIZE, and TileX().

## ◆ DisasterClearSquare()

static void DisasterClearSquare | ( | TileIndex | tile | ) |
| static

Definition at line 59 of file disaster_vehicle.cpp.

## ◆ DisasterTick_Aircraft()

static bool DisasterTick_Aircraft | ( | DisasterVehicle * | v,
|  | uint16_t | image_override,
|  | bool | leave_at_top,
|  | StringID | news_message,
|  | IndustryBehaviour | behaviour
| ) |  |
| static

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.
  behaviour | Only attack industries that have this behaviour set.

Definition at line 435 of file disaster_vehicle.cpp.

References _settings_client, Accident, Vehicle::age, CreateEffectVehicleAbove(), Vehicle::dest_tile, SoundSettings::disaster, EV_EXPLOSION_SMALL, GB(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_industry_pool >::Get(), GetEncodedString(), GetIndustryIndex(), GetIndustrySpec(), GetNewVehiclePos(), HasBit(), DisasterVehicle::image_override, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index, IsTileType(), Industry::location, Map::MaxX(), TimerGameConst< struct Calendar >::MIN_DATE, MP_INDUSTRY, Random, 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().

## ◆ DisasterTick_Airplane()

static bool DisasterTick_Airplane | ( | DisasterVehicle * | v | ) |
| static

Airplane handling.

Definition at line 496 of file disaster_vehicle.cpp.

References AirplaneAttacks, and DisasterTick_Aircraft().

## ◆ DisasterTick_Big_Ufo()

static bool DisasterTick_Big_Ufo | ( | DisasterVehicle * | v | ) |
| static

(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 527 of file disaster_vehicle.cpp.

References Accident, Vehicle::age, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_vehicle_pool >::CanAllocateItem(), ClosestTownFromTile(), Crashed, Delta(), Vehicle::dest_tile, DIR_SW, Vehicle::direction, GetEncodedString(), GetNewVehiclePos(), GetSlopePixelZ(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index, Company::IsHumanID(), IsPlainRailTile(), IsValidTile(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_vehicle_pool >::Iterate(), SpecializedVehicle< T, Type >::Iterate(), TimerGameConst< struct Calendar >::MIN_DATE, RandomRange(), RandomTile, Vehicle::SetNext(), ST_BIG_UFO_DESTROYER, ST_BIG_UFO_DESTROYER_SHADOW, DisasterVehicle::state, Vehicle::tick_counter, Vehicle::tile, TILE_SIZE, TileX(), TileY(), DisasterVehicle::UpdatePosition(), Vehicle::x_pos, GetNewVehiclePosResult::y, Vehicle::y_pos, and Vehicle::z_pos.

## ◆ DisasterTick_Big_Ufo_Destroyer()

static bool DisasterTick_Big_Ufo_Destroyer | ( | DisasterVehicle * | v | ) |
| static

Skyranger destroying (Big) Ufo handling, v->state states: 0: Home in on landed Ufo and shoot it down.

Definition at line 628 of file disaster_vehicle.cpp.

References _settings_client, DisasterVehicle::big_ufo_destroyer_target, CreateEffectVehicleAbove(), CreateEffectVehicleRel(), Delta(), SoundSettings::disaster, EV_EXPLOSION_LARGE, EV_EXPLOSION_SMALL, GB(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_vehicle_pool >::Get(), GetNewVehiclePos(), INVALID_TILE, Random, Map::SizeX(), SND_12_EXPLOSION, ClientSettings::sound, DisasterVehicle::state, Vehicle::tick_counter, Vehicle::tile, TILE_SIZE, TileAddWrap(), DisasterVehicle::UpdatePosition(), Vehicle::x_pos, GetNewVehiclePosResult::y, and Vehicle::y_pos.

## ◆ DisasterTick_Helicopter()

static bool DisasterTick_Helicopter | ( | DisasterVehicle * | v | ) |
| static

Helicopter handling.

Definition at line 502 of file disaster_vehicle.cpp.

References ChopperAttacks, and DisasterTick_Aircraft().

## ◆ DisasterTick_Helicopter_Rotors()

static bool DisasterTick_Helicopter_Rotors | ( | DisasterVehicle * | v | ) |
| static

Helicopter rotor blades; keep these spinning.

Definition at line 508 of file disaster_vehicle.cpp.

References HasBit(), Vehicle::sprite_cache, MutableSpriteCache::sprite_seq, Vehicle::tick_counter, and Vehicle::UpdatePositionAndViewport().

## ◆ DisasterTick_NULL()

static bool DisasterTick_NULL | ( | DisasterVehicle * |  | ) |
| static

Definition at line 701 of file disaster_vehicle.cpp.

## ◆ DisasterTick_Submarine()

static bool DisasterTick_Submarine | ( | DisasterVehicle * | v | ) |
| static

Submarine, v->state states: Unused, just float around aimlessly and pop up at different places, turning around.

Definition at line 674 of file disaster_vehicle.cpp.

References Vehicle::age, Chance16(), ChangeDir(), DIRDIFF_90LEFT, DIRDIFF_90RIGHT, Vehicle::direction, DirToDiagDir(), GB(), GetNewVehiclePos(), GetTileTrackStatus(), HasBit(), IsValidTile(), Random, Vehicle::tick_counter, Vehicle::tile, TileOffsByDiagDir(), TRACK_BIT_ALL, TrackStatusToTrackBits(), TRANSPORT_WATER, DisasterVehicle::UpdatePosition(), GetNewVehiclePosResult::y, and Vehicle::z_pos.

## ◆ DisasterTick_Ufo()

static bool DisasterTick_Ufo | ( | DisasterVehicle * | ufo | ) |
| static

(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

Parameters

  ufo | Ufo to handle.

Returns
  whether the tick was successful (i.e. false if the Ufo has been destroyed).

Definition at line 317 of file disaster_vehicle.cpp.

References _settings_client, Accident, 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(), GetEncodedString(), GetNewVehiclePos(), HasBit(), Hidden, DisasterVehicle::image_override, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index, Vehicle::IsFrontEngine(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::Iterate(), SpecializedVehicle< T, Type >::Iterate(), TimerGameConst< struct Calendar >::MIN_DATE, Game::NewEvent(), AI::NewEvent(), Vehicle::owner, RandomRange(), RandomTile, SND_12_EXPLOSION, ClientSettings::sound, DisasterVehicle::state, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), Vehicle::tick_counter, Vehicle::tile, TILE_SIZE, TileX(), TileY(), BaseVehicle::type, DisasterVehicle::UpdatePosition(), VEH_ROAD, Vehicle::vehstatus, Vehicle::x_pos, GetNewVehiclePosResult::y, Vehicle::y_pos, and Vehicle::z_pos.

## ◆ DisasterTick_Zeppeliner()

static bool DisasterTick_Zeppeliner | ( | DisasterVehicle * | v | ) |
| static

Zeppeliner handling, v->state states: 0: Zeppeliner initialization has found an 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 3: 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, Accident, Vehicle::age, Station::airport, Airport::blocks, CreateEffectVehicleRel(), SoundSettings::disaster, EV_CRASH_SMOKE, EV_EXPLOSION_LARGE, EV_EXPLOSION_SMALL, GB(), BaseStation::GetByTile(), GetEncodedString(), GetNewVehiclePos(), GetSlopePixelZ(), GetStationIndex(), GetTileOwner(), HasBit(), DisasterVehicle::image_override, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index, IsAirportTile(), IsValidTile(), TimerGameConst< struct Calendar >::MIN_DATE, AI::NewEvent(), Random, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Reset(), 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, Vehicle::z_pos, and Zeppeliner.

## ◆ DoDisaster()

static void DoDisaster | ( |  | ) |
| static

Definition at line 926 of file disaster_vehicle.cpp.

## ◆ ReleaseDisastersTargetingIndustry()

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.

Parameters

  i | deleted industry

Definition at line 966 of file disaster_vehicle.cpp.

References Vehicle::dest_tile, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_vehicle_pool >::Iterate(), ST_AIRPLANE, ST_HELICOPTER, DisasterVehicle::state, and Vehicle::subtype.

## ◆ ReleaseDisasterVehicle()

void ReleaseDisasterVehicle | ( | VehicleID | vehicle | ) |

Notify disasters that we are about to delete a vehicle.

So make them head elsewhere.

Parameters

  vehicle | deleted vehicle

Definition at line 981 of file disaster_vehicle.cpp.

References Vehicle::age, Vehicle::dest_tile, GetAircraftFlightLevelBounds(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_vehicle_pool >::GetIfValid(), TimerGameConst< struct Calendar >::MIN_DATE, RandomTile, ST_SMALL_UFO, DisasterVehicle::state, Vehicle::subtype, and Vehicle::z_pos.

Referenced by Vehicle::PreDestructor().

## ◆ ResetDisasterDelay()

static void ResetDisasterDelay | ( |  | ) |
| static

Definition at line 942 of file disaster_vehicle.cpp.

## ◆ StartupDisasters()

void StartupDisasters | ( |  | ) |

Definition at line 956 of file disaster_vehicle.cpp.

## Variable Documentation

## ◆ _disaster_delay

uint16_t _disaster_delay

Delay counter for considering the next disaster.

Definition at line 57 of file disaster_vehicle.cpp.

## ◆ _disaster_images

const SpriteID* const _disaster_images[]
| static

Initial value:
= {
_disaster_images_1, _disaster_images_1,
_disaster_images_2, _disaster_images_2,
_disaster_images_3, _disaster_images_3,
_disaster_images_8, _disaster_images_8, _disaster_images_9,
_disaster_images_6, _disaster_images_6,
_disaster_images_7, _disaster_images_7,
_disaster_images_4, _disaster_images_5,
}

Definition at line 102 of file disaster_vehicle.cpp.

## ◆ _disaster_images_1

const SpriteID _disaster_images_1[] = {SPR_BLIMP, SPR_BLIMP, SPR_BLIMP, SPR_BLIMP, SPR_BLIMP, SPR_BLIMP, SPR_BLIMP, SPR_BLIMP}
| static

Definition at line 92 of file disaster_vehicle.cpp.

## ◆ _disaster_images_2

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

Definition at line 93 of file disaster_vehicle.cpp.

## ◆ _disaster_images_3

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

Definition at line 94 of file disaster_vehicle.cpp.

## ◆ _disaster_images_4

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

Definition at line 95 of file disaster_vehicle.cpp.

## ◆ _disaster_images_5

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

Definition at line 96 of file disaster_vehicle.cpp.

## ◆ _disaster_images_6

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

Definition at line 97 of file disaster_vehicle.cpp.

## ◆ _disaster_images_7

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

Definition at line 98 of file disaster_vehicle.cpp.

## ◆ _disaster_images_8

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

Definition at line 99 of file disaster_vehicle.cpp.

## ◆ _disaster_images_9

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

Definition at line 100 of file disaster_vehicle.cpp.

## ◆ _disasters

const Disaster _disasters[]
| static

Initial value:
= {
{Disaster_Zeppeliner_Init, TimerGameCalendar::Year{1930}, TimerGameCalendar::Year{1955}},
{Disaster_Small_Ufo_Init, TimerGameCalendar::Year{1940}, TimerGameCalendar::Year{1970}},
{Disaster_Airplane_Init, TimerGameCalendar::Year{1960}, TimerGameCalendar::Year{1990}},
{Disaster_Helicopter_Init, TimerGameCalendar::Year{1970}, TimerGameCalendar::Year{2000}},
{Disaster_Big_Ufo_Init, TimerGameCalendar::Year{2000}, TimerGameCalendar::Year{2100}},
{Disaster_Small_Submarine_Init, TimerGameCalendar::Year{1940}, TimerGameCalendar::Year{1965}},
{Disaster_Big_Submarine_Init, TimerGameCalendar::Year{1975}, TimerGameCalendar::Year{2010}},
{Disaster_CoalMine_Init, TimerGameCalendar::Year{1950}, TimerGameCalendar::Year{1985}},
}
Disaster_Small_Ufo_Init
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 whi...
Definition disaster_vehicle.cpp:757
Disaster_Helicopter_Init
static void Disaster_Helicopter_Init()
Combat helicopter that destroys a factory.
Definition disaster_vehicle.cpp:798
Disaster_Zeppeliner_Init
static void Disaster_Zeppeliner_Init()
Zeppeliner which crashes on an airport if one found, otherwise crashes on a random tile.
Definition disaster_vehicle.cpp:732
Disaster_CoalMine_Init
static void Disaster_CoalMine_Init()
Coal mine catastrophe, destroys a stretch of 30 tiles of land in a certain direction.
Definition disaster_vehicle.cpp:883
StrongType::Typedef
Templated helper to make a type-safe 'typedef' representing a single POD value.
Definition strong_typedef_type.hpp:130

Definition at line 915 of file disaster_vehicle.cpp.

## ◆ _disastervehicle_tick_procs

DisasterVehicleTickProc* const _disastervehicle_tick_procs[]
| static

Initial value:
= {
DisasterTick_Zeppeliner, DisasterTick_NULL,
DisasterTick_Ufo, DisasterTick_NULL,
DisasterTick_Airplane, DisasterTick_NULL,
DisasterTick_Helicopter, DisasterTick_NULL, DisasterTick_Helicopter_Rotors,
DisasterTick_Big_Ufo, DisasterTick_NULL, DisasterTick_Big_Ufo_Destroyer,
DisasterTick_NULL,
DisasterTick_Submarine,
DisasterTick_Submarine,
}
DisasterTick_Big_Ufo_Destroyer
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.
Definition disaster_vehicle.cpp:628
DisasterTick_Big_Ufo
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 whil...
Definition disaster_vehicle.cpp:527
DisasterTick_Zeppeliner
static bool DisasterTick_Zeppeliner(DisasterVehicle *v)
Zeppeliner handling, v->state states: 0: Zeppeliner initialization has found an airport,...
Definition disaster_vehicle.cpp:224
DisasterTick_Helicopter_Rotors
static bool DisasterTick_Helicopter_Rotors(DisasterVehicle *v)
Helicopter rotor blades; keep these spinning.
Definition disaster_vehicle.cpp:508
DisasterTick_Airplane
static bool DisasterTick_Airplane(DisasterVehicle *v)
Airplane handling.
Definition disaster_vehicle.cpp:496
DisasterTick_Ufo
static bool DisasterTick_Ufo(DisasterVehicle *ufo)
(Small) Ufo handling, v->state states: 0: Fly around to the middle of the map, then randomly,...
Definition disaster_vehicle.cpp:317
DisasterTick_Submarine
static bool DisasterTick_Submarine(DisasterVehicle *v)
Submarine, v->state states: Unused, just float around aimlessly and pop up at different places,...
Definition disaster_vehicle.cpp:674
DisasterTick_Helicopter
static bool DisasterTick_Helicopter(DisasterVehicle *v)
Helicopter handling.
Definition disaster_vehicle.cpp:502

Definition at line 708 of file disaster_vehicle.cpp.