mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-05 22:04:57 +00:00
(svn r13928) -Add [YAPP]: Function for getting the path reservation state of any tile. (michi_cc)
This commit is contained in:
parent
df99103a31
commit
2bb8825538
@ -663,6 +663,10 @@
|
||||
RelativePath=".\..\src\pathfind.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\pbs.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\players.cpp"
|
||||
>
|
||||
@ -1263,6 +1267,10 @@
|
||||
RelativePath=".\..\src\pathfind.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\pbs.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\player_base.h"
|
||||
>
|
||||
|
@ -660,6 +660,10 @@
|
||||
RelativePath=".\..\src\pathfind.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\pbs.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\players.cpp"
|
||||
>
|
||||
@ -1260,6 +1264,10 @@
|
||||
RelativePath=".\..\src\pathfind.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\pbs.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\player_base.h"
|
||||
>
|
||||
|
@ -57,6 +57,7 @@ os_timer.cpp
|
||||
ottdres.rc
|
||||
#end
|
||||
pathfind.cpp
|
||||
pbs.cpp
|
||||
players.cpp
|
||||
queue.cpp
|
||||
rail.cpp
|
||||
@ -241,6 +242,7 @@ order_base.h
|
||||
order_func.h
|
||||
order_type.h
|
||||
pathfind.h
|
||||
pbs.h
|
||||
player_base.h
|
||||
player_face.h
|
||||
player_func.h
|
||||
|
43
src/pbs.cpp
Normal file
43
src/pbs.cpp
Normal file
@ -0,0 +1,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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user