]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/gui/guiChatConsole.cpp
Cheat Menu Improvements Change
[dragonfireclient.git] / src / gui / guiChatConsole.cpp
index b194834e297d3f452546acea71aaf81184300f0a..8de00c12f210fb708826f9a9e4671d99ec7f5de8 100644 (file)
@@ -19,14 +19,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include "guiChatConsole.h"
 #include "chat.h"
-#include "client.h"
+#include "client/client.h"
 #include "debug.h"
 #include "gettime.h"
-#include "keycode.h"
+#include "client/keycode.h"
 #include "settings.h"
 #include "porting.h"
 #include "client/tile.h"
-#include "fontengine.h"
+#include "client/fontengine.h"
 #include "log.h"
 #include "gettext.h"
 #include <string>
@@ -74,10 +74,12 @@ GUIChatConsole::GUIChatConsole(
                m_background_color.setBlue(clamp_u8(myround(console_color.Z)));
        }
 
-       m_font = g_fontengine->getFont(FONT_SIZE_UNSPECIFIED, FM_Mono);
+       u16 chat_font_size = g_settings->getU16("chat_font_size");
+       m_font = g_fontengine->getFont(chat_font_size != 0 ?
+               chat_font_size : FONT_SIZE_UNSPECIFIED, FM_Mono);
 
        if (!m_font) {
-               errorstream << "GUIChatConsole: Unable to load mono font ";
+               errorstream << "GUIChatConsole: Unable to load mono font" << std::endl;
        } else {
                core::dimension2d<u32> dim = m_font->getDimension(L"M");
                m_fontsize = v2u32(dim.Width, dim.Height);
@@ -139,7 +141,7 @@ f32 GUIChatConsole::getDesiredHeight() const
        return m_desired_height_fraction;
 }
 
-void GUIChatConsole::replaceAndAddToHistory(std::wstring line)
+void GUIChatConsole::replaceAndAddToHistory(const std::wstring &line)
 {
        ChatPrompt& prompt = m_chat_backend->getPrompt();
        prompt.addToHistory(prompt.getLine());
@@ -322,9 +324,9 @@ void GUIChatConsole::drawText()
                        core::rect<s32> destrect(
                                x, y, x + m_fontsize.X * fragment.text.size(), y + m_fontsize.Y);
 
-
-                       #if USE_FREETYPE
-                       // Draw colored text if FreeType is enabled
+#if USE_FREETYPE
+                       if (m_font->getType() == irr::gui::EGFT_CUSTOM) {
+                               // Draw colored text if FreeType is enabled
                                irr::gui::CGUITTFont *tmp = dynamic_cast<irr::gui::CGUITTFont *>(m_font);
                                tmp->draw(
                                        fragment.text,
@@ -333,8 +335,10 @@ void GUIChatConsole::drawText()
                                        false,
                                        false,
                                        &AbsoluteClippingRect);
-                       #else
-                       // Otherwise use standard text
+                       } else 
+#endif
+                       {
+                               // Otherwise use standard text
                                m_font->draw(
                                        fragment.text.c_str(),
                                        destrect,
@@ -342,7 +346,7 @@ void GUIChatConsole::drawText()
                                        false,
                                        false,
                                        &AbsoluteClippingRect);
-                       #endif
+                       }
                }
        }
 }