mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-07-16 00:55:11 +01:00
- Fix: Do not look in every direction for tunnels when building one, one direction is enough (r10258) - Fix: Take the age of the front vehicle for station rating (r10246) - Fix: Terraforming wipes out canals. Now you always have to remove the canal before terraforming, instead of "just" removing the canal [FS#594] (r10240) - Fix: Only 2 trains could crash at one time as collision checking stopped on the first hit. This could technically cause desyncs in network games as the collision hash order is not guaranteed [FS#892] (r10222) - Fix: Land under foundations was terraform when it shouldn't be terraformed [FS#882, FS#890] (r10219) - Fix: Some NewGRFs use the same (unused in the "current" climate) sprite IDs. Normally this gives some artefacts, but when one NewGRF expects it to be a sprite and another NewGRF overwrites it with a non-sprite nasty things happen (drawing a non-sprite crashes OTTD) [FS#838] (r10109)
65 lines
1.2 KiB
C
65 lines
1.2 KiB
C
/* $Id$ */
|
|
|
|
#ifndef TUNNEL_MAP_H
|
|
#define TUNNEL_MAP_H
|
|
|
|
#include "direction.h"
|
|
#include "macros.h"
|
|
#include "map.h"
|
|
#include "rail.h"
|
|
|
|
|
|
static inline bool IsTunnel(TileIndex t)
|
|
{
|
|
assert(IsTileType(t, MP_TUNNELBRIDGE));
|
|
return !HASBIT(_m[t].m5, 7);
|
|
}
|
|
|
|
|
|
static inline bool IsTunnelTile(TileIndex t)
|
|
{
|
|
return IsTileType(t, MP_TUNNELBRIDGE) && IsTunnel(t);
|
|
}
|
|
|
|
|
|
static inline DiagDirection GetTunnelDirection(TileIndex t)
|
|
{
|
|
assert(IsTunnelTile(t));
|
|
return (DiagDirection)GB(_m[t].m5, 0, 2);
|
|
}
|
|
|
|
|
|
static inline TransportType GetTunnelTransportType(TileIndex t)
|
|
{
|
|
assert(IsTunnelTile(t));
|
|
return (TransportType)GB(_m[t].m5, 2, 2);
|
|
}
|
|
|
|
|
|
TileIndex GetOtherTunnelEnd(TileIndex);
|
|
bool IsTunnelInWay(TileIndex, uint z);
|
|
bool IsTunnelInWayDir(TileIndex tile, uint z, DiagDirection dir);
|
|
|
|
|
|
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 /* TUNNEL_MAP_H */
|