diff options
-rw-r--r-- | src/3rdparty/squirrel/squirrel/sqstate.cpp | 4 | ||||
-rw-r--r-- | src/3rdparty/squirrel/squirrel/sqvm.cpp | 14 | ||||
-rw-r--r-- | src/spritecache.cpp | 2 | ||||
-rw-r--r-- | src/tgp.cpp | 4 | ||||
-rw-r--r-- | src/town_cmd.cpp | 2 | ||||
-rw-r--r-- | src/townname.cpp | 2 | ||||
-rw-r--r-- | src/vehicle.cpp | 2 | ||||
-rw-r--r-- | src/widget.cpp | 4 |
8 files changed, 17 insertions, 17 deletions
diff --git a/src/3rdparty/squirrel/squirrel/sqstate.cpp b/src/3rdparty/squirrel/squirrel/sqstate.cpp index eaad6a3f7..8233ad178 100644 --- a/src/3rdparty/squirrel/squirrel/sqstate.cpp +++ b/src/3rdparty/squirrel/squirrel/sqstate.cpp @@ -252,7 +252,7 @@ SQInteger SQSharedState::CollectGarbage(SQVM *vm) SQVM *vms = _thread(_root_vm); vms->Mark(&tchain); -#ifndef NDEBUG +#ifdef WITH_ASSERT SQInteger x = _table(_thread(_root_vm)->_roottable)->CountUsed(); #endif _refs_table.Mark(&tchain); @@ -291,7 +291,7 @@ SQInteger SQSharedState::CollectGarbage(SQVM *vm) t = t->_next; } _gc_chain = tchain; -#ifndef NDEBUG +#ifdef WITH_ASSERT SQInteger z = _table(_thread(_root_vm)->_roottable)->CountUsed(); assert(z == x); #endif diff --git a/src/3rdparty/squirrel/squirrel/sqvm.cpp b/src/3rdparty/squirrel/squirrel/sqvm.cpp index 5419c94cf..ad07ac512 100644 --- a/src/3rdparty/squirrel/squirrel/sqvm.cpp +++ b/src/3rdparty/squirrel/squirrel/sqvm.cpp @@ -1460,7 +1460,7 @@ bool SQVM::DeleteSlot(const SQObjectPtr &self,const SQObjectPtr &key,SQObjectPtr } } res = t; - } + } break; default: Raise_Error("attempt to delete a slot from a %s",GetTypeName(self)); @@ -1471,7 +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) { -#ifndef NDEBUG +#ifdef WITH_ASSERT SQInteger prevstackbase = _stackbase; #endif switch(type(closure)) { @@ -1482,13 +1482,13 @@ bool SQVM::Call(SQObjectPtr &closure,SQInteger nparams,SQInteger stackbase,SQObj bool ret = Execute(closure, _top - nparams, nparams, stackbase,outres,raiseerror); this->_can_suspend = backup_suspend; return ret; - } + } break; - case OT_NATIVECLOSURE:{ + case OT_NATIVECLOSURE: { bool suspend; return CallNative(_nativeclosure(closure), nparams, stackbase, outres,suspend); - } + } break; case OT_CLASS: { SQObjectPtr constr; @@ -1499,12 +1499,12 @@ bool SQVM::Call(SQObjectPtr &closure,SQInteger nparams,SQInteger stackbase,SQObj return Call(constr,nparams,stackbase,temp,raiseerror,false); } return true; - } + } break; default: return false; } -#ifndef NDEBUG +#ifdef WITH_ASSERT if(!_suspended) { assert(_stackbase == prevstackbase); } diff --git a/src/spritecache.cpp b/src/spritecache.cpp index 1c7cc6f78..288f74af4 100644 --- a/src/spritecache.cpp +++ b/src/spritecache.cpp @@ -229,7 +229,7 @@ static void ResizeSpriteOut(SpriteLoader::Sprite *sprite, ZoomLevel zoom) SpriteLoader::CommonPixel *dst = sprite[zoom].data; const SpriteLoader::CommonPixel *src = sprite[zoom - 1].data; -#ifndef NDEBUG +#ifdef WITH_ASSERT const SpriteLoader::CommonPixel *src_end = src + sprite[zoom - 1].height * sprite[zoom - 1].width; #endif diff --git a/src/tgp.cpp b/src/tgp.cpp index 39fda6e6b..e23b2643d 100644 --- a/src/tgp.cpp +++ b/src/tgp.cpp @@ -658,7 +658,7 @@ static void HeightMapCurves(uint level) for (uint t = 0; t < lengthof(curve_maps); t++) { if (!HasBit(corner_bits, t)) continue; -#ifndef NDEBUG +#ifdef WITH_ASSERT bool found = false; #endif const control_point_t *cm = curve_maps[t].list; @@ -668,7 +668,7 @@ static void HeightMapCurves(uint level) if (*h >= p1.x && *h < p2.x) { ht[t] = p1.y + (*h - p1.x) * (p2.y - p1.y) / (p2.x - p1.x); -#ifndef NDEBUG +#ifdef WITH_ASSERT found = true; #endif break; diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 023063c1f..43f3523f8 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -107,7 +107,7 @@ Town::~Town() DeleteWindowById(WC_TOWN_VIEW, this->index); /* Check no industry is related to us. */ -#ifndef NDEBUG +#ifdef WITH_ASSERT for (const Industry *i : Industry::Iterate()) assert(i->town != this); /* ... and no object is related to us. */ diff --git a/src/townname.cpp b/src/townname.cpp index 082c40f75..519391f14 100644 --- a/src/townname.cpp +++ b/src/townname.cpp @@ -600,7 +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); } -#ifndef NDEBUG +#ifdef WITH_ASSERT const char *orig = buf; #endif diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 8ffaea408..a9af24c55 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -953,7 +953,7 @@ void CallVehicleTicks() PerformanceAccumulator::Reset(PFE_GL_AIRCRAFT); for (Vehicle *v : Vehicle::Iterate()) { -#ifndef NDEBUG +#ifdef WITH_ASSERT size_t vehicle_index = v->index; #endif diff --git a/src/widget.cpp b/src/widget.cpp index b06562108..9de848a63 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -1156,7 +1156,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); } /* 1b. Make the container higher if needed to accommodate all children nicely. */ -#ifndef NDEBUG +#ifdef WITH_ASSERT uint max_smallest = this->smallest_y + 3 * max_vert_fill; // Upper limit to computing smallest height. #endif uint cur_height = this->smallest_y; @@ -1323,7 +1323,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); } /* 1b. Make the container wider if needed to accommodate all children nicely. */ -#ifndef NDEBUG +#ifdef WITH_ASSERT uint max_smallest = this->smallest_x + 3 * max_hor_fill; // Upper limit to computing smallest height. #endif uint cur_width = this->smallest_x; |