Codechange: make use of Tile in for all direct map accesses

This commit is contained in:
Rubidium
2023-01-21 16:40:28 +01:00
committed by rubidium42
parent 7a6452d3ef
commit 580d0a6343
30 changed files with 963 additions and 946 deletions

View File

@@ -20,10 +20,10 @@
* @pre IsTileType(t, MP_TUNNELBRIDGE)
* @return true if and only if this tile is a tunnel (entrance)
*/
static inline bool IsTunnel(TileIndex t)
static inline bool IsTunnel(Tile t)
{
assert(IsTileType(t, MP_TUNNELBRIDGE));
return !HasBit(_m[t].m5, 7);
return !HasBit(t.m5(), 7);
}
/**
@@ -31,7 +31,7 @@ static inline bool IsTunnel(TileIndex t)
* @param t the tile that might be a tunnel
* @return true if and only if this tile is a tunnel (entrance)
*/
static inline bool IsTunnelTile(TileIndex t)
static inline bool IsTunnelTile(Tile t)
{
return IsTileType(t, MP_TUNNELBRIDGE) && IsTunnel(t);
}
@@ -47,17 +47,17 @@ bool IsTunnelInWayDir(TileIndex tile, int z, DiagDirection dir);
* @param d the direction facing out of the tunnel
* @param r the road type used in the tunnel
*/
static inline void MakeRoadTunnel(TileIndex t, Owner o, DiagDirection d, RoadType road_rt, RoadType tram_rt)
static inline void MakeRoadTunnel(Tile t, Owner o, DiagDirection d, RoadType road_rt, RoadType tram_rt)
{
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;
SB(_me[t].m6, 2, 4, 0);
_me[t].m7 = 0;
_me[t].m8 = 0;
t.m2() = 0;
t.m3() = 0;
t.m4() = 0;
t.m5() = TRANSPORT_ROAD << 2 | d;
SB(t.m6(), 2, 4, 0);
t.m7() = 0;
t.m8() = 0;
SetRoadOwner(t, RTT_ROAD, o);
if (o != OWNER_TOWN) SetRoadOwner(t, RTT_TRAM, o);
SetRoadTypes(t, road_rt, tram_rt);
@@ -70,17 +70,17 @@ static inline void MakeRoadTunnel(TileIndex t, Owner o, DiagDirection d, RoadTyp
* @param d the direction facing out of the tunnel
* @param r the rail type used in the tunnel
*/
static inline void MakeRailTunnel(TileIndex t, Owner o, DiagDirection d, RailType r)
static inline void MakeRailTunnel(Tile t, Owner o, DiagDirection d, RailType r)
{
SetTileType(t, MP_TUNNELBRIDGE);
SetTileOwner(t, o);
_m[t].m2 = 0;
_m[t].m3 = 0;
_m[t].m4 = 0;
_m[t].m5 = TRANSPORT_RAIL << 2 | d;
SB(_me[t].m6, 2, 4, 0);
_me[t].m7 = 0;
_me[t].m8 = 0;
t.m2() = 0;
t.m3() = 0;
t.m4() = 0;
t.m5() = TRANSPORT_RAIL << 2 | d;
SB(t.m6(), 2, 4, 0);
t.m7() = 0;
t.m8() = 0;
SetRailType(t, r);
SetRoadTypes(t, INVALID_ROADTYPE, INVALID_ROADTYPE);
}