# AIEventVehicleCrashed Class Reference

Event Vehicle Crash, indicating a vehicle of yours is crashed. More...

`#include <ai_event_types.hpp>`

Inheritance diagram for AIEventVehicleCrashed:

## Public Types

enum | CrashReason { CRASH_TRAIN, CRASH_RV_LEVEL_CROSSING, CRASH_RV_UFO, CRASH_PLANE_LANDING, CRASH_AIRCRAFT_NO_AIRPORT, CRASH_FLOODED }
| The reasons for vehicle crashes. More...

## Public Member Functions

| AIEventVehicleCrashed (VehicleID vehicle, TileIndex crash_site, CrashReason crash_reason)
VehicleID | GetVehicleID ()
| Get the VehicleID of the crashed vehicle.
TileIndex | GetCrashSite ()
| Find the tile the vehicle crashed.
CrashReason | GetCrashReason ()
| Get the reason for crashing.

## Static Public Member Functions

static const char * | GetClassName ()
static AIEventVehicleCrashed * | Convert (AIEvent *instance)
| Convert an AIEvent to the real instance.

## Private Attributes

TileIndex | crash_site
VehicleID | vehicle
CrashReason | crash_reason

## Detailed Description

Event Vehicle Crash, indicating a vehicle of yours is crashed.

It contains the crash site, the crashed vehicle and the reason for the crash.

Definition at line 23 of file ai_event_types.hpp.

## Member Enumeration Documentation

enum AIEventVehicleCrashed::CrashReason

The reasons for vehicle crashes.

Enumerator:

  CRASH_TRAIN | Two trains collided.
  CRASH_RV_LEVEL_CROSSING | Road vehicle got under a train.
  CRASH_RV_UFO | Road vehicle got under a landing ufo.
  CRASH_PLANE_LANDING | Plane crashed on landing.
  CRASH_AIRCRAFT_NO_AIRPORT | Aircraft crashed after it found not a single airport for landing.
  CRASH_FLOODED | Vehicle was flooded.

Definition at line 30 of file ai_event_types.hpp.

## Constructor & Destructor Documentation

AIEventVehicleCrashed::AIEventVehicleCrashed | ( | VehicleID | vehicle,
|  | TileIndex | crash_site,
|  | CrashReason | crash_reason |
| ) |  |  | `[inline]`

Parameters:

  | vehicle | The vehicle that crashed.
  | crash_site | Where the vehicle crashed.
  | crash_reason | The reason why the vehicle crashed.

Definition at line 44 of file ai_event_types.hpp.

## Member Function Documentation

static AIEventVehicleCrashed* AIEventVehicleCrashed::Convert | ( | AIEvent * | instance | ) | `[inline, static]`

Convert an AIEvent to the real instance.

Parameters:

  | instance | The instance to convert.

Returns:
  The converted instance.

Definition at line 56 of file ai_event_types.hpp.

CrashReason AIEventVehicleCrashed::GetCrashReason | ( |  | ) | `[inline]`

Get the reason for crashing.

Returns:
  The reason for crashing

Definition at line 74 of file ai_event_types.hpp.

TileIndex AIEventVehicleCrashed::GetCrashSite | ( |  | ) | `[inline]`

Find the tile the vehicle crashed.

Returns:
  The crash site.

Definition at line 68 of file ai_event_types.hpp.

VehicleID AIEventVehicleCrashed::GetVehicleID | ( |  | ) | `[inline]`

Get the VehicleID of the crashed vehicle.

Returns:
  The crashed vehicle.

Definition at line 62 of file ai_event_types.hpp.

The documentation for this class was generated from the following file:

- src/ai/api/ai_event_types.hpp