2006-03-05 12:22:20 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "openttd.h"
|
2006-03-14 12:00:11 +00:00
|
|
|
#include "bridge_map.h"
|
2006-03-06 13:11:08 +00:00
|
|
|
#include "functions.h"
|
2006-03-05 12:22:20 +00:00
|
|
|
#include "road_map.h"
|
|
|
|
#include "station.h"
|
2006-03-06 20:55:24 +00:00
|
|
|
#include "tunnel_map.h"
|
2006-03-05 12:22:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
RoadBits GetAnyRoadBits(TileIndex tile)
|
|
|
|
{
|
|
|
|
switch (GetTileType(tile)) {
|
|
|
|
case MP_STREET:
|
|
|
|
switch (GetRoadType(tile)) {
|
|
|
|
default:
|
|
|
|
case ROAD_NORMAL: return GetRoadBits(tile);
|
|
|
|
case ROAD_CROSSING: return GetCrossingRoadBits(tile);
|
2006-03-08 15:29:23 +00:00
|
|
|
case ROAD_DEPOT: return DiagDirToRoadBits(GetRoadDepotDirection(tile));
|
2006-03-05 12:22:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case MP_STATION:
|
|
|
|
if (!IsRoadStationTile(tile)) return 0;
|
|
|
|
return DiagDirToRoadBits(GetRoadStationDir(tile));
|
|
|
|
|
|
|
|
case MP_TUNNELBRIDGE:
|
2006-03-16 15:16:27 +00:00
|
|
|
if (IsBridge(tile)) {
|
|
|
|
if (IsBridgeMiddle(tile)) {
|
|
|
|
if (!IsTransportUnderBridge(tile) ||
|
|
|
|
GetBridgeTransportType(tile) != TRANSPORT_ROAD) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return GetRoadBitsUnderBridge(tile);
|
2006-03-05 12:22:20 +00:00
|
|
|
} else {
|
|
|
|
// ending
|
2006-03-16 15:16:27 +00:00
|
|
|
if (GetBridgeTransportType(tile) != TRANSPORT_ROAD) return 0;
|
2006-03-14 12:00:11 +00:00
|
|
|
return DiagDirToRoadBits(ReverseDiagDir(GetBridgeRampDirection(tile)));
|
2006-03-05 12:22:20 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// tunnel
|
2006-03-06 20:55:24 +00:00
|
|
|
if (GetTunnelTransportType(tile) != TRANSPORT_ROAD) return 0;
|
|
|
|
return DiagDirToRoadBits(ReverseDiagDir(GetTunnelDirection(tile)));
|
2006-03-05 12:22:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
default: return 0;
|
|
|
|
}
|
|
|
|
}
|
2006-03-06 13:11:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
TrackBits GetAnyRoadTrackBits(TileIndex tile)
|
|
|
|
{
|
|
|
|
uint32 r = GetTileTrackStatus(tile, TRANSPORT_ROAD);
|
|
|
|
return (byte)(r | (r >> 8));
|
|
|
|
}
|