blob: c75eb8caf6a5a82e49d137abc88f6c0db508f53f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
/* $Id$ */
/** @file pbs.cpp */
#include "stdafx.h"
#include "openttd.h"
#include "pbs.h"
#include "rail_map.h"
#include "road_map.h"
#include "station_map.h"
#include "tunnelbridge_map.h"
/**
* Get the reserved trackbits for any tile, regardless of type.
* @param t the tile
* @return the reserved trackbits. TRACK_BIT_NONE on nothing reserved or
* a tile without rail.
*/
TrackBits GetReservedTrackbits(TileIndex t)
{
switch (GetTileType(t)) {
case MP_RAILWAY:
if (IsRailWaypoint(t) || IsRailDepot(t)) return GetRailWaypointReservation(t);
if (IsPlainRailTile(t)) return GetTrackReservation(t);
break;
case MP_ROAD:
if (IsLevelCrossing(t)) return GetRailCrossingReservation(t);
break;
case MP_STATION:
if (IsRailwayStation(t)) return GetRailStationReservation(t);
break;
case MP_TUNNELBRIDGE:
if (GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL) return GetRailTunnelBridgeReservation(t);
break;
default:
break;
}
return TRACK_BIT_NONE;
}
|