1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-06 17:41:04 +00:00

Some globals (un-)init fixes

This commit is contained in:
sfan5 2024-04-11 13:54:09 +02:00
parent 2af5191070
commit d8190e1c5f
16 changed files with 58 additions and 62 deletions

View file

@ -27,16 +27,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "irrlicht_changes/CGUITTFont.h"
#include "util/numeric.h" // rangelim
/** maximum size distance for getting a "similar" font size */
#define MAX_FONT_SIZE_OFFSET 10
/** reference to access font engine, has to be initialized by main */
FontEngine* g_fontengine = NULL;
FontEngine *g_fontengine = nullptr;
/** callback to be used on change of font size setting */
static void font_setting_changed(const std::string &name, void *userdata)
{
g_fontengine->readSettings();
if (g_fontengine)
g_fontengine->readSettings();
}
/******************************************************************************/
@ -226,7 +224,7 @@ gui::IGUIFont *FontEngine::initFont(const FontSpec &spec)
u16 divisible_by = g_settings->getU16(setting_prefix + "font_size_divisible_by");
if (divisible_by > 1) {
size = std::max<u32>(
std::round((double)size / divisible_by) * divisible_by, divisible_by);
std::round((float)size / divisible_by) * divisible_by, divisible_by);
}
sanity_check(size != 0);