2006-03-06 20:55:24 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
#ifndef TUNNEL_MAP_H
|
|
|
|
#define TUNNEL_MAP_H
|
|
|
|
|
|
|
|
#include "direction.h"
|
|
|
|
#include "macros.h"
|
|
|
|
#include "map.h"
|
|
|
|
#include "rail.h"
|
|
|
|
|
|
|
|
|
2006-03-12 15:04:03 +00:00
|
|
|
static inline bool IsTunnel(TileIndex t)
|
|
|
|
{
|
2006-03-30 09:29:01 +00:00
|
|
|
assert(IsTileType(t, MP_TUNNELBRIDGE));
|
2006-03-12 15:04:03 +00:00
|
|
|
return !HASBIT(_m[t].m5, 7);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline bool IsTunnelTile(TileIndex t)
|
|
|
|
{
|
|
|
|
return IsTileType(t, MP_TUNNELBRIDGE) && IsTunnel(t);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-03-06 20:55:24 +00:00
|
|
|
static inline DiagDirection GetTunnelDirection(TileIndex t)
|
|
|
|
{
|
2006-03-30 09:29:01 +00:00
|
|
|
assert(IsTunnelTile(t));
|
2006-03-06 20:55:24 +00:00
|
|
|
return (DiagDirection)GB(_m[t].m5, 0, 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline TransportType GetTunnelTransportType(TileIndex t)
|
|
|
|
{
|
2006-03-30 09:29:01 +00:00
|
|
|
assert(IsTunnelTile(t));
|
2006-03-06 20:55:24 +00:00
|
|
|
return (TransportType)GB(_m[t].m5, 2, 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TileIndex GetOtherTunnelEnd(TileIndex);
|
2006-03-07 07:51:05 +00:00
|
|
|
bool IsTunnelInWay(TileIndex, uint z);
|
2006-03-06 20:55:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
static inline void MakeRoadTunnel(TileIndex t, Owner o, DiagDirection d)
|
|
|
|
{
|
|
|
|
SetTileType(t, MP_TUNNELBRIDGE);
|
|
|
|
SetTileOwner(t, o);
|
|
|
|
_m[t].m2 = 0;
|
|
|
|
_m[t].m3 = 0;
|
|
|
|
_m[t].m4 = 0;
|
|
|
|
_m[t].m5 = TRANSPORT_ROAD << 2 | d;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void MakeRailTunnel(TileIndex t, Owner o, DiagDirection d, RailType r)
|
|
|
|
{
|
|
|
|
SetTileType(t, MP_TUNNELBRIDGE);
|
|
|
|
SetTileOwner(t, o);
|
|
|
|
_m[t].m2 = 0;
|
|
|
|
_m[t].m3 = r;
|
|
|
|
_m[t].m4 = 0;
|
|
|
|
_m[t].m5 = TRANSPORT_RAIL << 2 | d;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|