Update existing assertions to log tile information where suitable
This commit is contained in:
@@ -62,7 +62,7 @@ TileIndex GetSouthernBridgeEnd(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
TileIndex GetOtherBridgeEnd(TileIndex tile)
|
TileIndex GetOtherBridgeEnd(TileIndex tile)
|
||||||
{
|
{
|
||||||
assert(IsBridgeTile(tile));
|
assert_tile(IsBridgeTile(tile), tile);
|
||||||
return GetBridgeEnd(tile, GetTunnelBridgeDirection(tile));
|
return GetBridgeEnd(tile, GetTunnelBridgeDirection(tile));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
static inline bool IsBridge(TileIndex t)
|
static inline bool IsBridge(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_TUNNELBRIDGE));
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
return HasBit(_m[t].m5, 7);
|
return HasBit(_m[t].m5, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ static inline bool IsBridgeAbove(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline BridgeType GetBridgeType(TileIndex t)
|
static inline BridgeType GetBridgeType(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsBridgeTile(t));
|
assert_tile(IsBridgeTile(t), t);
|
||||||
return GB(_me[t].m6, 2, 4);
|
return GB(_me[t].m6, 2, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ static inline BridgeType GetBridgeType(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline Axis GetBridgeAxis(TileIndex t)
|
static inline Axis GetBridgeAxis(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsBridgeAbove(t));
|
assert_tile(IsBridgeAbove(t), t);
|
||||||
return (Axis)(GB(_m[t].type, 2, 2) - 1);
|
return (Axis)(GB(_m[t].type, 2, 2) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,7 +220,7 @@ static inline void MakeAqueductBridgeRamp(TileIndex t, Owner o, DiagDirection d)
|
|||||||
*/
|
*/
|
||||||
static inline bool IsRoadCustomBridgeHead(TileIndex t)
|
static inline bool IsRoadCustomBridgeHead(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsBridgeTile(t) && (TransportType)GB(_m[t].m5, 2, 2) == TRANSPORT_ROAD);
|
assert_tile(IsBridgeTile(t) && (TransportType)GB(_m[t].m5, 2, 2) == TRANSPORT_ROAD, t);
|
||||||
return GB(_m[t].m2, 0, 8) != 0;
|
return GB(_m[t].m2, 0, 8) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,7 +243,7 @@ static inline bool IsRoadCustomBridgeHeadTile(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline RoadBits GetCustomBridgeHeadRoadBits(TileIndex t, RoadType rt)
|
static inline RoadBits GetCustomBridgeHeadRoadBits(TileIndex t, RoadType rt)
|
||||||
{
|
{
|
||||||
assert(IsBridgeTile(t));
|
assert_tile(IsBridgeTile(t), t);
|
||||||
if (!HasTileRoadType(t, rt)) return (RoadBits) 0;
|
if (!HasTileRoadType(t, rt)) return (RoadBits) 0;
|
||||||
RoadBits bits = (GB(_m[t].m5, 0, 1) ? ROAD_Y : ROAD_X) ^ (RoadBits) GB(_m[t].m2, rt == ROADTYPE_TRAM ? 4 : 0, 4);
|
RoadBits bits = (GB(_m[t].m5, 0, 1) ? ROAD_Y : ROAD_X) ^ (RoadBits) GB(_m[t].m2, rt == ROADTYPE_TRAM ? 4 : 0, 4);
|
||||||
return bits;
|
return bits;
|
||||||
@@ -270,7 +270,7 @@ static inline RoadBits GetCustomBridgeHeadAllRoadBits(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetCustomBridgeHeadRoadBits(TileIndex t, RoadType rt, RoadBits bits)
|
static inline void SetCustomBridgeHeadRoadBits(TileIndex t, RoadType rt, RoadBits bits)
|
||||||
{
|
{
|
||||||
assert(IsBridgeTile(t));
|
assert_tile(IsBridgeTile(t), t);
|
||||||
if (HasTileRoadType(t, rt)) {
|
if (HasTileRoadType(t, rt)) {
|
||||||
assert(bits != ROAD_NONE);
|
assert(bits != ROAD_NONE);
|
||||||
SB(_m[t].m2, rt == ROADTYPE_TRAM ? 4 : 0, 4, bits ^ (GB(_m[t].m5, 0, 1) ? ROAD_Y : ROAD_X));
|
SB(_m[t].m2, rt == ROADTYPE_TRAM ? 4 : 0, 4, bits ^ (GB(_m[t].m5, 0, 1) ? ROAD_Y : ROAD_X));
|
||||||
@@ -308,7 +308,7 @@ static inline bool IsFlatRailBridgeHeadTile(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline TrackBits GetCustomBridgeHeadTrackBits(TileIndex t)
|
static inline TrackBits GetCustomBridgeHeadTrackBits(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsRailBridgeHeadTile(t));
|
assert_tile(IsRailBridgeHeadTile(t), t);
|
||||||
return (TrackBits)GB(_m[t].m4, 0, 6);
|
return (TrackBits)GB(_m[t].m4, 0, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -320,7 +320,7 @@ static inline TrackBits GetCustomBridgeHeadTrackBits(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetCustomBridgeHeadTrackBits(TileIndex t, TrackBits b)
|
static inline void SetCustomBridgeHeadTrackBits(TileIndex t, TrackBits b)
|
||||||
{
|
{
|
||||||
assert(IsRailBridgeHeadTile(t));
|
assert_tile(IsRailBridgeHeadTile(t), t);
|
||||||
SB(_m[t].m4, 0, 6, b);
|
SB(_m[t].m4, 0, 6, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -332,7 +332,7 @@ static inline void SetCustomBridgeHeadTrackBits(TileIndex t, TrackBits b)
|
|||||||
*/
|
*/
|
||||||
static inline bool IsRailCustomBridgeHead(TileIndex t)
|
static inline bool IsRailCustomBridgeHead(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsRailBridgeHeadTile(t));
|
assert_tile(IsRailBridgeHeadTile(t), t);
|
||||||
return GetCustomBridgeHeadTrackBits(t) != DiagDirToDiagTrackBits((DiagDirection)GB(_m[t].m5, 0, 2));
|
return GetCustomBridgeHeadTrackBits(t) != DiagDirToDiagTrackBits((DiagDirection)GB(_m[t].m5, 0, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -364,7 +364,7 @@ static inline bool IsCustomBridgeHeadTile(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline TrackBits GetBridgeReservationTrackBits(TileIndex t)
|
static inline TrackBits GetBridgeReservationTrackBits(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsRailBridgeHeadTile(t));
|
assert_tile(IsRailBridgeHeadTile(t), t);
|
||||||
byte track_b = GB(_m[t].m2, 0, 3);
|
byte track_b = GB(_m[t].m2, 0, 3);
|
||||||
Track track = (Track)(track_b - 1); // map array saves Track+1
|
Track track = (Track)(track_b - 1); // map array saves Track+1
|
||||||
if (track_b == 0) return TRACK_BIT_NONE;
|
if (track_b == 0) return TRACK_BIT_NONE;
|
||||||
@@ -379,7 +379,7 @@ static inline TrackBits GetBridgeReservationTrackBits(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetBridgeReservationTrackBits(TileIndex t, TrackBits b)
|
static inline void SetBridgeReservationTrackBits(TileIndex t, TrackBits b)
|
||||||
{
|
{
|
||||||
assert(IsRailBridgeHeadTile(t));
|
assert_tile(IsRailBridgeHeadTile(t), t);
|
||||||
assert(!TracksOverlap(b));
|
assert(!TracksOverlap(b));
|
||||||
Track track = RemoveFirstTrack(&b);
|
Track track = RemoveFirstTrack(&b);
|
||||||
SB(_m[t].m2, 0, 3, track == INVALID_TRACK ? 0 : track + 1);
|
SB(_m[t].m2, 0, 3, track == INVALID_TRACK ? 0 : track + 1);
|
||||||
@@ -396,8 +396,8 @@ static inline void SetBridgeReservationTrackBits(TileIndex t, TrackBits b)
|
|||||||
*/
|
*/
|
||||||
static inline bool TryReserveRailBridgeHead(TileIndex tile, Track t)
|
static inline bool TryReserveRailBridgeHead(TileIndex tile, Track t)
|
||||||
{
|
{
|
||||||
assert(IsRailBridgeHeadTile(tile));
|
assert_tile(IsRailBridgeHeadTile(tile), tile);
|
||||||
assert(HasBit(GetCustomBridgeHeadTrackBits(tile), t));
|
assert_tile(HasBit(GetCustomBridgeHeadTrackBits(tile), t), tile);
|
||||||
TrackBits bits = TrackToTrackBits(t);
|
TrackBits bits = TrackToTrackBits(t);
|
||||||
TrackBits res = GetBridgeReservationTrackBits(tile);
|
TrackBits res = GetBridgeReservationTrackBits(tile);
|
||||||
if ((res & bits) != TRACK_BIT_NONE) return false; // already reserved
|
if ((res & bits) != TRACK_BIT_NONE) return false; // already reserved
|
||||||
@@ -416,7 +416,7 @@ static inline bool TryReserveRailBridgeHead(TileIndex tile, Track t)
|
|||||||
*/
|
*/
|
||||||
static inline void UnreserveRailBridgeHeadTrack(TileIndex tile, Track t)
|
static inline void UnreserveRailBridgeHeadTrack(TileIndex tile, Track t)
|
||||||
{
|
{
|
||||||
assert(IsRailBridgeHeadTile(tile));
|
assert_tile(IsRailBridgeHeadTile(tile), tile);
|
||||||
assert(HasBit(GetCustomBridgeHeadTrackBits(tile), t));
|
assert(HasBit(GetCustomBridgeHeadTrackBits(tile), t));
|
||||||
TrackBits res = GetBridgeReservationTrackBits(tile);
|
TrackBits res = GetBridgeReservationTrackBits(tile);
|
||||||
res &= ~TrackToTrackBits(t);
|
res &= ~TrackToTrackBits(t);
|
||||||
@@ -431,7 +431,7 @@ static inline void UnreserveRailBridgeHeadTrack(TileIndex tile, Track t)
|
|||||||
*/
|
*/
|
||||||
static inline TrackBits GetAcrossBridgePossibleTrackBits(TileIndex t)
|
static inline TrackBits GetAcrossBridgePossibleTrackBits(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsRailBridgeHeadTile(t));
|
assert_tile(IsRailBridgeHeadTile(t), t);
|
||||||
return DiagdirReachesTracks(ReverseDiagDir((DiagDirection)GB(_m[t].m5, 0, 2)));
|
return DiagdirReachesTracks(ReverseDiagDir((DiagDirection)GB(_m[t].m5, 0, 2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -464,7 +464,7 @@ static inline bool HasAcrossBridgeReservation(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void UnreserveAcrossRailBridgeHead(TileIndex tile)
|
static inline void UnreserveAcrossRailBridgeHead(TileIndex tile)
|
||||||
{
|
{
|
||||||
assert(IsRailBridgeHeadTile(tile));
|
assert_tile(IsRailBridgeHeadTile(tile), tile);
|
||||||
TrackBits res = GetAcrossBridgeReservationTrackBits(tile);
|
TrackBits res = GetAcrossBridgeReservationTrackBits(tile);
|
||||||
if (res != TRACK_BIT_NONE) {
|
if (res != TRACK_BIT_NONE) {
|
||||||
SetBridgeReservationTrackBits(tile, GetBridgeReservationTrackBits(tile) & ~res);
|
SetBridgeReservationTrackBits(tile, GetBridgeReservationTrackBits(tile) & ~res);
|
||||||
|
@@ -169,7 +169,7 @@ static Foundation GetFoundation_Clear(TileIndex tile, Slope tileh)
|
|||||||
|
|
||||||
static void UpdateFences(TileIndex tile)
|
static void UpdateFences(TileIndex tile)
|
||||||
{
|
{
|
||||||
assert(IsTileType(tile, MP_CLEAR) && IsClearGround(tile, CLEAR_FIELDS));
|
assert_tile(IsTileType(tile, MP_CLEAR) && IsClearGround(tile, CLEAR_FIELDS), tile);
|
||||||
bool dirty = false;
|
bool dirty = false;
|
||||||
|
|
||||||
bool neighbour = (IsTileType(TILE_ADDXY(tile, 1, 0), MP_CLEAR) && IsClearGround(TILE_ADDXY(tile, 1, 0), CLEAR_FIELDS));
|
bool neighbour = (IsTileType(TILE_ADDXY(tile, 1, 0), MP_CLEAR) && IsClearGround(TILE_ADDXY(tile, 1, 0), CLEAR_FIELDS));
|
||||||
|
@@ -36,7 +36,7 @@ enum ClearGround {
|
|||||||
*/
|
*/
|
||||||
static inline bool IsSnowTile(TileIndex t)
|
static inline bool IsSnowTile(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_CLEAR));
|
assert_tile(IsTileType(t, MP_CLEAR), t);
|
||||||
return HasBit(_m[t].m3, 4);
|
return HasBit(_m[t].m3, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ static inline bool IsSnowTile(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline ClearGround GetRawClearGround(TileIndex t)
|
static inline ClearGround GetRawClearGround(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_CLEAR));
|
assert_tile(IsTileType(t, MP_CLEAR), t);
|
||||||
return (ClearGround)GB(_m[t].m5, 2, 3);
|
return (ClearGround)GB(_m[t].m5, 2, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ static inline bool IsClearGround(TileIndex t, ClearGround ct)
|
|||||||
*/
|
*/
|
||||||
static inline uint GetClearDensity(TileIndex t)
|
static inline uint GetClearDensity(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_CLEAR));
|
assert_tile(IsTileType(t, MP_CLEAR), t);
|
||||||
return GB(_m[t].m5, 0, 2);
|
return GB(_m[t].m5, 0, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ static inline uint GetClearDensity(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void AddClearDensity(TileIndex t, int d)
|
static inline void AddClearDensity(TileIndex t, int d)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_CLEAR)); // XXX incomplete
|
assert_tile(IsTileType(t, MP_CLEAR), t); // XXX incomplete
|
||||||
_m[t].m5 += d;
|
_m[t].m5 += d;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ static inline void AddClearDensity(TileIndex t, int d)
|
|||||||
*/
|
*/
|
||||||
static inline void SetClearDensity(TileIndex t, uint d)
|
static inline void SetClearDensity(TileIndex t, uint d)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_CLEAR));
|
assert_tile(IsTileType(t, MP_CLEAR), t);
|
||||||
SB(_m[t].m5, 0, 2, d);
|
SB(_m[t].m5, 0, 2, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ static inline void SetClearDensity(TileIndex t, uint d)
|
|||||||
*/
|
*/
|
||||||
static inline uint GetClearCounter(TileIndex t)
|
static inline uint GetClearCounter(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_CLEAR));
|
assert_tile(IsTileType(t, MP_CLEAR), t);
|
||||||
return GB(_m[t].m5, 5, 3);
|
return GB(_m[t].m5, 5, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ static inline uint GetClearCounter(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void AddClearCounter(TileIndex t, int c)
|
static inline void AddClearCounter(TileIndex t, int c)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_CLEAR)); // XXX incomplete
|
assert_tile(IsTileType(t, MP_CLEAR), t); // XXX incomplete
|
||||||
_m[t].m5 += c << 5;
|
_m[t].m5 += c << 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ static inline void AddClearCounter(TileIndex t, int c)
|
|||||||
*/
|
*/
|
||||||
static inline void SetClearCounter(TileIndex t, uint c)
|
static inline void SetClearCounter(TileIndex t, uint c)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_CLEAR)); // XXX incomplete
|
assert_tile(IsTileType(t, MP_CLEAR), t); // XXX incomplete
|
||||||
SB(_m[t].m5, 5, 3, c);
|
SB(_m[t].m5, 5, 3, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ static inline void SetClearCounter(TileIndex t, uint c)
|
|||||||
*/
|
*/
|
||||||
static inline void SetClearGroundDensity(TileIndex t, ClearGround type, uint density)
|
static inline void SetClearGroundDensity(TileIndex t, ClearGround type, uint density)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_CLEAR)); // XXX incomplete
|
assert_tile(IsTileType(t, MP_CLEAR), t); // XXX incomplete
|
||||||
_m[t].m5 = 0 << 5 | type << 2 | density;
|
_m[t].m5 = 0 << 5 | type << 2 | density;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,7 +172,7 @@ static inline void SetClearGroundDensity(TileIndex t, ClearGround type, uint den
|
|||||||
*/
|
*/
|
||||||
static inline uint GetFieldType(TileIndex t)
|
static inline uint GetFieldType(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(GetClearGround(t) == CLEAR_FIELDS);
|
assert_tile(GetClearGround(t) == CLEAR_FIELDS, t);
|
||||||
return GB(_m[t].m3, 0, 4);
|
return GB(_m[t].m3, 0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,7 +184,7 @@ static inline uint GetFieldType(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetFieldType(TileIndex t, uint f)
|
static inline void SetFieldType(TileIndex t, uint f)
|
||||||
{
|
{
|
||||||
assert(GetClearGround(t) == CLEAR_FIELDS); // XXX incomplete
|
assert_tile(GetClearGround(t) == CLEAR_FIELDS, t); // XXX incomplete
|
||||||
SB(_m[t].m3, 0, 4, f);
|
SB(_m[t].m3, 0, 4, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,7 +196,7 @@ static inline void SetFieldType(TileIndex t, uint f)
|
|||||||
*/
|
*/
|
||||||
static inline IndustryID GetIndustryIndexOfField(TileIndex t)
|
static inline IndustryID GetIndustryIndexOfField(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(GetClearGround(t) == CLEAR_FIELDS);
|
assert_tile(GetClearGround(t) == CLEAR_FIELDS, t);
|
||||||
return(IndustryID) _m[t].m2;
|
return(IndustryID) _m[t].m2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,7 +208,7 @@ static inline IndustryID GetIndustryIndexOfField(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetIndustryIndexOfField(TileIndex t, IndustryID i)
|
static inline void SetIndustryIndexOfField(TileIndex t, IndustryID i)
|
||||||
{
|
{
|
||||||
assert(GetClearGround(t) == CLEAR_FIELDS);
|
assert_tile(GetClearGround(t) == CLEAR_FIELDS, t);
|
||||||
_m[t].m2 = i;
|
_m[t].m2 = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,7 +222,7 @@ static inline void SetIndustryIndexOfField(TileIndex t, IndustryID i)
|
|||||||
*/
|
*/
|
||||||
static inline uint GetFence(TileIndex t, DiagDirection side)
|
static inline uint GetFence(TileIndex t, DiagDirection side)
|
||||||
{
|
{
|
||||||
assert(IsClearGround(t, CLEAR_FIELDS));
|
assert_tile(IsClearGround(t, CLEAR_FIELDS), t);
|
||||||
switch (side) {
|
switch (side) {
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
case DIAGDIR_SE: return GB(_m[t].m4, 2, 3);
|
case DIAGDIR_SE: return GB(_m[t].m4, 2, 3);
|
||||||
@@ -241,7 +241,7 @@ static inline uint GetFence(TileIndex t, DiagDirection side)
|
|||||||
*/
|
*/
|
||||||
static inline void SetFence(TileIndex t, DiagDirection side, uint h)
|
static inline void SetFence(TileIndex t, DiagDirection side, uint h)
|
||||||
{
|
{
|
||||||
assert(IsClearGround(t, CLEAR_FIELDS));
|
assert_tile(IsClearGround(t, CLEAR_FIELDS), t);
|
||||||
switch (side) {
|
switch (side) {
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
case DIAGDIR_SE: SB(_m[t].m4, 2, 3, h); break;
|
case DIAGDIR_SE: SB(_m[t].m4, 2, 3, h); break;
|
||||||
@@ -299,7 +299,7 @@ static inline void MakeField(TileIndex t, uint field_type, IndustryID industry)
|
|||||||
*/
|
*/
|
||||||
static inline void MakeSnow(TileIndex t, uint density = 0)
|
static inline void MakeSnow(TileIndex t, uint density = 0)
|
||||||
{
|
{
|
||||||
assert(GetClearGround(t) != CLEAR_SNOW);
|
assert_tile(GetClearGround(t) != CLEAR_SNOW, t);
|
||||||
SetBit(_m[t].m3, 4);
|
SetBit(_m[t].m3, 4);
|
||||||
if (GetRawClearGround(t) == CLEAR_FIELDS) {
|
if (GetRawClearGround(t) == CLEAR_FIELDS) {
|
||||||
SetClearGroundDensity(t, CLEAR_GRASS, density);
|
SetClearGroundDensity(t, CLEAR_GRASS, density);
|
||||||
@@ -315,7 +315,7 @@ static inline void MakeSnow(TileIndex t, uint density = 0)
|
|||||||
*/
|
*/
|
||||||
static inline void ClearSnow(TileIndex t)
|
static inline void ClearSnow(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(GetClearGround(t) == CLEAR_SNOW);
|
assert_tile(GetClearGround(t) == CLEAR_SNOW, t);
|
||||||
ClrBit(_m[t].m3, 4);
|
ClrBit(_m[t].m3, 4);
|
||||||
SetClearDensity(t, 3);
|
SetClearDensity(t, 3);
|
||||||
}
|
}
|
||||||
|
@@ -648,8 +648,8 @@ CommandCost DoCommand(const CommandContainer *container, DoCommandFlag flags)
|
|||||||
*/
|
*/
|
||||||
CommandCost DoCommand(TileIndex tile, uint32 p1, uint32 p2, DoCommandFlag flags, uint32 cmd, const char *text)
|
CommandCost DoCommand(TileIndex tile, uint32 p1, uint32 p2, DoCommandFlag flags, uint32 cmd, const char *text)
|
||||||
{
|
{
|
||||||
SCOPE_INFO_FMT([=], "DoCommand: tile: %dx%d, p1: 0x%X, p2: 0x%X, flags: 0x%X, company: %s, cmd: 0x%X (%s)",
|
SCOPE_INFO_FMT([=], "DoCommand: tile: %X (%d x %d), p1: 0x%X, p2: 0x%X, flags: 0x%X, company: %s, cmd: 0x%X (%s)",
|
||||||
TileX(tile), TileY(tile), p1, p2, flags, scope_dumper().CompanyInfo(_current_company), cmd, GetCommandName(cmd));
|
tile, TileX(tile), TileY(tile), p1, p2, flags, scope_dumper().CompanyInfo(_current_company), cmd, GetCommandName(cmd));
|
||||||
|
|
||||||
CommandCost res;
|
CommandCost res;
|
||||||
|
|
||||||
@@ -745,8 +745,8 @@ bool DoCommandP(const CommandContainer *container, bool my_cmd)
|
|||||||
*/
|
*/
|
||||||
bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback, const char *text, bool my_cmd, uint32 binary_length)
|
bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback, const char *text, bool my_cmd, uint32 binary_length)
|
||||||
{
|
{
|
||||||
SCOPE_INFO_FMT([=], "DoCommandP: tile: %dx%d, p1: 0x%X, p2: 0x%X, company: %s, cmd: 0x%X (%s), my_cmd: %d",
|
SCOPE_INFO_FMT([=], "DoCommandP: tile: %X (%d x %d), p1: 0x%X, p2: 0x%X, company: %s, cmd: 0x%X (%s), my_cmd: %d",
|
||||||
TileX(tile), TileY(tile), p1, p2, scope_dumper().CompanyInfo(_current_company), cmd, GetCommandName(cmd), my_cmd);
|
tile, TileX(tile), TileY(tile), p1, p2, scope_dumper().CompanyInfo(_current_company), cmd, GetCommandName(cmd), my_cmd);
|
||||||
|
|
||||||
/* Cost estimation is generally only done when the
|
/* Cost estimation is generally only done when the
|
||||||
* local user presses shift while doing somthing.
|
* local user presses shift while doing somthing.
|
||||||
|
@@ -54,7 +54,7 @@ static inline bool IsDepotTile(TileIndex tile)
|
|||||||
static inline DepotID GetDepotIndex(TileIndex t)
|
static inline DepotID GetDepotIndex(TileIndex t)
|
||||||
{
|
{
|
||||||
/* Hangars don't have a Depot class, thus store no DepotID. */
|
/* Hangars don't have a Depot class, thus store no DepotID. */
|
||||||
assert(IsRailDepotTile(t) || IsRoadDepotTile(t) || IsShipDepotTile(t));
|
assert_tile(IsRailDepotTile(t) || IsRoadDepotTile(t) || IsShipDepotTile(t), t);
|
||||||
return _m[t].m2;
|
return _m[t].m2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -99,7 +99,7 @@ void ResetIndustries()
|
|||||||
*/
|
*/
|
||||||
IndustryType GetIndustryType(TileIndex tile)
|
IndustryType GetIndustryType(TileIndex tile)
|
||||||
{
|
{
|
||||||
assert(IsTileType(tile, MP_INDUSTRY));
|
assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
||||||
|
|
||||||
const Industry *ind = Industry::GetByTile(tile);
|
const Industry *ind = Industry::GetByTile(tile);
|
||||||
assert(ind != NULL);
|
assert(ind != NULL);
|
||||||
|
@@ -64,7 +64,7 @@ enum IndustryGraphics {
|
|||||||
*/
|
*/
|
||||||
static inline IndustryID GetIndustryIndex(TileIndex t)
|
static inline IndustryID GetIndustryIndex(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_INDUSTRY));
|
assert_tile(IsTileType(t, MP_INDUSTRY), t);
|
||||||
return _m[t].m2;
|
return _m[t].m2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ static inline IndustryID GetIndustryIndex(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline bool IsIndustryCompleted(TileIndex t)
|
static inline bool IsIndustryCompleted(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_INDUSTRY));
|
assert_tile(IsTileType(t, MP_INDUSTRY), t);
|
||||||
return HasBit(_m[t].m1, 7);
|
return HasBit(_m[t].m1, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ IndustryType GetIndustryType(TileIndex tile);
|
|||||||
*/
|
*/
|
||||||
static inline void SetIndustryCompleted(TileIndex tile)
|
static inline void SetIndustryCompleted(TileIndex tile)
|
||||||
{
|
{
|
||||||
assert(IsTileType(tile, MP_INDUSTRY));
|
assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
||||||
SB(_m[tile].m1, 7, 1, 1);
|
SB(_m[tile].m1, 7, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ static inline void SetIndustryCompleted(TileIndex tile)
|
|||||||
*/
|
*/
|
||||||
static inline byte GetIndustryConstructionStage(TileIndex tile)
|
static inline byte GetIndustryConstructionStage(TileIndex tile)
|
||||||
{
|
{
|
||||||
assert(IsTileType(tile, MP_INDUSTRY));
|
assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
||||||
return IsIndustryCompleted(tile) ? (byte)INDUSTRY_COMPLETED : GB(_m[tile].m1, 0, 2);
|
return IsIndustryCompleted(tile) ? (byte)INDUSTRY_COMPLETED : GB(_m[tile].m1, 0, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ static inline byte GetIndustryConstructionStage(TileIndex tile)
|
|||||||
*/
|
*/
|
||||||
static inline void SetIndustryConstructionStage(TileIndex tile, byte value)
|
static inline void SetIndustryConstructionStage(TileIndex tile, byte value)
|
||||||
{
|
{
|
||||||
assert(IsTileType(tile, MP_INDUSTRY));
|
assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
||||||
SB(_m[tile].m1, 0, 2, value);
|
SB(_m[tile].m1, 0, 2, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ static inline void SetIndustryConstructionStage(TileIndex tile, byte value)
|
|||||||
*/
|
*/
|
||||||
static inline IndustryGfx GetCleanIndustryGfx(TileIndex t)
|
static inline IndustryGfx GetCleanIndustryGfx(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_INDUSTRY));
|
assert_tile(IsTileType(t, MP_INDUSTRY), t);
|
||||||
return _m[t].m5 | (GB(_me[t].m6, 2, 1) << 8);
|
return _m[t].m5 | (GB(_me[t].m6, 2, 1) << 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ static inline IndustryGfx GetCleanIndustryGfx(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline IndustryGfx GetIndustryGfx(TileIndex t)
|
static inline IndustryGfx GetIndustryGfx(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_INDUSTRY));
|
assert_tile(IsTileType(t, MP_INDUSTRY), t);
|
||||||
return GetTranslatedIndustryTileID(GetCleanIndustryGfx(t));
|
return GetTranslatedIndustryTileID(GetCleanIndustryGfx(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,7 +150,7 @@ static inline IndustryGfx GetIndustryGfx(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetIndustryGfx(TileIndex t, IndustryGfx gfx)
|
static inline void SetIndustryGfx(TileIndex t, IndustryGfx gfx)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_INDUSTRY));
|
assert_tile(IsTileType(t, MP_INDUSTRY), t);
|
||||||
_m[t].m5 = GB(gfx, 0, 8);
|
_m[t].m5 = GB(gfx, 0, 8);
|
||||||
SB(_me[t].m6, 2, 1, GB(gfx, 8, 1));
|
SB(_me[t].m6, 2, 1, GB(gfx, 8, 1));
|
||||||
}
|
}
|
||||||
@@ -163,7 +163,7 @@ static inline void SetIndustryGfx(TileIndex t, IndustryGfx gfx)
|
|||||||
*/
|
*/
|
||||||
static inline byte GetIndustryConstructionCounter(TileIndex tile)
|
static inline byte GetIndustryConstructionCounter(TileIndex tile)
|
||||||
{
|
{
|
||||||
assert(IsTileType(tile, MP_INDUSTRY));
|
assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
||||||
return GB(_m[tile].m1, 2, 2);
|
return GB(_m[tile].m1, 2, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ static inline byte GetIndustryConstructionCounter(TileIndex tile)
|
|||||||
*/
|
*/
|
||||||
static inline void SetIndustryConstructionCounter(TileIndex tile, byte value)
|
static inline void SetIndustryConstructionCounter(TileIndex tile, byte value)
|
||||||
{
|
{
|
||||||
assert(IsTileType(tile, MP_INDUSTRY));
|
assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
||||||
SB(_m[tile].m1, 2, 2, value);
|
SB(_m[tile].m1, 2, 2, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,7 +188,7 @@ static inline void SetIndustryConstructionCounter(TileIndex tile, byte value)
|
|||||||
*/
|
*/
|
||||||
static inline void ResetIndustryConstructionStage(TileIndex tile)
|
static inline void ResetIndustryConstructionStage(TileIndex tile)
|
||||||
{
|
{
|
||||||
assert(IsTileType(tile, MP_INDUSTRY));
|
assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
||||||
SB(_m[tile].m1, 0, 4, 0);
|
SB(_m[tile].m1, 0, 4, 0);
|
||||||
SB(_m[tile].m1, 7, 1, 0);
|
SB(_m[tile].m1, 7, 1, 0);
|
||||||
}
|
}
|
||||||
@@ -200,7 +200,7 @@ static inline void ResetIndustryConstructionStage(TileIndex tile)
|
|||||||
*/
|
*/
|
||||||
static inline byte GetIndustryAnimationLoop(TileIndex tile)
|
static inline byte GetIndustryAnimationLoop(TileIndex tile)
|
||||||
{
|
{
|
||||||
assert(IsTileType(tile, MP_INDUSTRY));
|
assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
||||||
return _m[tile].m4;
|
return _m[tile].m4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,7 +212,7 @@ static inline byte GetIndustryAnimationLoop(TileIndex tile)
|
|||||||
*/
|
*/
|
||||||
static inline void SetIndustryAnimationLoop(TileIndex tile, byte count)
|
static inline void SetIndustryAnimationLoop(TileIndex tile, byte count)
|
||||||
{
|
{
|
||||||
assert(IsTileType(tile, MP_INDUSTRY));
|
assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
||||||
_m[tile].m4 = count;
|
_m[tile].m4 = count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,7 +225,7 @@ static inline void SetIndustryAnimationLoop(TileIndex tile, byte count)
|
|||||||
*/
|
*/
|
||||||
static inline byte GetIndustryRandomBits(TileIndex tile)
|
static inline byte GetIndustryRandomBits(TileIndex tile)
|
||||||
{
|
{
|
||||||
assert(IsTileType(tile, MP_INDUSTRY));
|
assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
||||||
return _m[tile].m3;
|
return _m[tile].m3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,7 +238,7 @@ static inline byte GetIndustryRandomBits(TileIndex tile)
|
|||||||
*/
|
*/
|
||||||
static inline void SetIndustryRandomBits(TileIndex tile, byte bits)
|
static inline void SetIndustryRandomBits(TileIndex tile, byte bits)
|
||||||
{
|
{
|
||||||
assert(IsTileType(tile, MP_INDUSTRY));
|
assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
||||||
_m[tile].m3 = bits;
|
_m[tile].m3 = bits;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,7 +251,7 @@ static inline void SetIndustryRandomBits(TileIndex tile, byte bits)
|
|||||||
*/
|
*/
|
||||||
static inline byte GetIndustryTriggers(TileIndex tile)
|
static inline byte GetIndustryTriggers(TileIndex tile)
|
||||||
{
|
{
|
||||||
assert(IsTileType(tile, MP_INDUSTRY));
|
assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
||||||
return GB(_me[tile].m6, 3, 3);
|
return GB(_me[tile].m6, 3, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,7 +265,7 @@ static inline byte GetIndustryTriggers(TileIndex tile)
|
|||||||
*/
|
*/
|
||||||
static inline void SetIndustryTriggers(TileIndex tile, byte triggers)
|
static inline void SetIndustryTriggers(TileIndex tile, byte triggers)
|
||||||
{
|
{
|
||||||
assert(IsTileType(tile, MP_INDUSTRY));
|
assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
||||||
SB(_me[tile].m6, 3, 3, triggers);
|
SB(_me[tile].m6, 3, 3, triggers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -243,7 +243,7 @@ uint16 GetAiPurchaseCallbackResult(uint8 feature, CargoID cargo_type, uint8 defa
|
|||||||
*/
|
*/
|
||||||
void AmbientSoundEffectCallback(TileIndex tile)
|
void AmbientSoundEffectCallback(TileIndex tile)
|
||||||
{
|
{
|
||||||
assert(IsTileType(tile, MP_CLEAR) || IsTileType(tile, MP_TREES) || IsTileType(tile, MP_WATER));
|
assert_tile(IsTileType(tile, MP_CLEAR) || IsTileType(tile, MP_TREES) || IsTileType(tile, MP_WATER), tile);
|
||||||
|
|
||||||
/* Only run every 1/200-th time. */
|
/* Only run every 1/200-th time. */
|
||||||
uint32 r; // Save for later
|
uint32 r; // Save for later
|
||||||
|
@@ -154,14 +154,14 @@ void DecreaseBuildingCount(Town *t, HouseID house_id)
|
|||||||
/* virtual */ uint32 HouseScopeResolver::GetRandomBits() const
|
/* virtual */ uint32 HouseScopeResolver::GetRandomBits() const
|
||||||
{
|
{
|
||||||
/* Note: Towns build houses over houses. So during construction checks 'tile' may be a valid but unrelated house. */
|
/* Note: Towns build houses over houses. So during construction checks 'tile' may be a valid but unrelated house. */
|
||||||
assert(IsValidTile(this->tile) && (this->not_yet_constructed || IsTileType(this->tile, MP_HOUSE)));
|
assert_tile(IsValidTile(this->tile) && (this->not_yet_constructed || IsTileType(this->tile, MP_HOUSE)), this->tile);
|
||||||
return this->not_yet_constructed ? this->initial_random_bits : GetHouseRandomBits(this->tile);
|
return this->not_yet_constructed ? this->initial_random_bits : GetHouseRandomBits(this->tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* virtual */ uint32 HouseScopeResolver::GetTriggers() const
|
/* virtual */ uint32 HouseScopeResolver::GetTriggers() const
|
||||||
{
|
{
|
||||||
/* Note: Towns build houses over houses. So during construction checks 'tile' may be a valid but unrelated house. */
|
/* Note: Towns build houses over houses. So during construction checks 'tile' may be a valid but unrelated house. */
|
||||||
assert(IsValidTile(this->tile) && (this->not_yet_constructed || IsTileType(this->tile, MP_HOUSE)));
|
assert_tile(IsValidTile(this->tile) && (this->not_yet_constructed || IsTileType(this->tile, MP_HOUSE)), this->tile);
|
||||||
return this->not_yet_constructed ? 0 : GetHouseTriggers(this->tile);
|
return this->not_yet_constructed ? 0 : GetHouseTriggers(this->tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -735,7 +735,7 @@ bool NewHouseTileLoop(TileIndex tile)
|
|||||||
static void DoTriggerHouse(TileIndex tile, HouseTrigger trigger, byte base_random, bool first)
|
static void DoTriggerHouse(TileIndex tile, HouseTrigger trigger, byte base_random, bool first)
|
||||||
{
|
{
|
||||||
/* We can't trigger a non-existent building... */
|
/* We can't trigger a non-existent building... */
|
||||||
assert(IsTileType(tile, MP_HOUSE));
|
assert_tile(IsTileType(tile, MP_HOUSE), tile);
|
||||||
|
|
||||||
HouseID hid = GetHouseType(tile);
|
HouseID hid = GetHouseType(tile);
|
||||||
HouseSpec *hs = HouseSpec::Get(hid);
|
HouseSpec *hs = HouseSpec::Get(hid);
|
||||||
@@ -806,7 +806,7 @@ void DoWatchedCargoCallback(TileIndex tile, TileIndex origin, CargoTypes trigger
|
|||||||
*/
|
*/
|
||||||
void WatchedCargoCallback(TileIndex tile, CargoTypes trigger_cargoes)
|
void WatchedCargoCallback(TileIndex tile, CargoTypes trigger_cargoes)
|
||||||
{
|
{
|
||||||
assert(IsTileType(tile, MP_HOUSE));
|
assert_tile(IsTileType(tile, MP_HOUSE), tile);
|
||||||
HouseID id = GetHouseType(tile);
|
HouseID id = GetHouseType(tile);
|
||||||
const HouseSpec *hs = HouseSpec::Get(id);
|
const HouseSpec *hs = HouseSpec::Get(id);
|
||||||
|
|
||||||
|
@@ -103,16 +103,16 @@ uint32 GetRelativePosition(TileIndex tile, TileIndex ind_tile)
|
|||||||
|
|
||||||
/* virtual */ uint32 IndustryTileScopeResolver::GetRandomBits() const
|
/* virtual */ uint32 IndustryTileScopeResolver::GetRandomBits() const
|
||||||
{
|
{
|
||||||
assert(this->industry != NULL && IsValidTile(this->tile));
|
assert_tile(this->industry != NULL && IsValidTile(this->tile), this->tile);
|
||||||
assert(this->industry->index == INVALID_INDUSTRY || IsTileType(this->tile, MP_INDUSTRY));
|
assert_tile(this->industry->index == INVALID_INDUSTRY || IsTileType(this->tile, MP_INDUSTRY), this->tile);
|
||||||
|
|
||||||
return (this->industry->index != INVALID_INDUSTRY) ? GetIndustryRandomBits(this->tile) : 0;
|
return (this->industry->index != INVALID_INDUSTRY) ? GetIndustryRandomBits(this->tile) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* virtual */ uint32 IndustryTileScopeResolver::GetTriggers() const
|
/* virtual */ uint32 IndustryTileScopeResolver::GetTriggers() const
|
||||||
{
|
{
|
||||||
assert(this->industry != NULL && IsValidTile(this->tile));
|
assert_tile(this->industry != NULL && IsValidTile(this->tile), this->tile);
|
||||||
assert(this->industry->index == INVALID_INDUSTRY || IsTileType(this->tile, MP_INDUSTRY));
|
assert_tile(this->industry->index == INVALID_INDUSTRY || IsTileType(this->tile, MP_INDUSTRY), this->tile);
|
||||||
if (this->industry->index == INVALID_INDUSTRY) return 0;
|
if (this->industry->index == INVALID_INDUSTRY) return 0;
|
||||||
return GetIndustryTriggers(this->tile);
|
return GetIndustryTriggers(this->tile);
|
||||||
}
|
}
|
||||||
@@ -171,8 +171,8 @@ static void IndustryDrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGro
|
|||||||
|
|
||||||
uint16 GetIndustryTileCallback(CallbackID callback, uint32 param1, uint32 param2, IndustryGfx gfx_id, Industry *industry, TileIndex tile)
|
uint16 GetIndustryTileCallback(CallbackID callback, uint32 param1, uint32 param2, IndustryGfx gfx_id, Industry *industry, TileIndex tile)
|
||||||
{
|
{
|
||||||
assert(industry != NULL && IsValidTile(tile));
|
assert_tile(industry != NULL && IsValidTile(tile), tile);
|
||||||
assert(industry->index == INVALID_INDUSTRY || IsTileType(tile, MP_INDUSTRY));
|
assert_tile(industry->index == INVALID_INDUSTRY || IsTileType(tile, MP_INDUSTRY), tile);
|
||||||
|
|
||||||
IndustryTileResolverObject object(gfx_id, tile, industry, callback, param1, param2);
|
IndustryTileResolverObject object(gfx_id, tile, industry, callback, param1, param2);
|
||||||
return object.ResolveCallback();
|
return object.ResolveCallback();
|
||||||
@@ -300,7 +300,7 @@ bool StartStopIndustryTileAnimation(const Industry *ind, IndustryAnimationTrigge
|
|||||||
*/
|
*/
|
||||||
static void DoTriggerIndustryTile(TileIndex tile, IndustryTileTrigger trigger, Industry *ind, uint32 &reseed_industry)
|
static void DoTriggerIndustryTile(TileIndex tile, IndustryTileTrigger trigger, Industry *ind, uint32 &reseed_industry)
|
||||||
{
|
{
|
||||||
assert(IsValidTile(tile) && IsTileType(tile, MP_INDUSTRY));
|
assert_tile(IsValidTile(tile) && IsTileType(tile, MP_INDUSTRY), tile);
|
||||||
|
|
||||||
IndustryGfx gfx = GetIndustryGfx(tile);
|
IndustryGfx gfx = GetIndustryGfx(tile);
|
||||||
const IndustryTileSpec *itspec = GetIndustryTileSpec(gfx);
|
const IndustryTileSpec *itspec = GetIndustryTileSpec(gfx);
|
||||||
|
@@ -62,7 +62,7 @@ uint16 Object::counts[NUM_OBJECTS];
|
|||||||
*/
|
*/
|
||||||
ObjectType GetObjectType(TileIndex t)
|
ObjectType GetObjectType(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_OBJECT));
|
assert_tile(IsTileType(t, MP_OBJECT), t);
|
||||||
return Object::GetByTile(t)->type;
|
return Object::GetByTile(t)->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -48,7 +48,7 @@ static inline bool IsObjectTypeTile(TileIndex t, ObjectType type)
|
|||||||
*/
|
*/
|
||||||
static inline ObjectID GetObjectIndex(TileIndex t)
|
static inline ObjectID GetObjectIndex(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_OBJECT));
|
assert_tile(IsTileType(t, MP_OBJECT), t);
|
||||||
return _m[t].m2 | _m[t].m5 << 16;
|
return _m[t].m2 | _m[t].m5 << 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ static inline ObjectID GetObjectIndex(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline byte GetObjectRandomBits(TileIndex t)
|
static inline byte GetObjectRandomBits(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_OBJECT));
|
assert_tile(IsTileType(t, MP_OBJECT), t);
|
||||||
return _m[t].m3;
|
return _m[t].m3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -126,8 +126,8 @@ struct CFollowTrackT
|
|||||||
m_old_tile = old_tile;
|
m_old_tile = old_tile;
|
||||||
m_old_td = old_td;
|
m_old_td = old_td;
|
||||||
m_err = EC_NONE;
|
m_err = EC_NONE;
|
||||||
assert(((TrackStatusToTrackdirBits(GetTileTrackStatus(m_old_tile, TT(), IsRoadTT() ? RoadVehicle::From(m_veh)->compatible_roadtypes : 0)) & TrackdirToTrackdirBits(m_old_td)) != 0) ||
|
assert_tile(((TrackStatusToTrackdirBits(GetTileTrackStatus(m_old_tile, TT(), IsRoadTT() ? RoadVehicle::From(m_veh)->compatible_roadtypes : 0)) & TrackdirToTrackdirBits(m_old_td)) != 0) ||
|
||||||
(IsTram() && GetSingleTramBit(m_old_tile) != INVALID_DIAGDIR) || (IsRailTT() && IsRailCustomBridgeHeadTile(m_old_tile))); // Disable the assertion for single tram bits
|
(IsTram() && GetSingleTramBit(m_old_tile) != INVALID_DIAGDIR) || (IsRailTT() && IsRailCustomBridgeHeadTile(m_old_tile)), m_old_td); // Disable the assertion for single tram bits
|
||||||
m_exitdir = TrackdirToExitdir(m_old_td);
|
m_exitdir = TrackdirToExitdir(m_old_td);
|
||||||
if (ForcedReverse()) return true;
|
if (ForcedReverse()) return true;
|
||||||
if (!CanExitOldTile()) return false;
|
if (!CanExitOldTile()) return false;
|
||||||
|
@@ -500,7 +500,7 @@ public:
|
|||||||
end_segment_reason = segment.m_end_segment_reason;
|
end_segment_reason = segment.m_end_segment_reason;
|
||||||
/* We will need also some information about the last signal (if it was red). */
|
/* We will need also some information about the last signal (if it was red). */
|
||||||
if (segment.m_last_signal_tile != INVALID_TILE) {
|
if (segment.m_last_signal_tile != INVALID_TILE) {
|
||||||
assert(HasSignalOnTrackdir(segment.m_last_signal_tile, segment.m_last_signal_td));
|
assert_tile(HasSignalOnTrackdir(segment.m_last_signal_tile, segment.m_last_signal_td), segment.m_last_signal_tile);
|
||||||
SignalState sig_state = GetSignalStateByTrackdir(segment.m_last_signal_tile, segment.m_last_signal_td);
|
SignalState sig_state = GetSignalStateByTrackdir(segment.m_last_signal_tile, segment.m_last_signal_td);
|
||||||
bool is_red = (sig_state == SIGNAL_STATE_RED);
|
bool is_red = (sig_state == SIGNAL_STATE_RED);
|
||||||
n.flags_u.flags_s.m_last_signal_was_red = is_red;
|
n.flags_u.flags_s.m_last_signal_was_red = is_red;
|
||||||
@@ -539,7 +539,7 @@ no_entry_cost: // jump here at the beginning if the node has no parent (it is th
|
|||||||
/* Tests for 'potential target' reasons to close the segment. */
|
/* Tests for 'potential target' reasons to close the segment. */
|
||||||
if (cur.tile == prev.tile) {
|
if (cur.tile == prev.tile) {
|
||||||
/* Penalty for reversing in a depot. */
|
/* Penalty for reversing in a depot. */
|
||||||
assert(IsRailDepot(cur.tile));
|
assert_tile(IsRailDepot(cur.tile), cur.tile);
|
||||||
segment_cost += Yapf().PfGetSettings().rail_depot_reverse_penalty;
|
segment_cost += Yapf().PfGetSettings().rail_depot_reverse_penalty;
|
||||||
|
|
||||||
} else if (IsRailDepotTile(cur.tile)) {
|
} else if (IsRailDepotTile(cur.tile)) {
|
||||||
|
12
src/pbs.cpp
12
src/pbs.cpp
@@ -62,8 +62,8 @@ void SetRailStationPlatformReservation(TileIndex start, DiagDirection dir, bool
|
|||||||
TileIndex tile = start;
|
TileIndex tile = start;
|
||||||
TileIndexDiff diff = TileOffsByDiagDir(dir);
|
TileIndexDiff diff = TileOffsByDiagDir(dir);
|
||||||
|
|
||||||
assert(IsRailStationTile(start));
|
assert_tile(IsRailStationTile(start), start);
|
||||||
assert(GetRailStationAxis(start) == DiagDirToAxis(dir));
|
assert_tile(GetRailStationAxis(start) == DiagDirToAxis(dir), start);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
SetRailStationReservation(tile, b);
|
SetRailStationReservation(tile, b);
|
||||||
@@ -100,8 +100,8 @@ bool TryReserveRailTrackdir(TileIndex tile, Trackdir td, bool trigger_stations)
|
|||||||
*/
|
*/
|
||||||
bool TryReserveRailTrack(TileIndex tile, Track t, bool trigger_stations)
|
bool TryReserveRailTrack(TileIndex tile, Track t, bool trigger_stations)
|
||||||
{
|
{
|
||||||
assert_msg((TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_RAIL, 0)) & TrackToTrackBits(t)) != 0,
|
assert_msg_tile((TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_RAIL, 0)) & TrackToTrackBits(t)) != 0, tile,
|
||||||
"%X, %X, %X, %X", TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_RAIL, 0)), tile, t, TrackToTrackBits(t));
|
"%X, %X, %X", TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_RAIL, 0)), t, TrackToTrackBits(t));
|
||||||
|
|
||||||
if (_settings_client.gui.show_track_reservation) {
|
if (_settings_client.gui.show_track_reservation) {
|
||||||
/* show the reserved rail if needed */
|
/* show the reserved rail if needed */
|
||||||
@@ -196,7 +196,7 @@ void UnreserveRailTrackdir(TileIndex tile, Trackdir td)
|
|||||||
*/
|
*/
|
||||||
void UnreserveRailTrack(TileIndex tile, Track t)
|
void UnreserveRailTrack(TileIndex tile, Track t)
|
||||||
{
|
{
|
||||||
assert(TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_RAIL, 0)) & TrackToTrackBits(t));
|
assert_msg_tile(TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_RAIL, 0)) & TrackToTrackBits(t), tile, "track: %u", t);
|
||||||
|
|
||||||
if (_settings_client.gui.show_track_reservation) {
|
if (_settings_client.gui.show_track_reservation) {
|
||||||
if (IsBridgeTile(tile)) {
|
if (IsBridgeTile(tile)) {
|
||||||
@@ -403,7 +403,7 @@ PBSTileInfo FollowTrainReservation(const Train *v, Vehicle **train_on_res)
|
|||||||
*/
|
*/
|
||||||
Train *GetTrainForReservation(TileIndex tile, Track track)
|
Train *GetTrainForReservation(TileIndex tile, Track track)
|
||||||
{
|
{
|
||||||
assert(HasReservedTracks(tile, TrackToTrackBits(track)));
|
assert_msg_tile(HasReservedTracks(tile, TrackToTrackBits(track)), tile, "track: %u", track);
|
||||||
Trackdir trackdir = TrackToTrackdir(track);
|
Trackdir trackdir = TrackToTrackdir(track);
|
||||||
|
|
||||||
RailTypes rts = GetRailTypeInfo(GetTileRailType(tile))->compatible_railtypes;
|
RailTypes rts = GetRailTypeInfo(GetTileRailType(tile))->compatible_railtypes;
|
||||||
|
@@ -862,7 +862,7 @@ CommandCost CmdRemoveSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
|||||||
*/
|
*/
|
||||||
bool FloodHalftile(TileIndex t)
|
bool FloodHalftile(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsPlainRailTile(t));
|
assert_tile(IsPlainRailTile(t), t);
|
||||||
|
|
||||||
bool flooded = false;
|
bool flooded = false;
|
||||||
if (GetRailGroundType(t) == RAIL_GROUND_WATER) return flooded;
|
if (GetRailGroundType(t) == RAIL_GROUND_WATER) return flooded;
|
||||||
|
@@ -37,7 +37,7 @@ enum RailTileType {
|
|||||||
*/
|
*/
|
||||||
static inline RailTileType GetRailTileType(TileIndex t)
|
static inline RailTileType GetRailTileType(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_RAILWAY));
|
assert_tile(IsTileType(t, MP_RAILWAY), t);
|
||||||
return (RailTileType)GB(_m[t].m5, 6, 2);
|
return (RailTileType)GB(_m[t].m5, 6, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ static inline bool HasSignals(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetHasSignals(TileIndex tile, bool signals)
|
static inline void SetHasSignals(TileIndex tile, bool signals)
|
||||||
{
|
{
|
||||||
assert(IsPlainRailTile(tile));
|
assert_tile(IsPlainRailTile(tile), tile);
|
||||||
SB(_m[tile].m5, 6, 1, signals);
|
SB(_m[tile].m5, 6, 1, signals);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ static inline void SetRailType(TileIndex t, RailType r)
|
|||||||
*/
|
*/
|
||||||
static inline TrackBits GetTrackBits(TileIndex tile)
|
static inline TrackBits GetTrackBits(TileIndex tile)
|
||||||
{
|
{
|
||||||
assert(IsPlainRailTile(tile));
|
assert_tile(IsPlainRailTile(tile), tile);
|
||||||
return (TrackBits)GB(_m[tile].m5, 0, 6);
|
return (TrackBits)GB(_m[tile].m5, 0, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,7 +149,7 @@ static inline TrackBits GetTrackBits(TileIndex tile)
|
|||||||
*/
|
*/
|
||||||
static inline void SetTrackBits(TileIndex t, TrackBits b)
|
static inline void SetTrackBits(TileIndex t, TrackBits b)
|
||||||
{
|
{
|
||||||
assert(IsPlainRailTile(t));
|
assert_tile(IsPlainRailTile(t), t);
|
||||||
SB(_m[t].m5, 0, 6, b);
|
SB(_m[t].m5, 0, 6, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,7 +196,7 @@ static inline Track GetRailDepotTrack(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline TrackBits GetRailReservationTrackBits(TileIndex t)
|
static inline TrackBits GetRailReservationTrackBits(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsPlainRailTile(t));
|
assert_tile(IsPlainRailTile(t), t);
|
||||||
byte track_b = GB(_m[t].m2, 8, 3);
|
byte track_b = GB(_m[t].m2, 8, 3);
|
||||||
Track track = (Track)(track_b - 1); // map array saves Track+1
|
Track track = (Track)(track_b - 1); // map array saves Track+1
|
||||||
if (track_b == 0) return TRACK_BIT_NONE;
|
if (track_b == 0) return TRACK_BIT_NONE;
|
||||||
@@ -211,7 +211,7 @@ static inline TrackBits GetRailReservationTrackBits(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetTrackReservation(TileIndex t, TrackBits b)
|
static inline void SetTrackReservation(TileIndex t, TrackBits b)
|
||||||
{
|
{
|
||||||
assert(IsPlainRailTile(t));
|
assert_tile(IsPlainRailTile(t), t);
|
||||||
assert(b != INVALID_TRACK_BIT);
|
assert(b != INVALID_TRACK_BIT);
|
||||||
assert(!TracksOverlap(b));
|
assert(!TracksOverlap(b));
|
||||||
Track track = RemoveFirstTrack(&b);
|
Track track = RemoveFirstTrack(&b);
|
||||||
@@ -228,7 +228,7 @@ static inline void SetTrackReservation(TileIndex t, TrackBits b)
|
|||||||
*/
|
*/
|
||||||
static inline bool TryReserveTrack(TileIndex tile, Track t)
|
static inline bool TryReserveTrack(TileIndex tile, Track t)
|
||||||
{
|
{
|
||||||
assert(HasTrack(tile, t));
|
assert_tile(HasTrack(tile, t), tile);
|
||||||
TrackBits bits = TrackToTrackBits(t);
|
TrackBits bits = TrackToTrackBits(t);
|
||||||
TrackBits res = GetRailReservationTrackBits(tile);
|
TrackBits res = GetRailReservationTrackBits(tile);
|
||||||
if ((res & bits) != TRACK_BIT_NONE) return false; // already reserved
|
if ((res & bits) != TRACK_BIT_NONE) return false; // already reserved
|
||||||
@@ -246,7 +246,7 @@ static inline bool TryReserveTrack(TileIndex tile, Track t)
|
|||||||
*/
|
*/
|
||||||
static inline void UnreserveTrack(TileIndex tile, Track t)
|
static inline void UnreserveTrack(TileIndex tile, Track t)
|
||||||
{
|
{
|
||||||
assert(HasTrack(tile, t));
|
assert_tile(HasTrack(tile, t), tile);
|
||||||
TrackBits res = GetRailReservationTrackBits(tile);
|
TrackBits res = GetRailReservationTrackBits(tile);
|
||||||
res &= ~TrackToTrackBits(t);
|
res &= ~TrackToTrackBits(t);
|
||||||
SetTrackReservation(tile, res);
|
SetTrackReservation(tile, res);
|
||||||
@@ -260,7 +260,7 @@ static inline void UnreserveTrack(TileIndex tile, Track t)
|
|||||||
*/
|
*/
|
||||||
static inline bool HasDepotReservation(TileIndex t)
|
static inline bool HasDepotReservation(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsRailDepot(t));
|
assert_tile(IsRailDepot(t), t);
|
||||||
return HasBit(_m[t].m5, 4);
|
return HasBit(_m[t].m5, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,7 +272,7 @@ static inline bool HasDepotReservation(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetDepotReservation(TileIndex t, bool b)
|
static inline void SetDepotReservation(TileIndex t, bool b)
|
||||||
{
|
{
|
||||||
assert(IsRailDepot(t));
|
assert_tile(IsRailDepot(t), t);
|
||||||
SB(_m[t].m5, 4, 1, (byte)b);
|
SB(_m[t].m5, 4, 1, (byte)b);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,14 +289,14 @@ static inline TrackBits GetDepotReservationTrackBits(TileIndex t)
|
|||||||
|
|
||||||
static inline SignalType GetSignalType(TileIndex t, Track track)
|
static inline SignalType GetSignalType(TileIndex t, Track track)
|
||||||
{
|
{
|
||||||
assert(GetRailTileType(t) == RAIL_TILE_SIGNALS);
|
assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t);
|
||||||
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 0;
|
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 0;
|
||||||
return (SignalType)GB(_m[t].m2, pos, 3);
|
return (SignalType)GB(_m[t].m2, pos, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void SetSignalType(TileIndex t, Track track, SignalType s)
|
static inline void SetSignalType(TileIndex t, Track track, SignalType s)
|
||||||
{
|
{
|
||||||
assert(GetRailTileType(t) == RAIL_TILE_SIGNALS);
|
assert_tile(GetRailTileType(t) == RAIL_TILE_SIGNALS, t);
|
||||||
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 0;
|
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 0;
|
||||||
SB(_m[t].m2, pos, 3, s);
|
SB(_m[t].m2, pos, 3, s);
|
||||||
if (track == INVALID_TRACK) SB(_m[t].m2, 4, 3, s);
|
if (track == INVALID_TRACK) SB(_m[t].m2, 4, 3, s);
|
||||||
@@ -445,7 +445,7 @@ static inline bool HasSignalOnTrackdir(TileIndex tile, Trackdir trackdir)
|
|||||||
static inline SignalState GetSignalStateByTrackdir(TileIndex tile, Trackdir trackdir)
|
static inline SignalState GetSignalStateByTrackdir(TileIndex tile, Trackdir trackdir)
|
||||||
{
|
{
|
||||||
assert(IsValidTrackdir(trackdir));
|
assert(IsValidTrackdir(trackdir));
|
||||||
assert(HasSignalOnTrack(tile, TrackdirToTrack(trackdir)));
|
assert_tile(HasSignalOnTrack(tile, TrackdirToTrack(trackdir)), tile);
|
||||||
return GetSignalStates(tile) & SignalAlongTrackdir(trackdir) ?
|
return GetSignalStates(tile) & SignalAlongTrackdir(trackdir) ?
|
||||||
SIGNAL_STATE_GREEN : SIGNAL_STATE_RED;
|
SIGNAL_STATE_GREEN : SIGNAL_STATE_RED;
|
||||||
}
|
}
|
||||||
@@ -498,7 +498,7 @@ static inline bool HasOnewaySignalBlockingTrackdir(TileIndex tile, Trackdir td)
|
|||||||
*/
|
*/
|
||||||
static inline bool IsRestrictedSignal(TileIndex tile)
|
static inline bool IsRestrictedSignal(TileIndex tile)
|
||||||
{
|
{
|
||||||
assert(GetRailTileType(tile) == RAIL_TILE_SIGNALS);
|
assert_tile(GetRailTileType(tile) == RAIL_TILE_SIGNALS, tile);
|
||||||
return (bool) GB(_m[tile].m2, 12, 1);
|
return (bool) GB(_m[tile].m2, 12, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -508,7 +508,7 @@ static inline bool IsRestrictedSignal(TileIndex tile)
|
|||||||
*/
|
*/
|
||||||
static inline void SetRestrictedSignal(TileIndex tile, bool is_restricted)
|
static inline void SetRestrictedSignal(TileIndex tile, bool is_restricted)
|
||||||
{
|
{
|
||||||
assert(GetRailTileType(tile) == RAIL_TILE_SIGNALS);
|
assert_tile(GetRailTileType(tile) == RAIL_TILE_SIGNALS, tile);
|
||||||
SB(_m[tile].m2, 12, 1, is_restricted);
|
SB(_m[tile].m2, 12, 1, is_restricted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -296,7 +296,7 @@ static CommandCost RemoveRoad(TileIndex tile, DoCommandFlag flags, RoadBits piec
|
|||||||
DirtyAllCompanyInfrastructureWindows();
|
DirtyAllCompanyInfrastructureWindows();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
assert(IsDriveThroughStopTile(tile));
|
assert_tile(IsDriveThroughStopTile(tile), tile);
|
||||||
cost.AddCost(_price[PR_CLEAR_ROAD] * 2);
|
cost.AddCost(_price[PR_CLEAR_ROAD] * 2);
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
Company *c = Company::GetIfValid(GetRoadOwner(tile, rt));
|
Company *c = Company::GetIfValid(GetRoadOwner(tile, rt));
|
||||||
@@ -903,7 +903,7 @@ do_clear:;
|
|||||||
}
|
}
|
||||||
|
|
||||||
case MP_STATION:
|
case MP_STATION:
|
||||||
assert(IsDriveThroughStopTile(tile));
|
assert_tile(IsDriveThroughStopTile(tile), tile);
|
||||||
SetRoadTypes(tile, GetRoadTypes(tile) | RoadTypeToRoadTypes(rt));
|
SetRoadTypes(tile, GetRoadTypes(tile) | RoadTypeToRoadTypes(rt));
|
||||||
SetRoadOwner(tile, rt, company);
|
SetRoadOwner(tile, rt, company);
|
||||||
break;
|
break;
|
||||||
|
@@ -34,7 +34,7 @@ enum RoadTileType {
|
|||||||
*/
|
*/
|
||||||
static inline RoadTileType GetRoadTileType(TileIndex t)
|
static inline RoadTileType GetRoadTileType(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_ROAD));
|
assert_tile(IsTileType(t, MP_ROAD), t);
|
||||||
return (RoadTileType)GB(_m[t].m5, 6, 2);
|
return (RoadTileType)GB(_m[t].m5, 6, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ static inline bool IsRoadDepotTile(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline RoadBits GetRoadBits(TileIndex t, RoadType rt)
|
static inline RoadBits GetRoadBits(TileIndex t, RoadType rt)
|
||||||
{
|
{
|
||||||
assert(IsNormalRoad(t));
|
assert_tile(IsNormalRoad(t), t);
|
||||||
switch (rt) {
|
switch (rt) {
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
case ROADTYPE_ROAD: return (RoadBits)GB(_m[t].m5, 0, 4);
|
case ROADTYPE_ROAD: return (RoadBits)GB(_m[t].m5, 0, 4);
|
||||||
@@ -150,7 +150,7 @@ static inline RoadBits GetAllRoadBits(TileIndex tile)
|
|||||||
*/
|
*/
|
||||||
static inline void SetRoadBits(TileIndex t, RoadBits r, RoadType rt)
|
static inline void SetRoadBits(TileIndex t, RoadBits r, RoadType rt)
|
||||||
{
|
{
|
||||||
assert(IsNormalRoad(t)); // XXX incomplete
|
assert_tile(IsNormalRoad(t), t); // XXX incomplete
|
||||||
switch (rt) {
|
switch (rt) {
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
case ROADTYPE_ROAD: SB(_m[t].m5, 0, 4, r); break;
|
case ROADTYPE_ROAD: SB(_m[t].m5, 0, 4, r); break;
|
||||||
@@ -175,7 +175,7 @@ static inline RoadTypes GetRoadTypes(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetRoadTypes(TileIndex t, RoadTypes rt)
|
static inline void SetRoadTypes(TileIndex t, RoadTypes rt)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_ROAD) || IsTileType(t, MP_STATION) || IsTileType(t, MP_TUNNELBRIDGE));
|
assert_tile(IsTileType(t, MP_ROAD) || IsTileType(t, MP_STATION) || IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
SB(_me[t].m7, 6, 2, rt);
|
SB(_me[t].m7, 6, 2, rt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,7 +198,7 @@ static inline bool HasTileRoadType(TileIndex t, RoadType rt)
|
|||||||
*/
|
*/
|
||||||
static inline Owner GetRoadOwner(TileIndex t, RoadType rt)
|
static inline Owner GetRoadOwner(TileIndex t, RoadType rt)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_ROAD) || IsTileType(t, MP_STATION) || IsTileType(t, MP_TUNNELBRIDGE));
|
assert_tile(IsTileType(t, MP_ROAD) || IsTileType(t, MP_STATION) || IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
switch (rt) {
|
switch (rt) {
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
case ROADTYPE_ROAD: return (Owner)GB(IsNormalRoadTile(t) ? _m[t].m1 : _me[t].m7, 0, 5);
|
case ROADTYPE_ROAD: return (Owner)GB(IsNormalRoadTile(t) ? _m[t].m1 : _me[t].m7, 0, 5);
|
||||||
@@ -236,7 +236,7 @@ static inline void SetRoadOwner(TileIndex t, RoadType rt, Owner o)
|
|||||||
*/
|
*/
|
||||||
static inline bool IsRoadOwner(TileIndex t, RoadType rt, Owner o)
|
static inline bool IsRoadOwner(TileIndex t, RoadType rt, Owner o)
|
||||||
{
|
{
|
||||||
assert(HasTileRoadType(t, rt));
|
assert_tile(HasTileRoadType(t, rt), t);
|
||||||
return (GetRoadOwner(t, rt) == o);
|
return (GetRoadOwner(t, rt) == o);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,7 +270,7 @@ template <> struct EnumPropsT<DisallowedRoadDirections> : MakeEnumPropsT<Disallo
|
|||||||
*/
|
*/
|
||||||
static inline DisallowedRoadDirections GetDisallowedRoadDirections(TileIndex t)
|
static inline DisallowedRoadDirections GetDisallowedRoadDirections(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsNormalRoad(t));
|
assert_tile(IsNormalRoad(t), t);
|
||||||
return (DisallowedRoadDirections)GB(_m[t].m5, 4, 2);
|
return (DisallowedRoadDirections)GB(_m[t].m5, 4, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,7 +281,7 @@ static inline DisallowedRoadDirections GetDisallowedRoadDirections(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetDisallowedRoadDirections(TileIndex t, DisallowedRoadDirections drd)
|
static inline void SetDisallowedRoadDirections(TileIndex t, DisallowedRoadDirections drd)
|
||||||
{
|
{
|
||||||
assert(IsNormalRoad(t));
|
assert_tile(IsNormalRoad(t), t);
|
||||||
assert(drd < DRD_END);
|
assert(drd < DRD_END);
|
||||||
SB(_m[t].m5, 4, 2, drd);
|
SB(_m[t].m5, 4, 2, drd);
|
||||||
}
|
}
|
||||||
@@ -294,7 +294,7 @@ static inline void SetDisallowedRoadDirections(TileIndex t, DisallowedRoadDirect
|
|||||||
*/
|
*/
|
||||||
static inline Axis GetCrossingRoadAxis(TileIndex t)
|
static inline Axis GetCrossingRoadAxis(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsLevelCrossing(t));
|
assert_tile(IsLevelCrossing(t), t);
|
||||||
return (Axis)GB(_m[t].m5, 0, 1);
|
return (Axis)GB(_m[t].m5, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,7 +306,7 @@ static inline Axis GetCrossingRoadAxis(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline Axis GetCrossingRailAxis(TileIndex t)
|
static inline Axis GetCrossingRailAxis(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsLevelCrossing(t));
|
assert_tile(IsLevelCrossing(t), t);
|
||||||
return OtherAxis((Axis)GetCrossingRoadAxis(t));
|
return OtherAxis((Axis)GetCrossingRoadAxis(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -349,7 +349,7 @@ static inline TrackBits GetCrossingRailBits(TileIndex tile)
|
|||||||
*/
|
*/
|
||||||
static inline bool HasCrossingReservation(TileIndex t)
|
static inline bool HasCrossingReservation(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsLevelCrossingTile(t));
|
assert_tile(IsLevelCrossingTile(t), t);
|
||||||
return HasBit(_m[t].m5, 4);
|
return HasBit(_m[t].m5, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -362,7 +362,7 @@ static inline bool HasCrossingReservation(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetCrossingReservation(TileIndex t, bool b)
|
static inline void SetCrossingReservation(TileIndex t, bool b)
|
||||||
{
|
{
|
||||||
assert(IsLevelCrossingTile(t));
|
assert_tile(IsLevelCrossingTile(t), t);
|
||||||
SB(_m[t].m5, 4, 1, b ? 1 : 0);
|
SB(_m[t].m5, 4, 1, b ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -385,7 +385,7 @@ static inline TrackBits GetCrossingReservationTrackBits(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline bool IsCrossingBarred(TileIndex t)
|
static inline bool IsCrossingBarred(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsLevelCrossing(t));
|
assert_tile(IsLevelCrossing(t), t);
|
||||||
return HasBit(_m[t].m5, 5);
|
return HasBit(_m[t].m5, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -397,7 +397,7 @@ static inline bool IsCrossingBarred(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetCrossingBarred(TileIndex t, bool barred)
|
static inline void SetCrossingBarred(TileIndex t, bool barred)
|
||||||
{
|
{
|
||||||
assert(IsLevelCrossing(t));
|
assert_tile(IsLevelCrossing(t), t);
|
||||||
SB(_m[t].m5, 5, 1, barred ? 1 : 0);
|
SB(_m[t].m5, 5, 1, barred ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -409,7 +409,7 @@ static inline void SetCrossingBarred(TileIndex t, bool barred)
|
|||||||
*/
|
*/
|
||||||
static inline bool IsCrossingPossiblyOccupiedByRoadVehicle(TileIndex t)
|
static inline bool IsCrossingPossiblyOccupiedByRoadVehicle(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsLevelCrossing(t));
|
assert_tile(IsLevelCrossing(t), t);
|
||||||
return HasBit(_m[t].m5, 1);
|
return HasBit(_m[t].m5, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -421,7 +421,7 @@ static inline bool IsCrossingPossiblyOccupiedByRoadVehicle(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetCrossingOccupiedByRoadVehicle(TileIndex t, bool occupied)
|
static inline void SetCrossingOccupiedByRoadVehicle(TileIndex t, bool occupied)
|
||||||
{
|
{
|
||||||
assert(IsLevelCrossing(t));
|
assert_tile(IsLevelCrossing(t), t);
|
||||||
SB(_m[t].m5, 1, 1, occupied ? 1 : 0);
|
SB(_m[t].m5, 1, 1, occupied ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -509,7 +509,7 @@ static inline bool IncreaseRoadWorksCounter(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void StartRoadWorks(TileIndex t)
|
static inline void StartRoadWorks(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(!HasRoadWorks(t));
|
assert_tile(!HasRoadWorks(t), t);
|
||||||
/* Remove any trees or lamps in case or roadwork */
|
/* Remove any trees or lamps in case or roadwork */
|
||||||
switch (GetRoadside(t)) {
|
switch (GetRoadside(t)) {
|
||||||
case ROADSIDE_BARREN:
|
case ROADSIDE_BARREN:
|
||||||
@@ -525,7 +525,7 @@ static inline void StartRoadWorks(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void TerminateRoadWorks(TileIndex t)
|
static inline void TerminateRoadWorks(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(HasRoadWorks(t));
|
assert_tile(HasRoadWorks(t), t);
|
||||||
SetRoadside(t, (Roadside)(GetRoadside(t) - ROADSIDE_GRASS_ROAD_WORKS + ROADSIDE_GRASS));
|
SetRoadside(t, (Roadside)(GetRoadside(t) - ROADSIDE_GRASS_ROAD_WORKS + ROADSIDE_GRASS));
|
||||||
/* Stop the counter */
|
/* Stop the counter */
|
||||||
SB(_me[t].m7, 0, 4, 0);
|
SB(_me[t].m7, 0, 4, 0);
|
||||||
@@ -539,7 +539,7 @@ static inline void TerminateRoadWorks(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline DiagDirection GetRoadDepotDirection(TileIndex t)
|
static inline DiagDirection GetRoadDepotDirection(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsRoadDepot(t));
|
assert_tile(IsRoadDepot(t), t);
|
||||||
return (DiagDirection)GB(_m[t].m5, 0, 2);
|
return (DiagDirection)GB(_m[t].m5, 0, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2264,7 +2264,7 @@ bool AfterLoadGame()
|
|||||||
} else {
|
} else {
|
||||||
/* We're at an offset, so get the ID from our "root". */
|
/* We're at an offset, so get the ID from our "root". */
|
||||||
TileIndex northern_tile = t - TileXY(GB(offset, 0, 4), GB(offset, 4, 4));
|
TileIndex northern_tile = t - TileXY(GB(offset, 0, 4), GB(offset, 4, 4));
|
||||||
assert(IsTileType(northern_tile, MP_OBJECT));
|
assert_tile(IsTileType(northern_tile, MP_OBJECT), northern_tile);
|
||||||
_m[t].m2 = _m[northern_tile].m2;
|
_m[t].m2 = _m[northern_tile].m2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -51,11 +51,11 @@ WaterClass GetEffectiveWaterClass(TileIndex tile)
|
|||||||
{
|
{
|
||||||
if (HasTileWaterClass(tile)) return GetWaterClass(tile);
|
if (HasTileWaterClass(tile)) return GetWaterClass(tile);
|
||||||
if (IsTileType(tile, MP_TUNNELBRIDGE)) {
|
if (IsTileType(tile, MP_TUNNELBRIDGE)) {
|
||||||
assert(GetTunnelBridgeTransportType(tile) == TRANSPORT_WATER);
|
assert_tile(GetTunnelBridgeTransportType(tile) == TRANSPORT_WATER, tile);
|
||||||
return WATER_CLASS_CANAL;
|
return WATER_CLASS_CANAL;
|
||||||
}
|
}
|
||||||
if (IsTileType(tile, MP_RAILWAY)) {
|
if (IsTileType(tile, MP_RAILWAY)) {
|
||||||
assert(GetRailGroundType(tile) == RAIL_GROUND_WATER);
|
assert_tile(GetRailGroundType(tile) == RAIL_GROUND_WATER, tile);
|
||||||
return WATER_CLASS_SEA;
|
return WATER_CLASS_SEA;
|
||||||
}
|
}
|
||||||
NOT_REACHED();
|
NOT_REACHED();
|
||||||
|
@@ -526,7 +526,7 @@ static void UpdateSignalsAroundSegment(SigInfo info)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(HasSignalOnTrackdir(tile, trackdir));
|
assert_msg_tile(HasSignalOnTrackdir(tile, trackdir), tile, "trackdir: %u", trackdir);
|
||||||
|
|
||||||
track = TrackdirToTrack(trackdir);
|
track = TrackdirToTrack(trackdir);
|
||||||
SignalType sig = GetSignalType(tile, track);
|
SignalType sig = GetSignalType(tile, track);
|
||||||
@@ -628,7 +628,7 @@ static SigSegState UpdateSignalsInBuffer(Owner owner)
|
|||||||
switch (GetTileType(tile)) {
|
switch (GetTileType(tile)) {
|
||||||
case MP_TUNNELBRIDGE: {
|
case MP_TUNNELBRIDGE: {
|
||||||
/* 'optimization assert' - do not try to update signals when it is not needed */
|
/* 'optimization assert' - do not try to update signals when it is not needed */
|
||||||
assert(GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL);
|
assert_tile(GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL, tile);
|
||||||
if (IsTunnel(tile)) assert(dir == INVALID_DIAGDIR || dir == ReverseDiagDir(GetTunnelBridgeDirection(tile)));
|
if (IsTunnel(tile)) assert(dir == INVALID_DIAGDIR || dir == ReverseDiagDir(GetTunnelBridgeDirection(tile)));
|
||||||
TrackBits across = GetAcrossTunnelBridgeTrackBits(tile);
|
TrackBits across = GetAcrossTunnelBridgeTrackBits(tile);
|
||||||
if (dir == INVALID_DIAGDIR || _enterdir_to_trackbits[dir] & across) {
|
if (dir == INVALID_DIAGDIR || _enterdir_to_trackbits[dir] & across) {
|
||||||
|
@@ -230,7 +230,7 @@ void Station::MarkTilesDirty(bool cargo_change) const
|
|||||||
|
|
||||||
/* virtual */ uint Station::GetPlatformLength(TileIndex tile) const
|
/* virtual */ uint Station::GetPlatformLength(TileIndex tile) const
|
||||||
{
|
{
|
||||||
assert(this->TileBelongsToRailStation(tile));
|
assert_tile(this->TileBelongsToRailStation(tile), tile);
|
||||||
|
|
||||||
TileIndexDiff delta = (GetRailStationAxis(tile) == AXIS_X ? TileDiffXY(1, 0) : TileDiffXY(0, 1));
|
TileIndexDiff delta = (GetRailStationAxis(tile) == AXIS_X ? TileDiffXY(1, 0) : TileDiffXY(0, 1));
|
||||||
|
|
||||||
@@ -254,7 +254,7 @@ void Station::MarkTilesDirty(bool cargo_change) const
|
|||||||
{
|
{
|
||||||
TileIndex start_tile = tile;
|
TileIndex start_tile = tile;
|
||||||
uint length = 0;
|
uint length = 0;
|
||||||
assert(IsRailStationTile(tile));
|
assert_tile(IsRailStationTile(tile), tile);
|
||||||
assert(dir < DIAGDIR_END);
|
assert(dir < DIAGDIR_END);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
@@ -75,7 +75,7 @@
|
|||||||
*/
|
*/
|
||||||
bool IsHangar(TileIndex t)
|
bool IsHangar(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_STATION));
|
assert_tile(IsTileType(t, MP_STATION), t);
|
||||||
|
|
||||||
/* If the tile isn't an airport there's no chance it's a hangar. */
|
/* If the tile isn't an airport there's no chance it's a hangar. */
|
||||||
if (!IsAirport(t)) return false;
|
if (!IsAirport(t)) return false;
|
||||||
@@ -3010,7 +3010,7 @@ draw_default_foundation:
|
|||||||
if (ti->tileh == SLOPE_FLAT) {
|
if (ti->tileh == SLOPE_FLAT) {
|
||||||
DrawWaterClassGround(ti);
|
DrawWaterClassGround(ti);
|
||||||
} else {
|
} else {
|
||||||
assert(IsDock(ti->tile));
|
assert_tile(IsDock(ti->tile), ti->tile);
|
||||||
TileIndex water_tile = ti->tile + TileOffsByDiagDir(GetDockDirection(ti->tile));
|
TileIndex water_tile = ti->tile + TileOffsByDiagDir(GetDockDirection(ti->tile));
|
||||||
WaterClass wc = GetWaterClass(water_tile);
|
WaterClass wc = GetWaterClass(water_tile);
|
||||||
if (wc == WATER_CLASS_SEA) {
|
if (wc == WATER_CLASS_SEA) {
|
||||||
@@ -4075,7 +4075,7 @@ void BuildOilRig(TileIndex tile)
|
|||||||
|
|
||||||
st->string_id = GenerateStationName(st, tile, STATIONNAMING_OILRIG);
|
st->string_id = GenerateStationName(st, tile, STATIONNAMING_OILRIG);
|
||||||
|
|
||||||
assert(IsTileType(tile, MP_INDUSTRY));
|
assert_tile(IsTileType(tile, MP_INDUSTRY), tile);
|
||||||
DeleteAnimatedTile(tile);
|
DeleteAnimatedTile(tile);
|
||||||
MakeOilrig(tile, st->index, GetWaterClass(tile));
|
MakeOilrig(tile, st->index, GetWaterClass(tile));
|
||||||
|
|
||||||
@@ -4192,7 +4192,7 @@ static void ChangeTileOwner_Station(TileIndex tile, Owner old_owner, Owner new_o
|
|||||||
if (IsDriveThroughStopTile(tile)) {
|
if (IsDriveThroughStopTile(tile)) {
|
||||||
/* Remove the drive-through road stop */
|
/* Remove the drive-through road stop */
|
||||||
DoCommand(tile, 1 | 1 << 8, (GetStationType(tile) == STATION_TRUCK) ? ROADSTOP_TRUCK : ROADSTOP_BUS, DC_EXEC | DC_BANKRUPT, CMD_REMOVE_ROAD_STOP);
|
DoCommand(tile, 1 | 1 << 8, (GetStationType(tile) == STATION_TRUCK) ? ROADSTOP_TRUCK : ROADSTOP_BUS, DC_EXEC | DC_BANKRUPT, CMD_REMOVE_ROAD_STOP);
|
||||||
assert(IsTileType(tile, MP_ROAD));
|
assert_tile(IsTileType(tile, MP_ROAD), tile);
|
||||||
/* Change owner of tile and all roadtypes */
|
/* Change owner of tile and all roadtypes */
|
||||||
ChangeTileOwner(tile, old_owner, new_owner);
|
ChangeTileOwner(tile, old_owner, new_owner);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -28,7 +28,7 @@ typedef byte StationGfx; ///< Index of station graphics. @see _station_display_d
|
|||||||
*/
|
*/
|
||||||
static inline StationID GetStationIndex(TileIndex t)
|
static inline StationID GetStationIndex(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_STATION));
|
assert_tile(IsTileType(t, MP_STATION), t);
|
||||||
return (StationID)_m[t].m2;
|
return (StationID)_m[t].m2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ static const int GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET = 4; ///< The offset for the
|
|||||||
*/
|
*/
|
||||||
static inline StationType GetStationType(TileIndex t)
|
static inline StationType GetStationType(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_STATION));
|
assert_tile(IsTileType(t, MP_STATION), t);
|
||||||
return (StationType)GB(_me[t].m6, 3, 3);
|
return (StationType)GB(_me[t].m6, 3, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ static inline StationType GetStationType(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline RoadStopType GetRoadStopType(TileIndex t)
|
static inline RoadStopType GetRoadStopType(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(GetStationType(t) == STATION_TRUCK || GetStationType(t) == STATION_BUS);
|
assert_tile(GetStationType(t) == STATION_TRUCK || GetStationType(t) == STATION_BUS, t);
|
||||||
return GetStationType(t) == STATION_TRUCK ? ROADSTOP_TRUCK : ROADSTOP_BUS;
|
return GetStationType(t) == STATION_TRUCK ? ROADSTOP_TRUCK : ROADSTOP_BUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ static inline RoadStopType GetRoadStopType(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline StationGfx GetStationGfx(TileIndex t)
|
static inline StationGfx GetStationGfx(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_STATION));
|
assert_tile(IsTileType(t, MP_STATION), t);
|
||||||
return _m[t].m5;
|
return _m[t].m5;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ static inline StationGfx GetStationGfx(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetStationGfx(TileIndex t, StationGfx gfx)
|
static inline void SetStationGfx(TileIndex t, StationGfx gfx)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_STATION));
|
assert_tile(IsTileType(t, MP_STATION), t);
|
||||||
_m[t].m5 = gfx;
|
_m[t].m5 = gfx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,7 +202,7 @@ static inline bool IsBusStop(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline bool IsRoadStop(TileIndex t)
|
static inline bool IsRoadStop(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_STATION));
|
assert_tile(IsTileType(t, MP_STATION), t);
|
||||||
return IsTruckStop(t) || IsBusStop(t);
|
return IsTruckStop(t) || IsBusStop(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,7 +244,7 @@ static inline bool IsDriveThroughStopTile(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline StationGfx GetAirportGfx(TileIndex t)
|
static inline StationGfx GetAirportGfx(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsAirport(t));
|
assert_tile(IsAirport(t), t);
|
||||||
extern StationGfx GetTranslatedAirportTileID(StationGfx gfx);
|
extern StationGfx GetTranslatedAirportTileID(StationGfx gfx);
|
||||||
return GetTranslatedAirportTileID(GetStationGfx(t));
|
return GetTranslatedAirportTileID(GetStationGfx(t));
|
||||||
}
|
}
|
||||||
@@ -258,7 +258,7 @@ static inline StationGfx GetAirportGfx(TileIndex t)
|
|||||||
static inline DiagDirection GetRoadStopDir(TileIndex t)
|
static inline DiagDirection GetRoadStopDir(TileIndex t)
|
||||||
{
|
{
|
||||||
StationGfx gfx = GetStationGfx(t);
|
StationGfx gfx = GetStationGfx(t);
|
||||||
assert(IsRoadStopTile(t));
|
assert_tile(IsRoadStopTile(t), t);
|
||||||
if (gfx < GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET) {
|
if (gfx < GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET) {
|
||||||
return (DiagDirection)(gfx);
|
return (DiagDirection)(gfx);
|
||||||
} else {
|
} else {
|
||||||
@@ -337,7 +337,7 @@ static inline bool IsHangarTile(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline Axis GetRailStationAxis(TileIndex t)
|
static inline Axis GetRailStationAxis(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(HasStationRail(t));
|
assert_tile(HasStationRail(t), t);
|
||||||
return HasBit(GetStationGfx(t), 0) ? AXIS_Y : AXIS_X;
|
return HasBit(GetStationGfx(t), 0) ? AXIS_Y : AXIS_X;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -378,7 +378,7 @@ static inline TrackBits GetRailStationTrackBits(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline bool IsCompatibleTrainStationTile(TileIndex test_tile, TileIndex station_tile)
|
static inline bool IsCompatibleTrainStationTile(TileIndex test_tile, TileIndex station_tile)
|
||||||
{
|
{
|
||||||
assert(IsRailStationTile(station_tile));
|
assert_tile(IsRailStationTile(station_tile), station_tile);
|
||||||
return IsRailStationTile(test_tile) && IsCompatibleRail(GetRailType(test_tile), GetRailType(station_tile)) &&
|
return IsRailStationTile(test_tile) && IsCompatibleRail(GetRailType(test_tile), GetRailType(station_tile)) &&
|
||||||
GetRailStationAxis(test_tile) == GetRailStationAxis(station_tile) &&
|
GetRailStationAxis(test_tile) == GetRailStationAxis(station_tile) &&
|
||||||
GetStationIndex(test_tile) == GetStationIndex(station_tile) &&
|
GetStationIndex(test_tile) == GetStationIndex(station_tile) &&
|
||||||
@@ -393,7 +393,7 @@ static inline bool IsCompatibleTrainStationTile(TileIndex test_tile, TileIndex s
|
|||||||
*/
|
*/
|
||||||
static inline bool HasStationReservation(TileIndex t)
|
static inline bool HasStationReservation(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(HasStationRail(t));
|
assert_tile(HasStationRail(t), t);
|
||||||
return HasBit(_me[t].m6, 2);
|
return HasBit(_me[t].m6, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -405,7 +405,7 @@ static inline bool HasStationReservation(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetRailStationReservation(TileIndex t, bool b)
|
static inline void SetRailStationReservation(TileIndex t, bool b)
|
||||||
{
|
{
|
||||||
assert(HasStationRail(t));
|
assert_tile(HasStationRail(t), t);
|
||||||
SB(_me[t].m6, 2, 1, b ? 1 : 0);
|
SB(_me[t].m6, 2, 1, b ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -430,7 +430,7 @@ static inline TrackBits GetStationReservationTrackBits(TileIndex t)
|
|||||||
static inline DiagDirection GetDockDirection(TileIndex t)
|
static inline DiagDirection GetDockDirection(TileIndex t)
|
||||||
{
|
{
|
||||||
StationGfx gfx = GetStationGfx(t);
|
StationGfx gfx = GetStationGfx(t);
|
||||||
assert(IsDock(t) && gfx < GFX_DOCK_BASE_WATER_PART);
|
assert_tile(IsDock(t) && gfx < GFX_DOCK_BASE_WATER_PART, t);
|
||||||
return (DiagDirection)(gfx);
|
return (DiagDirection)(gfx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -451,12 +451,12 @@ static inline TileIndexDiffC GetDockOffset(TileIndex t)
|
|||||||
{ 2, 0},
|
{ 2, 0},
|
||||||
{ 0, -2},
|
{ 0, -2},
|
||||||
};
|
};
|
||||||
assert(IsTileType(t, MP_STATION));
|
assert_tile(IsTileType(t, MP_STATION), t);
|
||||||
|
|
||||||
if (IsBuoy(t)) return buoy_offset;
|
if (IsBuoy(t)) return buoy_offset;
|
||||||
if (IsOilRig(t)) return oilrig_offset;
|
if (IsOilRig(t)) return oilrig_offset;
|
||||||
|
|
||||||
assert(IsDock(t));
|
assert_tile(IsDock(t), t);
|
||||||
|
|
||||||
return dock_offset[GetDockDirection(t)];
|
return dock_offset[GetDockDirection(t)];
|
||||||
}
|
}
|
||||||
@@ -469,7 +469,7 @@ static inline TileIndexDiffC GetDockOffset(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline bool IsCustomStationSpecIndex(TileIndex t)
|
static inline bool IsCustomStationSpecIndex(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(HasStationTileRail(t));
|
assert_tile(HasStationTileRail(t), t);
|
||||||
return _m[t].m4 != 0;
|
return _m[t].m4 != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -481,7 +481,7 @@ static inline bool IsCustomStationSpecIndex(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetCustomStationSpecIndex(TileIndex t, byte specindex)
|
static inline void SetCustomStationSpecIndex(TileIndex t, byte specindex)
|
||||||
{
|
{
|
||||||
assert(HasStationTileRail(t));
|
assert_tile(HasStationTileRail(t), t);
|
||||||
_m[t].m4 = specindex;
|
_m[t].m4 = specindex;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -493,7 +493,7 @@ static inline void SetCustomStationSpecIndex(TileIndex t, byte specindex)
|
|||||||
*/
|
*/
|
||||||
static inline uint GetCustomStationSpecIndex(TileIndex t)
|
static inline uint GetCustomStationSpecIndex(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(HasStationTileRail(t));
|
assert_tile(HasStationTileRail(t), t);
|
||||||
return _m[t].m4;
|
return _m[t].m4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -505,7 +505,7 @@ static inline uint GetCustomStationSpecIndex(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetStationTileRandomBits(TileIndex t, byte random_bits)
|
static inline void SetStationTileRandomBits(TileIndex t, byte random_bits)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_STATION));
|
assert_tile(IsTileType(t, MP_STATION), t);
|
||||||
SB(_m[t].m3, 4, 4, random_bits);
|
SB(_m[t].m3, 4, 4, random_bits);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -517,7 +517,7 @@ static inline void SetStationTileRandomBits(TileIndex t, byte random_bits)
|
|||||||
*/
|
*/
|
||||||
static inline byte GetStationTileRandomBits(TileIndex t)
|
static inline byte GetStationTileRandomBits(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_STATION));
|
assert_tile(IsTileType(t, MP_STATION), t);
|
||||||
return GB(_m[t].m3, 4, 4);
|
return GB(_m[t].m3, 4, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -84,15 +84,15 @@ Town::~Town()
|
|||||||
for (TileIndex tile = 0; tile < MapSize(); ++tile) {
|
for (TileIndex tile = 0; tile < MapSize(); ++tile) {
|
||||||
switch (GetTileType(tile)) {
|
switch (GetTileType(tile)) {
|
||||||
case MP_HOUSE:
|
case MP_HOUSE:
|
||||||
assert(GetTownIndex(tile) != this->index);
|
assert_tile(GetTownIndex(tile) != this->index, tile);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_ROAD:
|
case MP_ROAD:
|
||||||
assert(!HasTownOwnedRoad(tile) || GetTownIndex(tile) != this->index);
|
assert_tile(!HasTownOwnedRoad(tile) || GetTownIndex(tile) != this->index, tile);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_TUNNELBRIDGE:
|
case MP_TUNNELBRIDGE:
|
||||||
assert(!IsTileOwner(tile, OWNER_TOWN) || ClosestTownFromTile(tile, UINT_MAX) != this);
|
assert_tile(!IsTileOwner(tile, OWNER_TOWN) || ClosestTownFromTile(tile, UINT_MAX) != this, tile);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -532,7 +532,7 @@ uint32 GetWorldPopulation()
|
|||||||
*/
|
*/
|
||||||
static void MakeSingleHouseBigger(TileIndex tile)
|
static void MakeSingleHouseBigger(TileIndex tile)
|
||||||
{
|
{
|
||||||
assert(IsTileType(tile, MP_HOUSE));
|
assert_tile(IsTileType(tile, MP_HOUSE), tile);
|
||||||
|
|
||||||
/* progress in construction stages */
|
/* progress in construction stages */
|
||||||
IncHouseConstructionTick(tile);
|
IncHouseConstructionTick(tile);
|
||||||
@@ -2668,7 +2668,7 @@ static bool BuildTownHouse(Town *t, TileIndex tile)
|
|||||||
*/
|
*/
|
||||||
static void DoClearTownHouseHelper(TileIndex tile, Town *t, HouseID house)
|
static void DoClearTownHouseHelper(TileIndex tile, Town *t, HouseID house)
|
||||||
{
|
{
|
||||||
assert(IsTileType(tile, MP_HOUSE));
|
assert_tile(IsTileType(tile, MP_HOUSE), tile);
|
||||||
DecreaseBuildingCount(t, house);
|
DecreaseBuildingCount(t, house);
|
||||||
DoClearSquare(tile);
|
DoClearSquare(tile);
|
||||||
DeleteAnimatedTile(tile);
|
DeleteAnimatedTile(tile);
|
||||||
@@ -2705,7 +2705,7 @@ TileIndexDiff GetHouseNorthPart(HouseID &house)
|
|||||||
|
|
||||||
void ClearTownHouse(Town *t, TileIndex tile)
|
void ClearTownHouse(Town *t, TileIndex tile)
|
||||||
{
|
{
|
||||||
assert(IsTileType(tile, MP_HOUSE));
|
assert_tile(IsTileType(tile, MP_HOUSE), tile);
|
||||||
|
|
||||||
HouseID house = GetHouseType(tile);
|
HouseID house = GetHouseType(tile);
|
||||||
|
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
static inline TownID GetTownIndex(TileIndex t)
|
static inline TownID GetTownIndex(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_HOUSE) || (IsTileType(t, MP_ROAD) && !IsRoadDepot(t)));
|
assert_tile(IsTileType(t, MP_HOUSE) || (IsTileType(t, MP_ROAD) && !IsRoadDepot(t)), t);
|
||||||
return _m[t].m2;
|
return _m[t].m2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ static inline TownID GetTownIndex(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetTownIndex(TileIndex t, TownID index)
|
static inline void SetTownIndex(TileIndex t, TownID index)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_HOUSE) || (IsTileType(t, MP_ROAD) && !IsRoadDepot(t)));
|
assert_tile(IsTileType(t, MP_HOUSE) || (IsTileType(t, MP_ROAD) && !IsRoadDepot(t)), t);
|
||||||
_m[t].m2 = index;
|
_m[t].m2 = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ static inline void SetTownIndex(TileIndex t, TownID index)
|
|||||||
*/
|
*/
|
||||||
static inline HouseID GetCleanHouseType(TileIndex t)
|
static inline HouseID GetCleanHouseType(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_HOUSE));
|
assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
return _m[t].m4 | (GB(_m[t].m3, 6, 1) << 8);
|
return _m[t].m4 | (GB(_m[t].m3, 6, 1) << 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ static inline HouseID GetHouseType(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetHouseType(TileIndex t, HouseID house_id)
|
static inline void SetHouseType(TileIndex t, HouseID house_id)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_HOUSE));
|
assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
_m[t].m4 = GB(house_id, 0, 8);
|
_m[t].m4 = GB(house_id, 0, 8);
|
||||||
SB(_m[t].m3, 6, 1, GB(house_id, 8, 1));
|
SB(_m[t].m3, 6, 1, GB(house_id, 8, 1));
|
||||||
}
|
}
|
||||||
@@ -146,7 +146,7 @@ static inline void SetLiftPosition(TileIndex t, byte pos)
|
|||||||
*/
|
*/
|
||||||
static inline bool IsHouseCompleted(TileIndex t)
|
static inline bool IsHouseCompleted(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_HOUSE));
|
assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
return HasBit(_m[t].m3, 7);
|
return HasBit(_m[t].m3, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,7 +157,7 @@ static inline bool IsHouseCompleted(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetHouseCompleted(TileIndex t, bool status)
|
static inline void SetHouseCompleted(TileIndex t, bool status)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_HOUSE));
|
assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
SB(_m[t].m3, 7, 1, !!status);
|
SB(_m[t].m3, 7, 1, !!status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,7 +184,7 @@ static inline void SetHouseCompleted(TileIndex t, bool status)
|
|||||||
*/
|
*/
|
||||||
static inline byte GetHouseBuildingStage(TileIndex t)
|
static inline byte GetHouseBuildingStage(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_HOUSE));
|
assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
return IsHouseCompleted(t) ? (byte)TOWN_HOUSE_COMPLETED : GB(_m[t].m5, 3, 2);
|
return IsHouseCompleted(t) ? (byte)TOWN_HOUSE_COMPLETED : GB(_m[t].m5, 3, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,7 +196,7 @@ static inline byte GetHouseBuildingStage(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline byte GetHouseConstructionTick(TileIndex t)
|
static inline byte GetHouseConstructionTick(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_HOUSE));
|
assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
return IsHouseCompleted(t) ? 0 : GB(_m[t].m5, 0, 3);
|
return IsHouseCompleted(t) ? 0 : GB(_m[t].m5, 0, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,7 +209,7 @@ static inline byte GetHouseConstructionTick(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void IncHouseConstructionTick(TileIndex t)
|
static inline void IncHouseConstructionTick(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_HOUSE));
|
assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
AB(_m[t].m5, 0, 5, 1);
|
AB(_m[t].m5, 0, 5, 1);
|
||||||
|
|
||||||
if (GB(_m[t].m5, 3, 2) == TOWN_HOUSE_COMPLETED) {
|
if (GB(_m[t].m5, 3, 2) == TOWN_HOUSE_COMPLETED) {
|
||||||
@@ -227,7 +227,7 @@ static inline void IncHouseConstructionTick(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void ResetHouseAge(TileIndex t)
|
static inline void ResetHouseAge(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_HOUSE) && IsHouseCompleted(t));
|
assert_tile(IsTileType(t, MP_HOUSE) && IsHouseCompleted(t), t);
|
||||||
_m[t].m5 = 0;
|
_m[t].m5 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,7 +238,7 @@ static inline void ResetHouseAge(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void IncrementHouseAge(TileIndex t)
|
static inline void IncrementHouseAge(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_HOUSE));
|
assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
if (IsHouseCompleted(t) && _m[t].m5 < 0xFF) _m[t].m5++;
|
if (IsHouseCompleted(t) && _m[t].m5 < 0xFF) _m[t].m5++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,7 +250,7 @@ static inline void IncrementHouseAge(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline Year GetHouseAge(TileIndex t)
|
static inline Year GetHouseAge(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_HOUSE));
|
assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
return IsHouseCompleted(t) ? _m[t].m5 : 0;
|
return IsHouseCompleted(t) ? _m[t].m5 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,7 +263,7 @@ static inline Year GetHouseAge(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetHouseRandomBits(TileIndex t, byte random)
|
static inline void SetHouseRandomBits(TileIndex t, byte random)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_HOUSE));
|
assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
_m[t].m1 = random;
|
_m[t].m1 = random;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,7 +276,7 @@ static inline void SetHouseRandomBits(TileIndex t, byte random)
|
|||||||
*/
|
*/
|
||||||
static inline byte GetHouseRandomBits(TileIndex t)
|
static inline byte GetHouseRandomBits(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_HOUSE));
|
assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
return _m[t].m1;
|
return _m[t].m1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -289,7 +289,7 @@ static inline byte GetHouseRandomBits(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetHouseTriggers(TileIndex t, byte triggers)
|
static inline void SetHouseTriggers(TileIndex t, byte triggers)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_HOUSE));
|
assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
SB(_m[t].m3, 0, 5, triggers);
|
SB(_m[t].m3, 0, 5, triggers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,7 +302,7 @@ static inline void SetHouseTriggers(TileIndex t, byte triggers)
|
|||||||
*/
|
*/
|
||||||
static inline byte GetHouseTriggers(TileIndex t)
|
static inline byte GetHouseTriggers(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_HOUSE));
|
assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
return GB(_m[t].m3, 0, 5);
|
return GB(_m[t].m3, 0, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -314,7 +314,7 @@ static inline byte GetHouseTriggers(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline byte GetHouseProcessingTime(TileIndex t)
|
static inline byte GetHouseProcessingTime(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_HOUSE));
|
assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
return GB(_me[t].m6, 2, 6);
|
return GB(_me[t].m6, 2, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -326,7 +326,7 @@ static inline byte GetHouseProcessingTime(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetHouseProcessingTime(TileIndex t, byte time)
|
static inline void SetHouseProcessingTime(TileIndex t, byte time)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_HOUSE));
|
assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
SB(_me[t].m6, 2, 6, time);
|
SB(_me[t].m6, 2, 6, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,7 +337,7 @@ static inline void SetHouseProcessingTime(TileIndex t, byte time)
|
|||||||
*/
|
*/
|
||||||
static inline void DecHouseProcessingTime(TileIndex t)
|
static inline void DecHouseProcessingTime(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_HOUSE));
|
assert_tile(IsTileType(t, MP_HOUSE), t);
|
||||||
_me[t].m6 -= 1 << 2;
|
_me[t].m6 -= 1 << 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -353,7 +353,7 @@ static inline void DecHouseProcessingTime(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void MakeHouseTile(TileIndex t, TownID tid, byte counter, byte stage, HouseID type, byte random_bits)
|
static inline void MakeHouseTile(TileIndex t, TownID tid, byte counter, byte stage, HouseID type, byte random_bits)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_CLEAR));
|
assert_tile(IsTileType(t, MP_CLEAR), t);
|
||||||
|
|
||||||
SetTileType(t, MP_HOUSE);
|
SetTileType(t, MP_HOUSE);
|
||||||
_m[t].m1 = random_bits;
|
_m[t].m1 = random_bits;
|
||||||
|
@@ -1902,7 +1902,7 @@ static Vehicle *TrainApproachingCrossingEnum(Vehicle *v, void *data)
|
|||||||
*/
|
*/
|
||||||
static bool TrainApproachingCrossing(TileIndex tile)
|
static bool TrainApproachingCrossing(TileIndex tile)
|
||||||
{
|
{
|
||||||
assert(IsLevelCrossingTile(tile));
|
assert_tile(IsLevelCrossingTile(tile), tile);
|
||||||
|
|
||||||
DiagDirection dir = AxisToDiagDir(GetCrossingRailAxis(tile));
|
DiagDirection dir = AxisToDiagDir(GetCrossingRailAxis(tile));
|
||||||
TileIndex tile_from = tile + TileOffsByDiagDir(dir);
|
TileIndex tile_from = tile + TileOffsByDiagDir(dir);
|
||||||
@@ -1934,7 +1934,7 @@ static inline bool CheckLevelCrossing(TileIndex tile)
|
|||||||
*/
|
*/
|
||||||
static void UpdateLevelCrossingTile(TileIndex tile, bool sound, bool is_forced, bool forced_state)
|
static void UpdateLevelCrossingTile(TileIndex tile, bool sound, bool is_forced, bool forced_state)
|
||||||
{
|
{
|
||||||
assert(IsLevelCrossingTile(tile));
|
assert_tile(IsLevelCrossingTile(tile), tile);
|
||||||
bool new_state;
|
bool new_state;
|
||||||
|
|
||||||
if (is_forced) {
|
if (is_forced) {
|
||||||
@@ -3991,7 +3991,7 @@ bool TrainController(Train *v, Vehicle *nomove, bool reverse)
|
|||||||
if (prev->track & TRACK_BIT_WORMHOLE) {
|
if (prev->track & TRACK_BIT_WORMHOLE) {
|
||||||
/* Vehicles entering tunnels enter the wormhole earlier than for bridges.
|
/* Vehicles entering tunnels enter the wormhole earlier than for bridges.
|
||||||
* However, just choose the track into the wormhole. */
|
* However, just choose the track into the wormhole. */
|
||||||
assert(IsTunnel(prev->tile));
|
assert_tile(IsTunnel(prev->tile), prev->tile);
|
||||||
chosen_track = bits;
|
chosen_track = bits;
|
||||||
} else {
|
} else {
|
||||||
chosen_track = prev->track;
|
chosen_track = prev->track;
|
||||||
|
@@ -92,7 +92,7 @@ static bool CanPlantTreesOnTile(TileIndex tile, bool allow_desert)
|
|||||||
static void PlantTreesOnTile(TileIndex tile, TreeType treetype, uint count, uint growth)
|
static void PlantTreesOnTile(TileIndex tile, TreeType treetype, uint count, uint growth)
|
||||||
{
|
{
|
||||||
assert(treetype != TREE_INVALID);
|
assert(treetype != TREE_INVALID);
|
||||||
assert(CanPlantTreesOnTile(tile, true));
|
assert_tile(CanPlantTreesOnTile(tile, true), tile);
|
||||||
|
|
||||||
TreeGround ground;
|
TreeGround ground;
|
||||||
uint density = 3;
|
uint density = 3;
|
||||||
|
@@ -73,7 +73,7 @@ enum TreeGround {
|
|||||||
*/
|
*/
|
||||||
static inline TreeType GetTreeType(TileIndex t)
|
static inline TreeType GetTreeType(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_TREES));
|
assert_tile(IsTileType(t, MP_TREES), t);
|
||||||
return (TreeType)_m[t].m3;
|
return (TreeType)_m[t].m3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ static inline TreeType GetTreeType(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline TreeGround GetTreeGround(TileIndex t)
|
static inline TreeGround GetTreeGround(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_TREES));
|
assert_tile(IsTileType(t, MP_TREES), t);
|
||||||
return (TreeGround)GB(_m[t].m2, 6, 3);
|
return (TreeGround)GB(_m[t].m2, 6, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ static inline TreeGround GetTreeGround(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline uint GetTreeDensity(TileIndex t)
|
static inline uint GetTreeDensity(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_TREES));
|
assert_tile(IsTileType(t, MP_TREES), t);
|
||||||
return GB(_m[t].m2, 4, 2);
|
return GB(_m[t].m2, 4, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@ static inline uint GetTreeDensity(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetTreeGroundDensity(TileIndex t, TreeGround g, uint d)
|
static inline void SetTreeGroundDensity(TileIndex t, TreeGround g, uint d)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_TREES)); // XXX incomplete
|
assert_tile(IsTileType(t, MP_TREES), t); // XXX incomplete
|
||||||
SB(_m[t].m2, 4, 2, d);
|
SB(_m[t].m2, 4, 2, d);
|
||||||
SB(_m[t].m2, 6, 3, g);
|
SB(_m[t].m2, 6, 3, g);
|
||||||
}
|
}
|
||||||
@@ -148,7 +148,7 @@ static inline void SetTreeGroundDensity(TileIndex t, TreeGround g, uint d)
|
|||||||
*/
|
*/
|
||||||
static inline uint GetTreeCount(TileIndex t)
|
static inline uint GetTreeCount(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_TREES));
|
assert_tile(IsTileType(t, MP_TREES), t);
|
||||||
return GB(_m[t].m5, 6, 2) + 1;
|
return GB(_m[t].m5, 6, 2) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ static inline uint GetTreeCount(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void AddTreeCount(TileIndex t, int c)
|
static inline void AddTreeCount(TileIndex t, int c)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_TREES)); // XXX incomplete
|
assert_tile(IsTileType(t, MP_TREES), t); // XXX incomplete
|
||||||
_m[t].m5 += ((uint) c) << 6;
|
_m[t].m5 += ((uint) c) << 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,7 +180,7 @@ static inline void AddTreeCount(TileIndex t, int c)
|
|||||||
*/
|
*/
|
||||||
static inline uint GetTreeGrowth(TileIndex t)
|
static inline uint GetTreeGrowth(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_TREES));
|
assert_tile(IsTileType(t, MP_TREES), t);
|
||||||
return GB(_m[t].m5, 0, 3);
|
return GB(_m[t].m5, 0, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,7 +195,7 @@ static inline uint GetTreeGrowth(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void AddTreeGrowth(TileIndex t, int a)
|
static inline void AddTreeGrowth(TileIndex t, int a)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_TREES)); // XXX incomplete
|
assert_tile(IsTileType(t, MP_TREES), t); // XXX incomplete
|
||||||
_m[t].m5 += a;
|
_m[t].m5 += a;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ static inline void AddTreeGrowth(TileIndex t, int a)
|
|||||||
*/
|
*/
|
||||||
static inline void SetTreeGrowth(TileIndex t, uint g)
|
static inline void SetTreeGrowth(TileIndex t, uint g)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_TREES)); // XXX incomplete
|
assert_tile(IsTileType(t, MP_TREES), t); // XXX incomplete
|
||||||
SB(_m[t].m5, 0, 3, g);
|
SB(_m[t].m5, 0, 3, g);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,7 +225,7 @@ static inline void SetTreeGrowth(TileIndex t, uint g)
|
|||||||
*/
|
*/
|
||||||
static inline uint GetTreeCounter(TileIndex t)
|
static inline uint GetTreeCounter(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_TREES));
|
assert_tile(IsTileType(t, MP_TREES), t);
|
||||||
return GB(_m[t].m2, 0, 4);
|
return GB(_m[t].m2, 0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,7 +240,7 @@ static inline uint GetTreeCounter(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void AddTreeCounter(TileIndex t, int a)
|
static inline void AddTreeCounter(TileIndex t, int a)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_TREES)); // XXX incomplete
|
assert_tile(IsTileType(t, MP_TREES), t); // XXX incomplete
|
||||||
_m[t].m2 += a;
|
_m[t].m2 += a;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,7 +255,7 @@ static inline void AddTreeCounter(TileIndex t, int a)
|
|||||||
*/
|
*/
|
||||||
static inline void SetTreeCounter(TileIndex t, uint c)
|
static inline void SetTreeCounter(TileIndex t, uint c)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_TREES)); // XXX incomplete
|
assert_tile(IsTileType(t, MP_TREES), t); // XXX incomplete
|
||||||
SB(_m[t].m2, 0, 4, c);
|
SB(_m[t].m2, 0, 4, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -26,7 +26,7 @@ static const TunnelID TUNNEL_ID_MAP_LOOKUP = 0xFFFF; ///< Sentinel ID value to s
|
|||||||
*/
|
*/
|
||||||
static inline bool IsTunnel(TileIndex t)
|
static inline bool IsTunnel(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_TUNNELBRIDGE));
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
return !HasBit(_m[t].m5, 7);
|
return !HasBit(_m[t].m5, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ static inline TunnelID GetTunnelIndex(TileIndex t)
|
|||||||
{
|
{
|
||||||
extern TunnelID GetTunnelIndexByLookup(TileIndex t);
|
extern TunnelID GetTunnelIndexByLookup(TileIndex t);
|
||||||
|
|
||||||
assert(IsTunnelTile(t));
|
assert_tile(IsTunnelTile(t), t);
|
||||||
TunnelID map_id = _m[t].m2;
|
TunnelID map_id = _m[t].m2;
|
||||||
return map_id == TUNNEL_ID_MAP_LOOKUP ? GetTunnelIndexByLookup(t) : map_id;
|
return map_id == TUNNEL_ID_MAP_LOOKUP ? GetTunnelIndexByLookup(t) : map_id;
|
||||||
}
|
}
|
||||||
@@ -73,7 +73,7 @@ static inline bool IsRailTunnelTile(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline bool HasTunnelReservation(TileIndex t)
|
static inline bool HasTunnelReservation(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsRailTunnelTile(t));
|
assert_tile(IsRailTunnelTile(t), t);
|
||||||
return HasBit(_m[t].m5, 4);
|
return HasBit(_m[t].m5, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ static inline bool HasTunnelReservation(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetTunnelReservation(TileIndex t, bool b)
|
static inline void SetTunnelReservation(TileIndex t, bool b)
|
||||||
{
|
{
|
||||||
assert(IsRailTunnelTile(t));
|
assert_tile(IsRailTunnelTile(t), t);
|
||||||
SB(_m[t].m5, 4, 1, b ? 1 : 0);
|
SB(_m[t].m5, 4, 1, b ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ bool IsTunnelInWay(TileIndex, int z, IsTunnelInWayFlags flags = ITIWF_NONE);
|
|||||||
*/
|
*/
|
||||||
static inline void SetTunnelIndex(TileIndex t, TunnelID id)
|
static inline void SetTunnelIndex(TileIndex t, TunnelID id)
|
||||||
{
|
{
|
||||||
assert(IsTunnelTile(t));
|
assert_tile(IsTunnelTile(t), t);
|
||||||
_m[t].m2 = (id >= TUNNEL_ID_MAP_LOOKUP) ? TUNNEL_ID_MAP_LOOKUP : id;
|
_m[t].m2 = (id >= TUNNEL_ID_MAP_LOOKUP) ? TUNNEL_ID_MAP_LOOKUP : id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -32,7 +32,7 @@
|
|||||||
*/
|
*/
|
||||||
static inline DiagDirection GetTunnelBridgeDirection(TileIndex t)
|
static inline DiagDirection GetTunnelBridgeDirection(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_TUNNELBRIDGE));
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
return (DiagDirection)GB(_m[t].m5, 0, 2);
|
return (DiagDirection)GB(_m[t].m5, 0, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ static inline DiagDirection GetTunnelBridgeDirection(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline TransportType GetTunnelBridgeTransportType(TileIndex t)
|
static inline TransportType GetTunnelBridgeTransportType(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_TUNNELBRIDGE));
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
return (TransportType)GB(_m[t].m5, 2, 2);
|
return (TransportType)GB(_m[t].m5, 2, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ static inline TransportType GetTunnelBridgeTransportType(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline bool HasTunnelBridgeSnowOrDesert(TileIndex t)
|
static inline bool HasTunnelBridgeSnowOrDesert(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_TUNNELBRIDGE));
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
return HasBit(_me[t].m7, 5);
|
return HasBit(_me[t].m7, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ static inline bool IsRailTunnelBridgeTile(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetTunnelBridgeSnowOrDesert(TileIndex t, bool snow_or_desert)
|
static inline void SetTunnelBridgeSnowOrDesert(TileIndex t, bool snow_or_desert)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_TUNNELBRIDGE));
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
SB(_me[t].m7, 5, 1, snow_or_desert);
|
SB(_me[t].m7, 5, 1, snow_or_desert);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ static inline void SetTunnelBridgeSnowOrDesert(TileIndex t, bool snow_or_desert)
|
|||||||
*/
|
*/
|
||||||
static inline TileIndex GetOtherTunnelBridgeEnd(TileIndex t)
|
static inline TileIndex GetOtherTunnelBridgeEnd(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_TUNNELBRIDGE));
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
return IsTunnel(t) ? GetOtherTunnelEnd(t) : GetOtherBridgeEnd(t);
|
return IsTunnel(t) ? GetOtherTunnelEnd(t) : GetOtherBridgeEnd(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,8 +208,8 @@ static inline uint GetTunnelBridgeHeadOnlyRailInfrastructureCount(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline bool TrackdirEntersTunnelBridge(TileIndex t, Trackdir td)
|
static inline bool TrackdirEntersTunnelBridge(TileIndex t, Trackdir td)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_TUNNELBRIDGE));
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
assert(GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL);
|
assert_tile(GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL, t);
|
||||||
return TrackdirToExitdir(td) == GetTunnelBridgeDirection(t);
|
return TrackdirToExitdir(td) == GetTunnelBridgeDirection(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,8 +222,8 @@ static inline bool TrackdirEntersTunnelBridge(TileIndex t, Trackdir td)
|
|||||||
*/
|
*/
|
||||||
static inline bool TrackdirExitsTunnelBridge(TileIndex t, Trackdir td)
|
static inline bool TrackdirExitsTunnelBridge(TileIndex t, Trackdir td)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_TUNNELBRIDGE));
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
assert(GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL);
|
assert_tile(GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL, t);
|
||||||
return TrackdirToExitdir(ReverseTrackdir(td)) == GetTunnelBridgeDirection(t);
|
return TrackdirToExitdir(ReverseTrackdir(td)) == GetTunnelBridgeDirection(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,8 +236,8 @@ static inline bool TrackdirExitsTunnelBridge(TileIndex t, Trackdir td)
|
|||||||
*/
|
*/
|
||||||
static inline bool IsTrackAcrossTunnelBridge(TileIndex tile, Track t)
|
static inline bool IsTrackAcrossTunnelBridge(TileIndex tile, Track t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(tile, MP_TUNNELBRIDGE));
|
assert_tile(IsTileType(tile, MP_TUNNELBRIDGE), tile);
|
||||||
assert(GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL);
|
assert_tile(GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL, tile);
|
||||||
return DiagdirReachesTracks(ReverseDiagDir(GetTunnelBridgeDirection(tile))) & TrackToTrackBits(t);
|
return DiagdirReachesTracks(ReverseDiagDir(GetTunnelBridgeDirection(tile))) & TrackToTrackBits(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,8 +248,8 @@ static inline bool IsTrackAcrossTunnelBridge(TileIndex tile, Track t)
|
|||||||
*/
|
*/
|
||||||
static inline void UnreserveAcrossRailTunnelBridge(TileIndex tile)
|
static inline void UnreserveAcrossRailTunnelBridge(TileIndex tile)
|
||||||
{
|
{
|
||||||
assert(IsTileType(tile, MP_TUNNELBRIDGE));
|
assert_tile(IsTileType(tile, MP_TUNNELBRIDGE), tile);
|
||||||
assert(GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL);
|
assert_tile(GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL, tile);
|
||||||
if (IsTunnel(tile)) {
|
if (IsTunnel(tile)) {
|
||||||
SetTunnelReservation(tile, false);
|
SetTunnelReservation(tile, false);
|
||||||
} else {
|
} else {
|
||||||
@@ -263,7 +263,7 @@ static inline void UnreserveAcrossRailTunnelBridge(TileIndex tile)
|
|||||||
*/
|
*/
|
||||||
static inline void SetTunnelBridgeSignalSimulationEntrance(TileIndex t)
|
static inline void SetTunnelBridgeSignalSimulationEntrance(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_TUNNELBRIDGE));
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
SetBit(_m[t].m5, 5);
|
SetBit(_m[t].m5, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,7 +273,7 @@ static inline void SetTunnelBridgeSignalSimulationEntrance(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void ClrTunnelBridgeSignalSimulationEntrance(TileIndex t)
|
static inline void ClrTunnelBridgeSignalSimulationEntrance(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_TUNNELBRIDGE));
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
ClrBit(_m[t].m5, 5);
|
ClrBit(_m[t].m5, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -283,7 +283,7 @@ static inline void ClrTunnelBridgeSignalSimulationEntrance(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetTunnelBridgeSignalSimulationExit(TileIndex t)
|
static inline void SetTunnelBridgeSignalSimulationExit(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_TUNNELBRIDGE));
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
SetBit(_m[t].m5, 6);
|
SetBit(_m[t].m5, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -293,7 +293,7 @@ static inline void SetTunnelBridgeSignalSimulationExit(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void ClrTunnelBridgeSignalSimulationExit(TileIndex t)
|
static inline void ClrTunnelBridgeSignalSimulationExit(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_TUNNELBRIDGE));
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
ClrBit(_m[t].m5, 6);
|
ClrBit(_m[t].m5, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,7 +317,7 @@ static inline bool IsTunnelBridgeWithSignalSimulation(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline bool IsTunnelBridgeSignalSimulationEntrance(TileIndex t)
|
static inline bool IsTunnelBridgeSignalSimulationEntrance(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_TUNNELBRIDGE));
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
return HasBit(_m[t].m5, 5);
|
return HasBit(_m[t].m5, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -329,7 +329,7 @@ static inline bool IsTunnelBridgeSignalSimulationEntrance(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline bool IsTunnelBridgeSignalSimulationExit(TileIndex t)
|
static inline bool IsTunnelBridgeSignalSimulationExit(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_TUNNELBRIDGE));
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
return HasBit(_m[t].m5, 6);
|
return HasBit(_m[t].m5, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -341,7 +341,7 @@ static inline bool IsTunnelBridgeSignalSimulationExit(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline bool IsTunnelBridgeSignalSimulationExitOnly(TileIndex t)
|
static inline bool IsTunnelBridgeSignalSimulationExitOnly(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_TUNNELBRIDGE));
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
return !HasBit(_m[t].m5, 5) && HasBit(_m[t].m5, 6);
|
return !HasBit(_m[t].m5, 5) && HasBit(_m[t].m5, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -353,7 +353,7 @@ static inline bool IsTunnelBridgeSignalSimulationExitOnly(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline bool IsTunnelBridgeSignalSimulationBidirectional(TileIndex t)
|
static inline bool IsTunnelBridgeSignalSimulationBidirectional(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_TUNNELBRIDGE));
|
assert_tile(IsTileType(t, MP_TUNNELBRIDGE), t);
|
||||||
return HasBit(_m[t].m5, 5) && HasBit(_m[t].m5, 6);
|
return HasBit(_m[t].m5, 5) && HasBit(_m[t].m5, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,7 +365,7 @@ static inline bool IsTunnelBridgeSignalSimulationBidirectional(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline SignalState GetTunnelBridgeEntranceSignalState(TileIndex t)
|
static inline SignalState GetTunnelBridgeEntranceSignalState(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTunnelBridgeSignalSimulationEntrance(t));
|
assert_tile(IsTunnelBridgeSignalSimulationEntrance(t), t);
|
||||||
return HasBit(_me[t].m6, 0) ? SIGNAL_STATE_GREEN : SIGNAL_STATE_RED;
|
return HasBit(_me[t].m6, 0) ? SIGNAL_STATE_GREEN : SIGNAL_STATE_RED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,7 +377,7 @@ static inline SignalState GetTunnelBridgeEntranceSignalState(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline SignalState GetTunnelBridgeExitSignalState(TileIndex t)
|
static inline SignalState GetTunnelBridgeExitSignalState(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTunnelBridgeSignalSimulationExit(t));
|
assert_tile(IsTunnelBridgeSignalSimulationExit(t), t);
|
||||||
return HasBit(_me[t].m6, 7) ? SIGNAL_STATE_GREEN : SIGNAL_STATE_RED;
|
return HasBit(_me[t].m6, 7) ? SIGNAL_STATE_GREEN : SIGNAL_STATE_RED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -389,7 +389,7 @@ static inline SignalState GetTunnelBridgeExitSignalState(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetTunnelBridgeEntranceSignalState(TileIndex t, SignalState state)
|
static inline void SetTunnelBridgeEntranceSignalState(TileIndex t, SignalState state)
|
||||||
{
|
{
|
||||||
assert(IsTunnelBridgeSignalSimulationEntrance(t));
|
assert_tile(IsTunnelBridgeSignalSimulationEntrance(t), t);
|
||||||
SB(_me[t].m6, 0, 1, (state == SIGNAL_STATE_GREEN) ? 1 : 0);
|
SB(_me[t].m6, 0, 1, (state == SIGNAL_STATE_GREEN) ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -401,31 +401,31 @@ static inline void SetTunnelBridgeEntranceSignalState(TileIndex t, SignalState s
|
|||||||
*/
|
*/
|
||||||
static inline void SetTunnelBridgeExitSignalState(TileIndex t, SignalState state)
|
static inline void SetTunnelBridgeExitSignalState(TileIndex t, SignalState state)
|
||||||
{
|
{
|
||||||
assert(IsTunnelBridgeSignalSimulationExit(t));
|
assert_tile(IsTunnelBridgeSignalSimulationExit(t), t);
|
||||||
SB(_me[t].m6, 7, 1, (state == SIGNAL_STATE_GREEN) ? 1 : 0);
|
SB(_me[t].m6, 7, 1, (state == SIGNAL_STATE_GREEN) ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool IsTunnelBridgeSemaphore(TileIndex t)
|
static inline bool IsTunnelBridgeSemaphore(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTunnelBridgeWithSignalSimulation(t));
|
assert_tile(IsTunnelBridgeWithSignalSimulation(t), t);
|
||||||
return HasBit(_me[t].m6, 1);
|
return HasBit(_me[t].m6, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void SetTunnelBridgeSemaphore(TileIndex t, bool is_semaphore)
|
static inline void SetTunnelBridgeSemaphore(TileIndex t, bool is_semaphore)
|
||||||
{
|
{
|
||||||
assert(IsTunnelBridgeWithSignalSimulation(t));
|
assert_tile(IsTunnelBridgeWithSignalSimulation(t), t);
|
||||||
SB(_me[t].m6, 1, 1, is_semaphore ? 1 : 0);
|
SB(_me[t].m6, 1, 1, is_semaphore ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool IsTunnelBridgePBS(TileIndex t)
|
static inline bool IsTunnelBridgePBS(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTunnelBridgeWithSignalSimulation(t));
|
assert_tile(IsTunnelBridgeWithSignalSimulation(t), t);
|
||||||
return HasBit(_me[t].m6, 6);
|
return HasBit(_me[t].m6, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void SetTunnelBridgePBS(TileIndex t, bool is_pbs)
|
static inline void SetTunnelBridgePBS(TileIndex t, bool is_pbs)
|
||||||
{
|
{
|
||||||
assert(IsTunnelBridgeWithSignalSimulation(t));
|
assert_tile(IsTunnelBridgeWithSignalSimulation(t), t);
|
||||||
SB(_me[t].m6, 6, 1, is_pbs ? 1 : 0);
|
SB(_me[t].m6, 6, 1, is_pbs ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2609,9 +2609,9 @@ static void VehicleIncreaseStats(const Vehicle *front)
|
|||||||
void Vehicle::BeginLoading()
|
void Vehicle::BeginLoading()
|
||||||
{
|
{
|
||||||
if (this->type == VEH_TRAIN) {
|
if (this->type == VEH_TRAIN) {
|
||||||
assert(IsTileType(Train::From(this)->GetStationLoadingVehicle()->tile, MP_STATION));
|
assert_tile(IsTileType(Train::From(this)->GetStationLoadingVehicle()->tile, MP_STATION), Train::From(this)->GetStationLoadingVehicle()->tile);
|
||||||
} else {
|
} else {
|
||||||
assert(IsTileType(this->tile, MP_STATION) || this->type == VEH_SHIP);
|
assert_tile(IsTileType(this->tile, MP_STATION) || this->type == VEH_SHIP, this->tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool no_load_prepare = false;
|
bool no_load_prepare = false;
|
||||||
|
@@ -582,7 +582,7 @@ bool IsWateredTile(TileIndex tile, Direction from)
|
|||||||
|
|
||||||
case MP_RAILWAY:
|
case MP_RAILWAY:
|
||||||
if (GetRailGroundType(tile) == RAIL_GROUND_WATER) {
|
if (GetRailGroundType(tile) == RAIL_GROUND_WATER) {
|
||||||
assert(IsPlainRail(tile));
|
assert_tile(IsPlainRail(tile), tile);
|
||||||
switch (GetTileSlope(tile)) {
|
switch (GetTileSlope(tile)) {
|
||||||
case SLOPE_W: return (from == DIR_SE) || (from == DIR_E) || (from == DIR_NE);
|
case SLOPE_W: return (from == DIR_SE) || (from == DIR_E) || (from == DIR_NE);
|
||||||
case SLOPE_S: return (from == DIR_NE) || (from == DIR_N) || (from == DIR_NW);
|
case SLOPE_S: return (from == DIR_NE) || (from == DIR_N) || (from == DIR_NW);
|
||||||
@@ -1056,7 +1056,7 @@ FloodingBehaviour GetFloodingBehaviour(TileIndex tile)
|
|||||||
*/
|
*/
|
||||||
void DoFloodTile(TileIndex target)
|
void DoFloodTile(TileIndex target)
|
||||||
{
|
{
|
||||||
assert(!IsTileType(target, MP_WATER));
|
assert_tile(!IsTileType(target, MP_WATER), target);
|
||||||
|
|
||||||
bool flooded = false; // Will be set to true if something is changed.
|
bool flooded = false; // Will be set to true if something is changed.
|
||||||
|
|
||||||
@@ -1125,8 +1125,8 @@ static void DoDryUp(TileIndex tile)
|
|||||||
|
|
||||||
switch (GetTileType(tile)) {
|
switch (GetTileType(tile)) {
|
||||||
case MP_RAILWAY:
|
case MP_RAILWAY:
|
||||||
assert(IsPlainRail(tile));
|
assert_tile(IsPlainRail(tile), tile);
|
||||||
assert(GetRailGroundType(tile) == RAIL_GROUND_WATER);
|
assert_tile(GetRailGroundType(tile) == RAIL_GROUND_WATER, tile);
|
||||||
|
|
||||||
RailGroundType new_ground;
|
RailGroundType new_ground;
|
||||||
switch (GetTrackBits(tile)) {
|
switch (GetTrackBits(tile)) {
|
||||||
@@ -1146,7 +1146,7 @@ static void DoDryUp(TileIndex tile)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_WATER:
|
case MP_WATER:
|
||||||
assert(IsCoast(tile));
|
assert_tile(IsCoast(tile), tile);
|
||||||
|
|
||||||
if (DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR).Succeeded()) {
|
if (DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR).Succeeded()) {
|
||||||
MakeClear(tile, CLEAR_GRASS, 3);
|
MakeClear(tile, CLEAR_GRASS, 3);
|
||||||
|
@@ -77,7 +77,7 @@ enum LockPart {
|
|||||||
*/
|
*/
|
||||||
static inline WaterTileType GetWaterTileType(TileIndex t)
|
static inline WaterTileType GetWaterTileType(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_WATER));
|
assert_tile(IsTileType(t, MP_WATER), t);
|
||||||
|
|
||||||
switch (GB(_m[t].m5, WBL_TYPE_BEGIN, WBL_TYPE_COUNT)) {
|
switch (GB(_m[t].m5, WBL_TYPE_BEGIN, WBL_TYPE_COUNT)) {
|
||||||
case WBL_TYPE_NORMAL: return HasBit(_m[t].m5, WBL_COAST_FLAG) ? WATER_TILE_COAST : WATER_TILE_CLEAR;
|
case WBL_TYPE_NORMAL: return HasBit(_m[t].m5, WBL_COAST_FLAG) ? WATER_TILE_COAST : WATER_TILE_CLEAR;
|
||||||
@@ -106,7 +106,7 @@ static inline bool HasTileWaterClass(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline WaterClass GetWaterClass(TileIndex t)
|
static inline WaterClass GetWaterClass(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(HasTileWaterClass(t));
|
assert_tile(HasTileWaterClass(t), t);
|
||||||
return (WaterClass)GB(_m[t].m1, 5, 2);
|
return (WaterClass)GB(_m[t].m1, 5, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ static inline WaterClass GetWaterClass(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline void SetWaterClass(TileIndex t, WaterClass wc)
|
static inline void SetWaterClass(TileIndex t, WaterClass wc)
|
||||||
{
|
{
|
||||||
assert(HasTileWaterClass(t));
|
assert_tile(HasTileWaterClass(t), t);
|
||||||
SB(_m[t].m1, 5, 2, wc);
|
SB(_m[t].m1, 5, 2, wc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,7 +237,7 @@ static inline bool IsShipDepotTile(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline Axis GetShipDepotAxis(TileIndex t)
|
static inline Axis GetShipDepotAxis(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsShipDepotTile(t));
|
assert_tile(IsShipDepotTile(t), t);
|
||||||
return (Axis)GB(_m[t].m5, WBL_DEPOT_AXIS, 1);
|
return (Axis)GB(_m[t].m5, WBL_DEPOT_AXIS, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,7 +249,7 @@ static inline Axis GetShipDepotAxis(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline DepotPart GetShipDepotPart(TileIndex t)
|
static inline DepotPart GetShipDepotPart(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsShipDepotTile(t));
|
assert_tile(IsShipDepotTile(t), t);
|
||||||
return (DepotPart)GB(_m[t].m5, WBL_DEPOT_PART, 1);
|
return (DepotPart)GB(_m[t].m5, WBL_DEPOT_PART, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -283,7 +283,7 @@ static inline TileIndex GetOtherShipDepotTile(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline TileIndex GetShipDepotNorthTile(TileIndex t)
|
static inline TileIndex GetShipDepotNorthTile(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsShipDepot(t));
|
assert_tile(IsShipDepot(t), t);
|
||||||
TileIndex tile2 = GetOtherShipDepotTile(t);
|
TileIndex tile2 = GetOtherShipDepotTile(t);
|
||||||
|
|
||||||
return t < tile2 ? t : tile2;
|
return t < tile2 ? t : tile2;
|
||||||
@@ -308,7 +308,7 @@ static inline bool IsLock(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline DiagDirection GetLockDirection(TileIndex t)
|
static inline DiagDirection GetLockDirection(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsLock(t));
|
assert_tile(IsLock(t), t);
|
||||||
return (DiagDirection)GB(_m[t].m5, WBL_LOCK_ORIENT_BEGIN, WBL_LOCK_ORIENT_COUNT);
|
return (DiagDirection)GB(_m[t].m5, WBL_LOCK_ORIENT_BEGIN, WBL_LOCK_ORIENT_COUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -320,7 +320,7 @@ static inline DiagDirection GetLockDirection(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline byte GetLockPart(TileIndex t)
|
static inline byte GetLockPart(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsLock(t));
|
assert_tile(IsLock(t), t);
|
||||||
return GB(_m[t].m5, WBL_LOCK_PART_BEGIN, WBL_LOCK_PART_COUNT);
|
return GB(_m[t].m5, WBL_LOCK_PART_BEGIN, WBL_LOCK_PART_COUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -332,7 +332,7 @@ static inline byte GetLockPart(TileIndex t)
|
|||||||
*/
|
*/
|
||||||
static inline byte GetWaterTileRandomBits(TileIndex t)
|
static inline byte GetWaterTileRandomBits(TileIndex t)
|
||||||
{
|
{
|
||||||
assert(IsTileType(t, MP_WATER));
|
assert_tile(IsTileType(t, MP_WATER), t);
|
||||||
return _m[t].m4;
|
return _m[t].m4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user