diff options
author | Craig Robbins <kde.psych@gmail.com> | 2015-03-06 20:21:51 +1000 |
---|---|---|
committer | Craig Robbins <kde.psych@gmail.com> | 2015-03-07 22:41:47 +1000 |
commit | ced6d20295a8263757d57c02a07ffcb66688a163 (patch) | |
tree | a44527357c1ffccb88bf479686735aef168d15c1 /src/mapnode.cpp | |
parent | a603a767877b94b4d3bc4d3de8d762fbc56a583d (diff) | |
download | minetest-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/mapnode.cpp')
-rw-r--r-- | src/mapnode.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/mapnode.cpp b/src/mapnode.cpp index 44525b644..0335755e9 100644 --- a/src/mapnode.cpp +++ b/src/mapnode.cpp @@ -71,7 +71,7 @@ void MapNode::setLight(enum LightBank bank, u8 a_light, INodeDefManager *nodemgr param1 |= (a_light & 0x0f)<<4; } else - assert(0); + assert("Invalid light bank" == NULL); } bool MapNode::isLightDayNightEq(INodeDefManager *nodemgr) const @@ -516,8 +516,8 @@ void MapNode::serializeBulk(std::ostream &os, int version, if(!ser_ver_supported(version)) throw VersionMismatchException("ERROR: MapNode format not supported"); - assert(content_width == 2); - assert(params_width == 2); + sanity_check(content_width == 2); + sanity_check(params_width == 2); // Can't do this anymore; we have 16-bit dynamically allocated node IDs // in memory; conversion just won't work in this direction. @@ -563,9 +563,10 @@ void MapNode::deSerializeBulk(std::istream &is, int version, if(!ser_ver_supported(version)) throw VersionMismatchException("ERROR: MapNode format not supported"); - assert(version >= 22); - assert(content_width == 1 || content_width == 2); - assert(params_width == 2); + if (version < 22 + || (content_width != 1 && content_width != 2) + || params_width != 2) + FATAL_ERROR("Deserialize bulk node data error"); // Uncompress or read data u32 len = nodecount * (content_width + params_width); |