(svn r11644) -Codechange: merge some functions from tunnel_map.h and bridge_map.h into tunnelbridge_map.h

This commit is contained in:
smatz
2007-12-16 15:38:51 +00:00
parent ec90ce7e98
commit 3cee0abdba
28 changed files with 245 additions and 241 deletions

View File

@@ -11,6 +11,7 @@
#include "rail.h"
#include "road.h"
/**
* Is this a tunnel (entrance)?
* @param t the tile that might be a tunnel
@@ -23,7 +24,6 @@ static inline bool IsTunnel(TileIndex t)
return !HasBit(_m[t].m5, 7);
}
/**
* Is this a tunnel (entrance)?
* @param t the tile that might be a tunnel
@@ -34,62 +34,10 @@ static inline bool IsTunnelTile(TileIndex t)
return IsTileType(t, MP_TUNNELBRIDGE) && IsTunnel(t);
}
/**
* Gets the direction facing out of the tunnel
* @param t the tile to get the tunnel facing direction of
* @pre IsTunnelTile(t)
* @return the direction the tunnel is facing
*/
static inline DiagDirection GetTunnelDirection(TileIndex t)
{
assert(IsTunnelTile(t));
return (DiagDirection)GB(_m[t].m5, 0, 2);
}
/**
* Gets the transport type of the tunnel (road or rail)
* @param t the tunnel entrance tile to get the type of
* @pre IsTunnelTile(t)
* @return the transport type in the tunnel
*/
static inline TransportType GetTunnelTransportType(TileIndex t)
{
assert(IsTunnelTile(t));
return (TransportType)GB(_m[t].m5, 2, 2);
}
/**
* Is this tunnel entrance in a snowy or desert area?
* @param t the tunnel entrance tile
* @pre IsTunnelTile(t)
* @return true if and only if the tunnel entrance is in a snowy/desert area
*/
static inline bool HasTunnelSnowOrDesert(TileIndex t)
{
assert(IsTunnelTile(t));
return HasBit(_m[t].m4, 7);
}
/**
* Places this tunnel entrance in a snowy or desert area,
* or takes it out of there.
* @param t the tunnel entrance tile
* @param snow_or_desert is the entrance in snow or desert (true), when
* not in snow and not in desert false
* @pre IsTunnelTile(t)
*/
static inline void SetTunnelSnowOrDesert(TileIndex t, bool snow_or_desert)
{
assert(IsTunnelTile(t));
SB(_m[t].m4, 7, 1, snow_or_desert);
}
TileIndex GetOtherTunnelEnd(TileIndex);
bool IsTunnelInWay(TileIndex, uint z);
bool IsTunnelInWayDir(TileIndex tile, uint z, DiagDirection dir);
/**
* Makes a road tunnel entrance
* @param t the entrance of the tunnel