mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Fix use of uninit data in Sky and (potentially) GUIChatConsole constructors
Clean up nearby code a bit As a small side effect, it is now possible to add a background texture to the chat console by simply providing background_chat.jpg, it is no longer necessary to also add "console_color =" to minetest.conf.
This commit is contained in:
parent
29514918f8
commit
e80a044818
4 changed files with 25 additions and 25 deletions
|
@ -72,25 +72,22 @@ GUIChatConsole::GUIChatConsole(
|
|||
m_animate_time_old = getTimeMs();
|
||||
|
||||
// load background settings
|
||||
bool console_color_set = !g_settings->get("console_color").empty();
|
||||
s32 console_alpha = g_settings->getS32("console_alpha");
|
||||
m_background_color.setAlpha(clamp_u8(console_alpha));
|
||||
|
||||
// load the background texture depending on settings
|
||||
m_background_color.setAlpha(clamp_u8(console_alpha));
|
||||
if (console_color_set)
|
||||
{
|
||||
ITextureSource *tsrc = client->getTextureSource();
|
||||
if (tsrc->isKnownSourceImage("background_chat.jpg")) {
|
||||
m_background = tsrc->getTexture("background_chat.jpg");
|
||||
m_background_color.setRed(255);
|
||||
m_background_color.setGreen(255);
|
||||
m_background_color.setBlue(255);
|
||||
} else {
|
||||
v3f console_color = g_settings->getV3F("console_color");
|
||||
m_background_color.setRed(clamp_u8(myround(console_color.X)));
|
||||
m_background_color.setGreen(clamp_u8(myround(console_color.Y)));
|
||||
m_background_color.setBlue(clamp_u8(myround(console_color.Z)));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_background = env->getVideoDriver()->getTexture(getTexturePath("background_chat.jpg").c_str());
|
||||
m_background_color.setRed(255);
|
||||
m_background_color.setGreen(255);
|
||||
m_background_color.setBlue(255);
|
||||
}
|
||||
|
||||
m_font = g_fontengine->getFont(FONT_SIZE_UNSPECIFIED, FM_Mono);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue