aboutsummaryrefslogtreecommitdiff
path: root/src/guiChatConsole.cpp
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2017-08-20 19:37:29 +0200
committerGitHub <noreply@github.com>2017-08-20 19:37:29 +0200
commitae9b5e00989756bb676429530dfe81039009001c (patch)
tree119c9ac4b886c24d42f418e21e4175a942eb95ff /src/guiChatConsole.cpp
parentc8d3d1133945138108aa195e6b3c93b07c6e4fa0 (diff)
downloadhax-minetest-server-ae9b5e00989756bb676429530dfe81039009001c.tar.gz
hax-minetest-server-ae9b5e00989756bb676429530dfe81039009001c.zip
Modernize code: very last fixes (#6290)
Last modernization fixes
Diffstat (limited to 'src/guiChatConsole.cpp')
-rw-r--r--src/guiChatConsole.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/guiChatConsole.cpp b/src/guiChatConsole.cpp
index 0dbddf31c..b194834e2 100644
--- a/src/guiChatConsole.cpp
+++ b/src/guiChatConsole.cpp
@@ -317,9 +317,7 @@ void GUIChatConsole::drawText()
if (y + line_height < 0)
continue;
- for (u32 i = 0; i < line.fragments.size(); ++i)
- {
- const ChatFormattedFragment& fragment = line.fragments[i];
+ for (const ChatFormattedFragment &fragment : line.fragments) {
s32 x = (fragment.column + 1) * m_fontsize.X;
core::rect<s32> destrect(
x, y, x + m_fontsize.X * fragment.text.size(), y + m_fontsize.Y);
@@ -327,7 +325,7 @@ void GUIChatConsole::drawText()
#if USE_FREETYPE
// Draw colored text if FreeType is enabled
- irr::gui::CGUITTFont *tmp = static_cast<irr::gui::CGUITTFont*>(m_font);
+ irr::gui::CGUITTFont *tmp = dynamic_cast<irr::gui::CGUITTFont *>(m_font);
tmp->draw(
fragment.text,
destrect,
@@ -411,8 +409,7 @@ bool GUIChatConsole::OnEvent(const SEvent& event)
if(event.EventType == EET_KEY_INPUT_EVENT && event.KeyInput.PressedDown)
{
// Key input
- if(KeyPress(event.KeyInput) == getKeySetting("keymap_console"))
- {
+ if (KeyPress(event.KeyInput) == getKeySetting("keymap_console")) {
closeConsole();
// inhibit open so the_game doesn't reopen immediately
@@ -420,8 +417,8 @@ bool GUIChatConsole::OnEvent(const SEvent& event)
m_close_on_enter = false;
return true;
}
- else if(event.KeyInput.Key == KEY_ESCAPE)
- {
+
+ if (event.KeyInput.Key == KEY_ESCAPE) {
closeConsoleAtOnce();
m_close_on_enter = false;
// inhibit open so the_game doesn't reopen immediately