summaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
authorCraig Robbins <kde.psych@gmail.com>2015-03-06 20:21:51 +1000
committerCraig Robbins <kde.psych@gmail.com>2015-03-07 22:41:47 +1000
commitced6d20295a8263757d57c02a07ffcb66688a163 (patch)
treea44527357c1ffccb88bf479686735aef168d15c1 /src/map.cpp
parenta603a767877b94b4d3bc4d3de8d762fbc56a583d (diff)
downloadminetest-ced6d20295a8263757d57c02a07ffcb66688a163.tar.gz
minetest-ced6d20295a8263757d57c02a07ffcb66688a163.tar.bz2
minetest-ced6d20295a8263757d57c02a07ffcb66688a163.zip
For usages of assert() that are meant to persist in Release builds (when NDEBUG is defined), replace those usages with persistent alternatives
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/map.cpp b/src/map.cpp
index e80c82522..14a237c0a 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -767,8 +767,7 @@ void Map::updateLighting(enum LightBank bank,
}
else
{
- // Invalid lighting bank
- assert(0);
+ assert("Invalid lighting bank" == NULL);
}
/*infostream<<"Bottom for sunlight-propagated block ("
@@ -783,7 +782,7 @@ void Map::updateLighting(enum LightBank bank,
}
catch(InvalidPositionException &e)
{
- assert(0);
+ FATAL_ERROR("Invalid position");
}
}
@@ -1220,7 +1219,7 @@ void Map::removeNodeAndUpdate(v3s16 p,
n.setLight(LIGHTBANK_DAY, 0, ndef);
setNode(p, n);
} else {
- assert(0);
+ FATAL_ERROR("Invalid position");
}
}
@@ -2180,7 +2179,7 @@ bool ServerMap::initBlockMake(BlockMakeData *data, v3s16 blockpos)
v2s16 sectorpos(x, z);
// Sector metadata is loaded from disk if not already loaded.
ServerMapSector *sector = createSector(sectorpos);
- assert(sector);
+ FATAL_ERROR_IF(sector == NULL, "createSector() failed");
(void) sector;
for(s16 y=blockpos_min.Y-extra_borders.Y;
@@ -2628,7 +2627,7 @@ MapBlock * ServerMap::createBlock(v3s16 p)
lighting on blocks for them.
*/
ServerMapSector *sector;
- try{
+ try {
sector = (ServerMapSector*)createSector(p2d);
assert(sector->getId() == MAPSECTOR_SERVER);
}
@@ -2861,9 +2860,10 @@ v2s16 ServerMap::getSectorPos(std::string dirname)
}
else
{
- assert(false);
+ r = -1;
}
- assert(r == 2);
+
+ FATAL_ERROR_IF(r != 2, "getSectorPos()");
v2s16 pos((s16)x, (s16)y);
return pos;
}
@@ -3368,7 +3368,7 @@ void ServerMap::loadBlock(std::string sectordir, std::string blockfile,
<<"what()="<<e.what()
<<std::endl;
// Ignoring. A new one will be generated.
- assert(0);
+ abort();
// TODO: Backup file; name is in fullpath.
}
@@ -3438,7 +3438,6 @@ void ServerMap::loadBlock(std::string *blob, v3s16 p3d, MapSector *sector, bool
<<"(ignore_world_load_errors)"<<std::endl;
} else {
throw SerializationError("Invalid block data in database");
- //assert(0);
}
}
}