summaryrefslogtreecommitdiff
path: root/src/guiChatConsole.cpp
diff options
context:
space:
mode:
authorKahrl <kahrl@gmx.net>2015-01-17 20:05:45 +0100
committerKahrl <kahrl@gmx.net>2015-01-18 13:16:01 +0100
commite80a044818714da480fe6f108f0439f67380fca6 (patch)
tree3fd92af0f03dcfcccb28bf958b15bca4366c6ee8 /src/guiChatConsole.cpp
parent29514918f81e50e9a87659dd930f4e8369d73041 (diff)
downloadminetest-e80a044818714da480fe6f108f0439f67380fca6.tar.gz
minetest-e80a044818714da480fe6f108f0439f67380fca6.tar.bz2
minetest-e80a044818714da480fe6f108f0439f67380fca6.zip
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.
Diffstat (limited to 'src/guiChatConsole.cpp')
-rw-r--r--src/guiChatConsole.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/guiChatConsole.cpp b/src/guiChatConsole.cpp
index 918f9528b..19d9e3007 100644
--- a/src/guiChatConsole.cpp
+++ b/src/guiChatConsole.cpp
@@ -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);