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/fontengine.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/fontengine.cpp')
-rw-r--r-- | src/fontengine.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/fontengine.cpp b/src/fontengine.cpp index 3b82a3c47..fa30b4038 100644 --- a/src/fontengine.cpp +++ b/src/fontengine.cpp @@ -55,9 +55,9 @@ FontEngine::FontEngine(Settings* main_settings, gui::IGUIEnvironment* env) : m_default_size[i] = (FontMode) FONT_SIZE_UNSPECIFIED; } - assert(m_settings != NULL); - assert(m_env != NULL); - assert(m_env->getSkin() != NULL); + assert(m_settings != NULL); // pre-condition + assert(m_env != NULL); // pre-condition + assert(m_env->getSkin() != NULL); // pre-condition m_currentMode = FM_Simple; @@ -172,7 +172,7 @@ unsigned int FontEngine::getTextHeight(unsigned int font_size, FontMode mode) if (font == NULL) { font = m_env->getSkin()->getFont(); } - assert(font != NULL); + FATAL_ERROR_IF(font == NULL, "Could not get skin font"); return font->getDimension(L"Some unimportant example String").Height; } @@ -187,7 +187,7 @@ unsigned int FontEngine::getTextWidth(const std::wstring& text, if (font == NULL) { font = m_env->getSkin()->getFont(); } - assert(font != NULL); + FATAL_ERROR_IF(font == NULL, "Could not get font"); return font->getDimension(text.c_str()).Width; } @@ -202,7 +202,7 @@ unsigned int FontEngine::getLineHeight(unsigned int font_size, FontMode mode) if (font == NULL) { font = m_env->getSkin()->getFont(); } - assert(font != NULL); + FATAL_ERROR_IF(font == NULL, "Could not get font"); return font->getDimension(L"Some unimportant example String").Height + font->getKerningHeight(); @@ -255,7 +255,7 @@ void FontEngine::updateSkin() // If we did fail to create a font our own make irrlicht find a default one font = m_env->getSkin()->getFont(); - assert(font); + FATAL_ERROR_IF(font == NULL, "Could not create/get font"); u32 text_height = font->getDimension(L"Hello, world!").Height; infostream << "text_height=" << text_height << std::endl; @@ -355,7 +355,7 @@ void FontEngine::initFont(unsigned int basesize, FontMode mode) /** initialize a font without freetype */ void FontEngine::initSimpleFont(unsigned int basesize, FontMode mode) { - assert((mode == FM_Simple) || (mode == FM_SimpleMono)); + assert(mode == FM_Simple || mode == FM_SimpleMono); // pre-condition std::string font_path = ""; if (mode == FM_Simple) { |