OpenTTD Source: src/depot_map.h File Reference

OpenTTD Source 15.3

Functions
depot_map.h File Reference

Map related accessors for depots. More...

`#include "order_type.h"`
`#include "station_map.h"`

Go to the source code of this file.

## Functions
bool | IsDepotTypeTile (Tile tile, TransportType type)
| Check if a tile is a depot and it is a depot of the given type.
bool | IsDepotTile (Tile tile)
| Is the given tile a tile with a depot on it?
DepotID | GetDepotIndex (Tile t)
| Get the index of which depot is attached to the tile.
DestinationID | GetDepotDestinationIndex (Tile t)
| Get the destination index of a 'depot'.
VehicleType | GetDepotVehicleType (Tile t)
| Get the type of vehicles that can use a depot.

## Detailed Description

Map related accessors for depots.

Definition in file depot_map.h.

## Function Documentation

## ◆ GetDepotDestinationIndex()

DestinationID GetDepotDestinationIndex | ( | Tile | t | ) |
| inline

Get the destination index of a 'depot'.

For hangars that's the station index, for the rest a depot index.

Parameters

  t | the tile

Precondition
  IsRailDepotTile(t) || IsRoadDepotTile(t) || IsShipDepotTile(t) || IsHangarTile(t)

Returns
  DepotID

Definition at line 66 of file depot_map.h.

References GetDepotIndex(), GetStationIndex(), and IsHangarTile().

Referenced by DepotWindow::GetDestinationIndex(), and GetOrderCmdFromTile().

## ◆ GetDepotIndex()

DepotID GetDepotIndex | ( | Tile | t | ) |
| inline

Get the index of which depot is attached to the tile.

Parameters

  t | the tile

Precondition
  IsRailDepotTile(t) || IsRoadDepotTile(t) || IsShipDepotTile(t)

Returns
  DepotID

Definition at line 53 of file depot_map.h.

References IsRailDepotTile(), IsRoadDepotTile(), IsShipDepotTile(), and Tile::m2().

Referenced by CheckIfTrainNeedsService(), CheckShipStayInDepot(), RoadVehicle::FindClosestDepot(), Train::FindClosestDepot(), FixTTDDepots(), GetDepotDestinationIndex(), and Depot::~Depot().

## ◆ GetDepotVehicleType()

VehicleType GetDepotVehicleType | ( | Tile | t | ) |
| inline

Get the type of vehicles that can use a depot.

Parameters

  t | The tile

Precondition
  IsDepotTile(t)

Returns
  the type of vehicles that can use the depot

Definition at line 78 of file depot_map.h.

References GetTileType(), MP_RAILWAY, MP_ROAD, MP_STATION, MP_WATER, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.

Referenced by CmdBuildVehicle(), CmdRenameDepot(), and Depot::~Depot().

## ◆ IsDepotTile()

bool IsDepotTile | ( | Tile | tile | ) |
| inline

Is the given tile a tile with a depot on it?

Parameters

  tile | the tile to check

Returns
  true if and only if there is a depot on the tile.

Definition at line 42 of file depot_map.h.

References IsHangarTile(), IsRailDepotTile(), IsRoadDepotTile(), and IsShipDepotTile().

Referenced by AfterLoadGame(), CmdBuildVehicle(), CmdDepotMassAutoReplace(), CmdDepotSellAllVehicles(), CmdMassStartStopVehicle(), FixTTDDepots(), Vehicle::ShowVisualEffect(), and Depot::~Depot().

## ◆ IsDepotTypeTile()

bool IsDepotTypeTile | ( | Tile | tile,
|  | TransportType | type
| ) |  |
| inline

Check if a tile is a depot and it is a depot of the given type.

Definition at line 19 of file depot_map.h.

References IsHangarTile(), IsRailDepotTile(), IsRoadDepotTile(), IsShipDepotTile(), TRANSPORT_AIR, TRANSPORT_RAIL, TRANSPORT_ROAD, and TRANSPORT_WATER.

Referenced by CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::CanEnterNewTile(), CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::CanExitOldTile(), CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::ForcedReverse(), GetOrderCmdFromTile(), and GroundVehicle< T, Type >::IsChainInDepot().