Change various asserts to not be included in release builds

This commit is contained in:
Jonathan G Rennison
2022-10-22 12:34:54 +01:00
parent 071ac374e8
commit 29a1e49c28
53 changed files with 522 additions and 520 deletions

View File

@@ -34,7 +34,7 @@ enum ClearGround {
*/
static inline bool IsSnowTile(TileIndex t)
{
assert_tile(IsTileType(t, MP_CLEAR), t);
dbg_assert_tile(IsTileType(t, MP_CLEAR), t);
return HasBit(_m[t].m3, 4);
}
@@ -46,7 +46,7 @@ static inline bool IsSnowTile(TileIndex t)
*/
static inline ClearGround GetRawClearGround(TileIndex t)
{
assert_tile(IsTileType(t, MP_CLEAR), t);
dbg_assert_tile(IsTileType(t, MP_CLEAR), t);
return (ClearGround)GB(_m[t].m5, 2, 3);
}
@@ -82,7 +82,7 @@ static inline bool IsClearGround(TileIndex t, ClearGround ct)
*/
static inline uint GetClearDensity(TileIndex t)
{
assert_tile(IsTileType(t, MP_CLEAR), t);
dbg_assert_tile(IsTileType(t, MP_CLEAR), t);
return GB(_m[t].m5, 0, 2);
}
@@ -94,7 +94,7 @@ static inline uint GetClearDensity(TileIndex t)
*/
static inline void AddClearDensity(TileIndex t, int d)
{
assert_tile(IsTileType(t, MP_CLEAR), t); // XXX incomplete
dbg_assert_tile(IsTileType(t, MP_CLEAR), t); // XXX incomplete
_m[t].m5 += d;
}
@@ -106,7 +106,7 @@ static inline void AddClearDensity(TileIndex t, int d)
*/
static inline void SetClearDensity(TileIndex t, uint d)
{
assert_tile(IsTileType(t, MP_CLEAR), t);
dbg_assert_tile(IsTileType(t, MP_CLEAR), t);
SB(_m[t].m5, 0, 2, d);
}
@@ -119,7 +119,7 @@ static inline void SetClearDensity(TileIndex t, uint d)
*/
static inline uint GetClearCounter(TileIndex t)
{
assert_tile(IsTileType(t, MP_CLEAR), t);
dbg_assert_tile(IsTileType(t, MP_CLEAR), t);
return GB(_m[t].m5, 5, 3);
}
@@ -131,7 +131,7 @@ static inline uint GetClearCounter(TileIndex t)
*/
static inline void AddClearCounter(TileIndex t, int c)
{
assert_tile(IsTileType(t, MP_CLEAR), t); // XXX incomplete
dbg_assert_tile(IsTileType(t, MP_CLEAR), t); // XXX incomplete
_m[t].m5 += c << 5;
}
@@ -143,7 +143,7 @@ static inline void AddClearCounter(TileIndex t, int c)
*/
static inline void SetClearCounter(TileIndex t, uint c)
{
assert_tile(IsTileType(t, MP_CLEAR), t); // XXX incomplete
dbg_assert_tile(IsTileType(t, MP_CLEAR), t); // XXX incomplete
SB(_m[t].m5, 5, 3, c);
}
@@ -157,7 +157,7 @@ static inline void SetClearCounter(TileIndex t, uint c)
*/
static inline void SetClearGroundDensity(TileIndex t, ClearGround type, uint density)
{
assert_tile(IsTileType(t, MP_CLEAR), t); // XXX incomplete
dbg_assert_tile(IsTileType(t, MP_CLEAR), t); // XXX incomplete
_m[t].m5 = 0 << 5 | type << 2 | density;
}
@@ -170,7 +170,7 @@ static inline void SetClearGroundDensity(TileIndex t, ClearGround type, uint den
*/
static inline uint GetFieldType(TileIndex t)
{
assert_tile(GetClearGround(t) == CLEAR_FIELDS, t);
dbg_assert_tile(GetClearGround(t) == CLEAR_FIELDS, t);
return GB(_m[t].m3, 0, 4);
}
@@ -182,7 +182,7 @@ static inline uint GetFieldType(TileIndex t)
*/
static inline void SetFieldType(TileIndex t, uint f)
{
assert_tile(GetClearGround(t) == CLEAR_FIELDS, t); // XXX incomplete
dbg_assert_tile(GetClearGround(t) == CLEAR_FIELDS, t); // XXX incomplete
SB(_m[t].m3, 0, 4, f);
}
@@ -194,7 +194,7 @@ static inline void SetFieldType(TileIndex t, uint f)
*/
static inline IndustryID GetIndustryIndexOfField(TileIndex t)
{
assert_tile(GetClearGround(t) == CLEAR_FIELDS, t);
dbg_assert_tile(GetClearGround(t) == CLEAR_FIELDS, t);
return(IndustryID) _m[t].m2;
}
@@ -206,7 +206,7 @@ static inline IndustryID GetIndustryIndexOfField(TileIndex t)
*/
static inline void SetIndustryIndexOfField(TileIndex t, IndustryID i)
{
assert_tile(GetClearGround(t) == CLEAR_FIELDS, t);
dbg_assert_tile(GetClearGround(t) == CLEAR_FIELDS, t);
_m[t].m2 = i;
}
@@ -220,7 +220,7 @@ static inline void SetIndustryIndexOfField(TileIndex t, IndustryID i)
*/
static inline uint GetFence(TileIndex t, DiagDirection side)
{
assert_tile(IsClearGround(t, CLEAR_FIELDS), t);
dbg_assert_tile(IsClearGround(t, CLEAR_FIELDS), t);
switch (side) {
default: NOT_REACHED();
case DIAGDIR_SE: return GB(_m[t].m4, 2, 3);
@@ -239,7 +239,7 @@ static inline uint GetFence(TileIndex t, DiagDirection side)
*/
static inline void SetFence(TileIndex t, DiagDirection side, uint h)
{
assert_tile(IsClearGround(t, CLEAR_FIELDS), t);
dbg_assert_tile(IsClearGround(t, CLEAR_FIELDS), t);
switch (side) {
default: NOT_REACHED();
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)
{
assert_tile(GetClearGround(t) != CLEAR_SNOW, t);
dbg_assert_tile(GetClearGround(t) != CLEAR_SNOW, t);
SetBit(_m[t].m3, 4);
if (GetRawClearGround(t) == CLEAR_FIELDS) {
SetClearGroundDensity(t, CLEAR_GRASS, density);
@@ -315,7 +315,7 @@ static inline void MakeSnow(TileIndex t, uint density = 0)
*/
static inline void ClearSnow(TileIndex t)
{
assert_tile(GetClearGround(t) == CLEAR_SNOW, t);
dbg_assert_tile(GetClearGround(t) == CLEAR_SNOW, t);
ClrBit(_m[t].m3, 4);
SetClearDensity(t, 3);
}