forked from mirror/OpenTTD
(svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
This commit is contained in:
47
bridge_map.h
47
bridge_map.h
@@ -47,4 +47,51 @@ static inline void SetRoadUnderBridge(TileIndex t, Owner o)
|
||||
SB(_m[t].m5, 3, 3, 1 << 2 | TRANSPORT_ROAD);
|
||||
}
|
||||
|
||||
|
||||
static inline void MakeBridgeRamp(TileIndex t, Owner o, uint bridgetype, DiagDirection d, TransportType tt)
|
||||
{
|
||||
uint northsouth = (d == DIAGDIR_NE || d == DIAGDIR_NW);
|
||||
|
||||
SetTileType(t, MP_TUNNELBRIDGE);
|
||||
SetTileOwner(t, o);
|
||||
_m[t].m2 = bridgetype << 4;
|
||||
_m[t].m4 = 0;
|
||||
_m[t].m5 = 1 << 7 | 0 << 6 | northsouth << 5 | tt << 1 | DiagDirToAxis(d);
|
||||
}
|
||||
|
||||
static inline void MakeRoadBridgeRamp(TileIndex t, Owner o, uint bridgetype, DiagDirection d)
|
||||
{
|
||||
MakeBridgeRamp(t, o, bridgetype, d, TRANSPORT_ROAD);
|
||||
_m[t].m3 = 0;
|
||||
}
|
||||
|
||||
static inline void MakeRailBridgeRamp(TileIndex t, Owner o, uint bridgetype, DiagDirection d, RailType r)
|
||||
{
|
||||
MakeBridgeRamp(t, o, bridgetype, d, TRANSPORT_RAIL);
|
||||
_m[t].m3 = r;
|
||||
}
|
||||
|
||||
|
||||
static inline void MakeBridgeMiddle(TileIndex t, uint bridgetype, uint piece, Axis a, TransportType tt)
|
||||
{
|
||||
SetTileType(t, MP_TUNNELBRIDGE);
|
||||
SetTileOwner(t, OWNER_NONE);
|
||||
_m[t].m2 = bridgetype << 4 | piece;
|
||||
_m[t].m3 = 0;
|
||||
_m[t].m4 = 0;
|
||||
_m[t].m5 = 1 << 7 | 1 << 6 | 0 << 5 | 0 << 3 | tt << 1 | a;
|
||||
}
|
||||
|
||||
static inline void MakeRoadBridgeMiddle(TileIndex t, uint bridgetype, uint piece, Axis a)
|
||||
{
|
||||
MakeBridgeMiddle(t, bridgetype, piece, a, TRANSPORT_ROAD);
|
||||
}
|
||||
|
||||
static inline void MakeRailBridgeMiddle(TileIndex t, uint bridgetype, uint piece, Axis a, RailType r)
|
||||
{
|
||||
MakeBridgeMiddle(t, bridgetype, piece, a, TRANSPORT_RAIL);
|
||||
SB(_m[t].m3, 4, 4, r);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user