mirror of https://github.com/OpenTTD/OpenTTD.git
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.
This commit is contained in:
parent
f8dd5dd00a
commit
28e90769f7
|
@ -835,8 +835,7 @@ public:
|
||||||
nkeys++;
|
nkeys++;
|
||||||
SQInteger val = _fs->PopTarget();
|
SQInteger val = _fs->PopTarget();
|
||||||
SQInteger key = _fs->PopTarget();
|
SQInteger key = _fs->PopTarget();
|
||||||
SQInteger attrs = hasattrs ? _fs->PopTarget():-1;
|
[[maybe_unused]] SQInteger attrs = hasattrs ? _fs->PopTarget():-1;
|
||||||
(void)attrs; // assert only
|
|
||||||
assert((hasattrs && attrs == key-1) || !hasattrs);
|
assert((hasattrs && attrs == key-1) || !hasattrs);
|
||||||
unsigned char flags = (hasattrs?NEW_SLOT_ATTRIBUTES_FLAG:0)|(isstatic?NEW_SLOT_STATIC_FLAG:0);
|
unsigned char flags = (hasattrs?NEW_SLOT_ATTRIBUTES_FLAG:0)|(isstatic?NEW_SLOT_STATIC_FLAG:0);
|
||||||
SQInteger table = _fs->TopTarget(); //<<BECAUSE OF THIS NO COMMON EMIT FUNC IS POSSIBLE
|
SQInteger table = _fs->TopTarget(); //<<BECAUSE OF THIS NO COMMON EMIT FUNC IS POSSIBLE
|
||||||
|
|
|
@ -1471,9 +1471,7 @@ bool SQVM::DeleteSlot(const SQObjectPtr &self,const SQObjectPtr &key,SQObjectPtr
|
||||||
|
|
||||||
bool SQVM::Call(SQObjectPtr &closure,SQInteger nparams,SQInteger stackbase,SQObjectPtr &outres,SQBool raiseerror,SQBool can_suspend)
|
bool SQVM::Call(SQObjectPtr &closure,SQInteger nparams,SQInteger stackbase,SQObjectPtr &outres,SQBool raiseerror,SQBool can_suspend)
|
||||||
{
|
{
|
||||||
#ifdef WITH_ASSERT
|
[[maybe_unused]] SQInteger prevstackbase = _stackbase;
|
||||||
SQInteger prevstackbase = _stackbase;
|
|
||||||
#endif
|
|
||||||
switch(type(closure)) {
|
switch(type(closure)) {
|
||||||
case OT_CLOSURE: {
|
case OT_CLOSURE: {
|
||||||
assert(!can_suspend || this->_can_suspend);
|
assert(!can_suspend || this->_can_suspend);
|
||||||
|
@ -1504,11 +1502,9 @@ bool SQVM::Call(SQObjectPtr &closure,SQInteger nparams,SQInteger stackbase,SQObj
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#ifdef WITH_ASSERT
|
|
||||||
if(!_suspended) {
|
if(!_suspended) {
|
||||||
assert(_stackbase == prevstackbase);
|
assert(_stackbase == prevstackbase);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -596,8 +596,7 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
|
||||||
assert(RailVehInfo(wagon->engine_type)->railveh_type == RAILVEH_WAGON);
|
assert(RailVehInfo(wagon->engine_type)->railveh_type == RAILVEH_WAGON);
|
||||||
|
|
||||||
/* Sell wagon */
|
/* Sell wagon */
|
||||||
CommandCost ret = DoCommand(0, wagon->index, 0, DC_EXEC, GetCmdSellVeh(wagon));
|
[[maybe_unused]] CommandCost ret = DoCommand(0, wagon->index, 0, DC_EXEC, GetCmdSellVeh(wagon));
|
||||||
(void)ret; // assert only
|
|
||||||
assert(ret.Succeeded());
|
assert(ret.Succeeded());
|
||||||
new_vehs[i] = nullptr;
|
new_vehs[i] = nullptr;
|
||||||
|
|
||||||
|
@ -650,8 +649,7 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
|
||||||
assert(Train::From(old_head)->GetNextUnit() == nullptr);
|
assert(Train::From(old_head)->GetNextUnit() == nullptr);
|
||||||
|
|
||||||
for (int i = num_units - 1; i > 0; i--) {
|
for (int i = num_units - 1; i > 0; i--) {
|
||||||
CommandCost ret = CmdMoveVehicle(old_vehs[i], old_head, DC_EXEC | DC_AUTOREPLACE, false);
|
[[maybe_unused]] CommandCost ret = CmdMoveVehicle(old_vehs[i], old_head, DC_EXEC | DC_AUTOREPLACE, false);
|
||||||
(void)ret; // assert only
|
|
||||||
assert(ret.Succeeded());
|
assert(ret.Succeeded());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,9 +33,9 @@ DEFINE_POOL_METHOD(inline)::Pool(const char *name) :
|
||||||
first_free(0),
|
first_free(0),
|
||||||
first_unused(0),
|
first_unused(0),
|
||||||
items(0),
|
items(0),
|
||||||
#ifdef OTTD_ASSERT
|
#ifdef WITH_ASSERT
|
||||||
checked(0),
|
checked(0),
|
||||||
#endif /* OTTD_ASSERT */
|
#endif /* WITH_ASSERT */
|
||||||
cleaning(false),
|
cleaning(false),
|
||||||
data(nullptr),
|
data(nullptr),
|
||||||
alloc_cache(nullptr)
|
alloc_cache(nullptr)
|
||||||
|
@ -133,10 +133,10 @@ DEFINE_POOL_METHOD(void *)::GetNew(size_t size)
|
||||||
{
|
{
|
||||||
size_t index = this->FindFirstFree();
|
size_t index = this->FindFirstFree();
|
||||||
|
|
||||||
#ifdef OTTD_ASSERT
|
#ifdef WITH_ASSERT
|
||||||
assert(this->checked != 0);
|
assert(this->checked != 0);
|
||||||
this->checked--;
|
this->checked--;
|
||||||
#endif /* OTTD_ASSERT */
|
#endif /* WITH_ASSERT */
|
||||||
if (index == NO_FREE_ITEM) {
|
if (index == NO_FREE_ITEM) {
|
||||||
error("%s: no more free items", this->name);
|
error("%s: no more free items", this->name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,9 +90,9 @@ struct Pool : PoolBase {
|
||||||
size_t first_free; ///< No item with index lower than this is free (doesn't say anything about this one!)
|
size_t first_free; ///< No item with index lower than this is free (doesn't say anything about this one!)
|
||||||
size_t first_unused; ///< This and all higher indexes are free (doesn't say anything about first_unused-1 !)
|
size_t first_unused; ///< This and all higher indexes are free (doesn't say anything about first_unused-1 !)
|
||||||
size_t items; ///< Number of used indexes (non-nullptr)
|
size_t items; ///< Number of used indexes (non-nullptr)
|
||||||
#ifdef OTTD_ASSERT
|
#ifdef WITH_ASSERT
|
||||||
size_t checked; ///< Number of items we checked for
|
size_t checked; ///< Number of items we checked for
|
||||||
#endif /* OTTD_ASSERT */
|
#endif /* WITH_ASSERT */
|
||||||
bool cleaning; ///< True if cleaning pool (deleting all items)
|
bool cleaning; ///< True if cleaning pool (deleting all items)
|
||||||
|
|
||||||
Titem **data; ///< Pointer to array of pointers to Titem
|
Titem **data; ///< Pointer to array of pointers to Titem
|
||||||
|
@ -130,9 +130,9 @@ struct Pool : PoolBase {
|
||||||
inline bool CanAllocate(size_t n = 1)
|
inline bool CanAllocate(size_t n = 1)
|
||||||
{
|
{
|
||||||
bool ret = this->items <= Tmax_size - n;
|
bool ret = this->items <= Tmax_size - n;
|
||||||
#ifdef OTTD_ASSERT
|
#ifdef WITH_ASSERT
|
||||||
this->checked = ret ? n : 0;
|
this->checked = ret ? n : 0;
|
||||||
#endif /* OTTD_ASSERT */
|
#endif /* WITH_ASSERT */
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -537,8 +537,7 @@ void SetupEngines()
|
||||||
/* Assert is safe; there won't be more than 256 original vehicles
|
/* Assert is safe; there won't be more than 256 original vehicles
|
||||||
* in any case, and we just cleaned the pool. */
|
* in any case, and we just cleaned the pool. */
|
||||||
assert(Engine::CanAllocateItem());
|
assert(Engine::CanAllocateItem());
|
||||||
const Engine *e = new Engine(eid.type, eid.internal_id);
|
[[maybe_unused]] const Engine *e = new Engine(eid.type, eid.internal_id);
|
||||||
(void)e; // assert only
|
|
||||||
assert(e->index == index);
|
assert(e->index == index);
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,8 +101,7 @@ static void LoadGrfFileIndexed(const char *filename, const SpriteID *index_tbl,
|
||||||
uint end = *index_tbl++;
|
uint end = *index_tbl++;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
bool b = LoadNextSprite(start, file, sprite_id);
|
[[maybe_unused]] bool b = LoadNextSprite(start, file, sprite_id);
|
||||||
(void)b; // Unused without asserts
|
|
||||||
assert(b);
|
assert(b);
|
||||||
sprite_id++;
|
sprite_id++;
|
||||||
} while (++start <= end);
|
} while (++start <= end);
|
||||||
|
|
|
@ -2139,8 +2139,7 @@ static Industry *CreateNewIndustry(TileIndex tile, IndustryType type, IndustryAv
|
||||||
uint32 seed2 = Random();
|
uint32 seed2 = Random();
|
||||||
Industry *i = nullptr;
|
Industry *i = nullptr;
|
||||||
size_t layout_index = RandomRange((uint32)indspec->layouts.size());
|
size_t layout_index = RandomRange((uint32)indspec->layouts.size());
|
||||||
CommandCost ret = CreateNewIndustryHelper(tile, type, DC_EXEC, indspec, layout_index, seed, GB(seed2, 0, 16), OWNER_NONE, creation_type, &i);
|
[[maybe_unused]] CommandCost ret = CreateNewIndustryHelper(tile, type, DC_EXEC, indspec, layout_index, seed, GB(seed2, 0, 16), OWNER_NONE, creation_type, &i);
|
||||||
(void)ret; // assert only
|
|
||||||
assert(i != nullptr || ret.Failed());
|
assert(i != nullptr || ret.Failed());
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,8 +239,7 @@ public:
|
||||||
/** non-const item search & removal */
|
/** non-const item search & removal */
|
||||||
void Pop(Titem_ &item)
|
void Pop(Titem_ &item)
|
||||||
{
|
{
|
||||||
bool ret = TryPop(item);
|
[[maybe_unused]] bool ret = TryPop(item);
|
||||||
(void)ret; // assert only
|
|
||||||
assert(ret);
|
assert(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1045,8 +1045,7 @@ static NPFFoundTargetData NPFRouteInternal(AyStarNode *start1, bool ignore_start
|
||||||
_npf_aystar.user_data = user;
|
_npf_aystar.user_data = user;
|
||||||
|
|
||||||
/* GO! */
|
/* GO! */
|
||||||
int r = _npf_aystar.Main();
|
[[maybe_unused]] int r = _npf_aystar.Main();
|
||||||
(void)r; // assert only
|
|
||||||
assert(r != AYSTAR_STILL_BUSY);
|
assert(r != AYSTAR_STILL_BUSY);
|
||||||
|
|
||||||
if (result.best_bird_dist != 0) {
|
if (result.best_bird_dist != 0) {
|
||||||
|
|
|
@ -1474,14 +1474,12 @@ size_t SlCalcObjMemberLength(const void *object, const SaveLoad &sld)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef OTTD_ASSERT
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether the variable size of the variable in the saveload configuration
|
* Check whether the variable size of the variable in the saveload configuration
|
||||||
* matches with the actual variable size.
|
* matches with the actual variable size.
|
||||||
* @param sld The saveload configuration to test.
|
* @param sld The saveload configuration to test.
|
||||||
*/
|
*/
|
||||||
static bool IsVariableSizeRight(const SaveLoad &sld)
|
[[maybe_unused]] static bool IsVariableSizeRight(const SaveLoad &sld)
|
||||||
{
|
{
|
||||||
switch (sld.cmd) {
|
switch (sld.cmd) {
|
||||||
case SL_VAR:
|
case SL_VAR:
|
||||||
|
@ -1522,13 +1520,9 @@ static bool IsVariableSizeRight(const SaveLoad &sld)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* OTTD_ASSERT */
|
|
||||||
|
|
||||||
bool SlObjectMember(void *ptr, const SaveLoad &sld)
|
bool SlObjectMember(void *ptr, const SaveLoad &sld)
|
||||||
{
|
{
|
||||||
#ifdef OTTD_ASSERT
|
|
||||||
assert(IsVariableSizeRight(sld));
|
assert(IsVariableSizeRight(sld));
|
||||||
#endif
|
|
||||||
|
|
||||||
VarType conv = GB(sld.conv, 0, 8);
|
VarType conv = GB(sld.conv, 0, 8);
|
||||||
switch (sld.cmd) {
|
switch (sld.cmd) {
|
||||||
|
|
|
@ -651,8 +651,7 @@ SQRESULT Squirrel::LoadFile(HSQUIRRELVM vm, const char *filename, SQBool printer
|
||||||
}
|
}
|
||||||
unsigned short bom = 0;
|
unsigned short bom = 0;
|
||||||
if (size >= 2) {
|
if (size >= 2) {
|
||||||
size_t sr = fread(&bom, 1, sizeof(bom), file);
|
[[maybe_unused]] size_t sr = fread(&bom, 1, sizeof(bom), file);
|
||||||
(void)sr; // Inside tar, no point checking return value of fread
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SQLEXREADFUNC func;
|
SQLEXREADFUNC func;
|
||||||
|
|
|
@ -262,9 +262,7 @@ static void ResizeSpriteOut(SpriteLoader::Sprite *sprite, ZoomLevel zoom)
|
||||||
|
|
||||||
SpriteLoader::CommonPixel *dst = sprite[zoom].data;
|
SpriteLoader::CommonPixel *dst = sprite[zoom].data;
|
||||||
const SpriteLoader::CommonPixel *src = sprite[zoom - 1].data;
|
const SpriteLoader::CommonPixel *src = sprite[zoom - 1].data;
|
||||||
#ifdef WITH_ASSERT
|
[[maybe_unused]] const SpriteLoader::CommonPixel *src_end = src + sprite[zoom - 1].height * sprite[zoom - 1].width;
|
||||||
const SpriteLoader::CommonPixel *src_end = src + sprite[zoom - 1].height * sprite[zoom - 1].width;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (uint y = 0; y < sprite[zoom].height; y++) {
|
for (uint y = 0; y < sprite[zoom].height; y++) {
|
||||||
const SpriteLoader::CommonPixel *src_ln = src + sprite[zoom - 1].width;
|
const SpriteLoader::CommonPixel *src_ln = src + sprite[zoom - 1].width;
|
||||||
|
|
|
@ -435,11 +435,6 @@ void NORETURN CDECL error(const char *str, ...) WARN_FORMAT(1, 2);
|
||||||
# define assert(expression) if (unlikely(!(expression))) error("Assertion failed at line %i of %s: %s", __LINE__, __FILE__, #expression);
|
# define assert(expression) if (unlikely(!(expression))) error("Assertion failed at line %i of %s: %s", __LINE__, __FILE__, #expression);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Asserts are enabled if NDEBUG isn't defined or WITH_ASSERT is defined. */
|
|
||||||
#if !defined(NDEBUG) || defined(WITH_ASSERT)
|
|
||||||
# define OTTD_ASSERT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(OPENBSD)
|
#if defined(OPENBSD)
|
||||||
/* OpenBSD uses strcasecmp(3) */
|
/* OpenBSD uses strcasecmp(3) */
|
||||||
# define _stricmp strcasecmp
|
# define _stricmp strcasecmp
|
||||||
|
|
|
@ -658,9 +658,7 @@ static void HeightMapCurves(uint level)
|
||||||
for (uint t = 0; t < lengthof(curve_maps); t++) {
|
for (uint t = 0; t < lengthof(curve_maps); t++) {
|
||||||
if (!HasBit(corner_bits, t)) continue;
|
if (!HasBit(corner_bits, t)) continue;
|
||||||
|
|
||||||
#ifdef WITH_ASSERT
|
[[maybe_unused]] bool found = false;
|
||||||
bool found = false;
|
|
||||||
#endif
|
|
||||||
const control_point_t *cm = curve_maps[t].list;
|
const control_point_t *cm = curve_maps[t].list;
|
||||||
for (uint i = 0; i < curve_maps[t].length - 1; i++) {
|
for (uint i = 0; i < curve_maps[t].length - 1; i++) {
|
||||||
const control_point_t &p1 = cm[i];
|
const control_point_t &p1 = cm[i];
|
||||||
|
|
|
@ -106,13 +106,17 @@ Town::~Town()
|
||||||
* and remove from list of sorted towns */
|
* and remove from list of sorted towns */
|
||||||
CloseWindowById(WC_TOWN_VIEW, this->index);
|
CloseWindowById(WC_TOWN_VIEW, this->index);
|
||||||
|
|
||||||
/* Check no industry is related to us. */
|
|
||||||
#ifdef WITH_ASSERT
|
#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. */
|
/* ... and no object is related to us. */
|
||||||
for (const Object *o : Object::Iterate()) assert(o->town != this);
|
for (const Object *o : Object::Iterate()) {
|
||||||
#endif
|
assert(o->town != this);
|
||||||
|
}
|
||||||
|
#endif /* WITH_ASSERT */
|
||||||
|
|
||||||
/* Check no tile is related to us. */
|
/* Check no tile is related to us. */
|
||||||
for (TileIndex tile = 0; tile < MapSize(); ++tile) {
|
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;
|
if (t->cache.population > 0) return t;
|
||||||
|
|
||||||
Backup<CompanyID> cur_company(_current_company, OWNER_TOWN, FILE_LINE);
|
Backup<CompanyID> cur_company(_current_company, OWNER_TOWN, FILE_LINE);
|
||||||
CommandCost rc = DoCommand(t->xy, t->index, 0, DC_EXEC, CMD_DELETE_TOWN);
|
[[maybe_unused]] CommandCost rc = DoCommand(t->xy, t->index, 0, DC_EXEC, CMD_DELETE_TOWN);
|
||||||
(void)rc; // assert only
|
|
||||||
cur_company.Restore();
|
cur_company.Restore();
|
||||||
assert(rc.Succeeded());
|
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)
|
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);
|
[[maybe_unused]] CommandCost cc = DoCommand(tile, 0, 0, DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_LANDSCAPE_CLEAR);
|
||||||
(void)cc; // assert only
|
|
||||||
assert(cc.Succeeded());
|
assert(cc.Succeeded());
|
||||||
|
|
||||||
IncreaseBuildingCount(t, type);
|
IncreaseBuildingCount(t, type);
|
||||||
|
|
|
@ -600,9 +600,7 @@ static char *MakeCzechTownName(char *buf, const char *last, uint32 seed)
|
||||||
return strecpy(buf, _name_czech_real[SeedModChance(4, lengthof(_name_czech_real), seed)], last);
|
return strecpy(buf, _name_czech_real[SeedModChance(4, lengthof(_name_czech_real), seed)], last);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_ASSERT
|
[[maybe_unused]] const char *orig = buf;
|
||||||
const char *orig = buf;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Probability of prefixes/suffixes
|
/* Probability of prefixes/suffixes
|
||||||
* 0..11 prefix, 12..13 prefix+suffix, 14..17 suffix, 18..31 nothing */
|
* 0..11 prefix, 12..13 prefix+suffix, 14..17 suffix, 18..31 nothing */
|
||||||
|
|
|
@ -1846,8 +1846,7 @@ static void ChangeTileOwner_TunnelBridge(TileIndex tile, Owner old_owner, Owner
|
||||||
if (tt == TRANSPORT_RAIL) {
|
if (tt == TRANSPORT_RAIL) {
|
||||||
/* Since all of our vehicles have been removed, it is safe to remove the rail
|
/* Since all of our vehicles have been removed, it is safe to remove the rail
|
||||||
* bridge / tunnel. */
|
* bridge / tunnel. */
|
||||||
CommandCost ret = DoCommand(tile, 0, 0, DC_EXEC | DC_BANKRUPT, CMD_LANDSCAPE_CLEAR);
|
[[maybe_unused]] CommandCost ret = DoCommand(tile, 0, 0, DC_EXEC | DC_BANKRUPT, CMD_LANDSCAPE_CLEAR);
|
||||||
(void)ret; // assert only
|
|
||||||
assert(ret.Succeeded());
|
assert(ret.Succeeded());
|
||||||
} else {
|
} else {
|
||||||
/* In any other case, we can safely reassign the ownership to OWNER_NONE. */
|
/* In any other case, we can safely reassign the ownership to OWNER_NONE. */
|
||||||
|
|
|
@ -953,9 +953,7 @@ void CallVehicleTicks()
|
||||||
PerformanceAccumulator::Reset(PFE_GL_AIRCRAFT);
|
PerformanceAccumulator::Reset(PFE_GL_AIRCRAFT);
|
||||||
|
|
||||||
for (Vehicle *v : Vehicle::Iterate()) {
|
for (Vehicle *v : Vehicle::Iterate()) {
|
||||||
#ifdef WITH_ASSERT
|
[[maybe_unused]] size_t vehicle_index = v->index;
|
||||||
size_t vehicle_index = v->index;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Vehicle could be deleted in this tick */
|
/* Vehicle could be deleted in this tick */
|
||||||
if (!v->Tick()) {
|
if (!v->Tick()) {
|
||||||
|
|
|
@ -53,8 +53,7 @@ bool VehicleListIdentifier::UnpackIfValid(uint32 data)
|
||||||
/* static */ VehicleListIdentifier VehicleListIdentifier::UnPack(uint32 data)
|
/* static */ VehicleListIdentifier VehicleListIdentifier::UnPack(uint32 data)
|
||||||
{
|
{
|
||||||
VehicleListIdentifier result;
|
VehicleListIdentifier result;
|
||||||
bool ret = result.UnpackIfValid(data);
|
[[maybe_unused]] bool ret = result.UnpackIfValid(data);
|
||||||
(void)ret; // assert only
|
|
||||||
assert(ret);
|
assert(ret);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1272,9 +1272,7 @@ void NWidgetHorizontal::SetupSmallestSize(Window *w, bool init_array)
|
||||||
this->smallest_y = std::max(this->smallest_y, child_wid->smallest_y + child_wid->padding_top + child_wid->padding_bottom);
|
this->smallest_y = std::max(this->smallest_y, child_wid->smallest_y + child_wid->padding_top + child_wid->padding_bottom);
|
||||||
}
|
}
|
||||||
/* 1b. Make the container higher if needed to accommodate all children nicely. */
|
/* 1b. Make the container higher if needed to accommodate all children nicely. */
|
||||||
#ifdef WITH_ASSERT
|
[[maybe_unused]] uint max_smallest = this->smallest_y + 3 * max_vert_fill; // Upper limit to computing smallest height.
|
||||||
uint max_smallest = this->smallest_y + 3 * max_vert_fill; // Upper limit to computing smallest height.
|
|
||||||
#endif
|
|
||||||
uint cur_height = this->smallest_y;
|
uint cur_height = this->smallest_y;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
for (NWidgetBase *child_wid = this->head; child_wid != nullptr; child_wid = child_wid->next) {
|
for (NWidgetBase *child_wid = this->head; child_wid != nullptr; child_wid = child_wid->next) {
|
||||||
|
@ -1439,9 +1437,7 @@ void NWidgetVertical::SetupSmallestSize(Window *w, bool init_array)
|
||||||
this->smallest_x = std::max(this->smallest_x, child_wid->smallest_x + child_wid->padding_left + child_wid->padding_right);
|
this->smallest_x = std::max(this->smallest_x, child_wid->smallest_x + child_wid->padding_left + child_wid->padding_right);
|
||||||
}
|
}
|
||||||
/* 1b. Make the container wider if needed to accommodate all children nicely. */
|
/* 1b. Make the container wider if needed to accommodate all children nicely. */
|
||||||
#ifdef WITH_ASSERT
|
[[maybe_unused]] uint max_smallest = this->smallest_x + 3 * max_hor_fill; // Upper limit to computing smallest height.
|
||||||
uint max_smallest = this->smallest_x + 3 * max_hor_fill; // Upper limit to computing smallest height.
|
|
||||||
#endif
|
|
||||||
uint cur_width = this->smallest_x;
|
uint cur_width = this->smallest_x;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
for (NWidgetBase *child_wid = this->head; child_wid != nullptr; child_wid = child_wid->next) {
|
for (NWidgetBase *child_wid = this->head; child_wid != nullptr; child_wid = child_wid->next) {
|
||||||
|
|
Loading…
Reference in New Issue