summaryrefslogtreecommitdiff
path: root/src/town_cmd.cpp
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-06-03 16:55:08 +0200
committerPatric Stout <github@truebrain.nl>2021-06-03 17:30:00 +0200
commit28e90769f74e55ea7c8f75146d5b33e0aa777da8 (patch)
treeeeff0974346ef9da7cbc2b33b040d016c341ff0b /src/town_cmd.cpp
parentf8dd5dd00a7aa3cc5769b4bce0a1b7a63073c8ce (diff)
downloadopenttd-28e90769f74e55ea7c8f75146d5b33e0aa777da8.tar.xz
Codechange: use "[[maybe_unused]]" instead of a wide variety of other ways we had
While at it, replace OTTD_ASSERT with WITH_ASSERT, as this is always set if assert() is valid. No matter if NDEBUG is set or not.
Diffstat (limited to 'src/town_cmd.cpp')
-rw-r--r--src/town_cmd.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index bc29d3917..d397825af 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -106,13 +106,17 @@ Town::~Town()
* and remove from list of sorted towns */
CloseWindowById(WC_TOWN_VIEW, this->index);
- /* Check no industry is related to us. */
#ifdef WITH_ASSERT
- for (const Industry *i : Industry::Iterate()) assert(i->town != this);
+ /* Check no industry is related to us. */
+ for (const Industry *i : Industry::Iterate()) {
+ assert(i->town != this);
+ }
/* ... and no object is related to us. */
- for (const Object *o : Object::Iterate()) assert(o->town != this);
-#endif
+ for (const Object *o : Object::Iterate()) {
+ assert(o->town != this);
+ }
+#endif /* WITH_ASSERT */
/* Check no tile is related to us. */
for (TileIndex tile = 0; tile < MapSize(); ++tile) {
@@ -2177,8 +2181,7 @@ static Town *CreateRandomTown(uint attempts, uint32 townnameparts, TownSize size
if (t->cache.population > 0) return t;
Backup<CompanyID> cur_company(_current_company, OWNER_TOWN, FILE_LINE);
- CommandCost rc = DoCommand(t->xy, t->index, 0, DC_EXEC, CMD_DELETE_TOWN);
- (void)rc; // assert only
+ [[maybe_unused]] CommandCost rc = DoCommand(t->xy, t->index, 0, DC_EXEC, CMD_DELETE_TOWN);
cur_company.Restore();
assert(rc.Succeeded());
@@ -2279,8 +2282,7 @@ HouseZonesBits GetTownRadiusGroup(const Town *t, TileIndex tile)
*/
static inline void ClearMakeHouseTile(TileIndex tile, Town *t, byte counter, byte stage, HouseID type, byte random_bits)
{
- CommandCost cc = DoCommand(tile, 0, 0, DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_LANDSCAPE_CLEAR);
- (void)cc; // assert only
+ [[maybe_unused]] CommandCost cc = DoCommand(tile, 0, 0, DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_LANDSCAPE_CLEAR);
assert(cc.Succeeded());
IncreaseBuildingCount(t, type);