1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

For usages of assert() that are meant to persist in Release builds (when NDEBUG is defined), replace those usages with persistent alternatives

This commit is contained in:
Craig Robbins 2015-03-06 20:21:51 +10:00
parent a603a76787
commit ced6d20295
62 changed files with 299 additions and 294 deletions

View file

@ -49,7 +49,7 @@ void LuaABM::trigger(ServerEnvironment *env, v3s16 p, MapNode n,
scriptIface->realityCheck();
lua_State *L = scriptIface->getStack();
assert(lua_checkstack(L, 20));
sanity_check(lua_checkstack(L, 20));
StackUnroller stack_unroller(L);
lua_pushcfunction(L, script_error_handler);
@ -65,7 +65,7 @@ void LuaABM::trigger(ServerEnvironment *env, v3s16 p, MapNode n,
lua_pushnumber(L, m_id);
lua_gettable(L, -2);
if(lua_isnil(L, -1))
assert(0);
FATAL_ERROR("");
lua_remove(L, -2); // Remove registered_abms
// Call action
@ -459,7 +459,7 @@ int ModApiEnvMod::l_set_timeofday(lua_State *L)
// Do it
float timeofday_f = luaL_checknumber(L, 1);
assert(timeofday_f >= 0.0 && timeofday_f <= 1.0);
sanity_check(timeofday_f >= 0.0 && timeofday_f <= 1.0);
int timeofday_mh = (int)(timeofday_f * 24000.0);
// This should be set directly in the environment but currently
// such changes aren't immediately sent to the clients, so call