(svn r3907) Replace many bridge related direct map accesses with calls to shiny new functions and mark some strange constructs with XXX
This commit is contained in:
28
bridge_map.h
28
bridge_map.h
@@ -7,9 +7,21 @@
|
||||
#include "macros.h"
|
||||
#include "map.h"
|
||||
#include "rail.h"
|
||||
#include "road_map.h"
|
||||
#include "tile.h"
|
||||
|
||||
|
||||
static inline bool IsBridge(TileIndex t)
|
||||
{
|
||||
return HASBIT(_m[t].m5, 7);
|
||||
}
|
||||
|
||||
static inline bool IsBridgeTile(TileIndex t)
|
||||
{
|
||||
return IsTileType(t, MP_TUNNELBRIDGE) && IsBridge(t);
|
||||
}
|
||||
|
||||
|
||||
static inline bool IsBridgeRamp(TileIndex t)
|
||||
{
|
||||
return !HASBIT(_m[t].m5, 6);
|
||||
@@ -61,6 +73,12 @@ static inline Axis GetBridgeAxis(TileIndex t)
|
||||
}
|
||||
|
||||
|
||||
static inline TransportType GetBridgeTransportType(TileIndex t)
|
||||
{
|
||||
return (TransportType)GB(_m[t].m5, 1, 2);
|
||||
}
|
||||
|
||||
|
||||
static inline bool IsClearUnderBridge(TileIndex t)
|
||||
{
|
||||
return GB(_m[t].m5, 3, 3) == 0;
|
||||
@@ -82,6 +100,16 @@ static inline TransportType GetTransportTypeUnderBridge(TileIndex t)
|
||||
return (TransportType)GB(_m[t].m5, 3, 2);
|
||||
}
|
||||
|
||||
static inline RoadBits GetRoadBitsUnderBridge(TileIndex t)
|
||||
{
|
||||
return GetBridgeAxis(t) == AXIS_X ? ROAD_Y : ROAD_X;
|
||||
}
|
||||
|
||||
static inline TrackBits GetRailBitsUnderBridge(TileIndex t)
|
||||
{
|
||||
return GetBridgeAxis(t) == AXIS_X ? TRACK_BIT_Y : TRACK_BIT_X;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Finds the end of a bridge in the specified direction starting at a middle tile
|
||||
|
||||
Reference in New Issue
Block a user