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