summaryrefslogtreecommitdiff
path: root/src/gui/windows/chatwindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-08-30 22:51:23 +0300
committerAndrei Karas <akaras@inbox.ru>2017-08-30 22:51:23 +0300
commitef8ef35d28daa3ea7dd542078ac9c0d3f7a9a5e2 (patch)
treec3d7c79fca18ac387d0c90512ef3201c92da5890 /src/gui/windows/chatwindow.cpp
parent22b64d16b613c1e5b26632237879b167024788ab (diff)
downloadmv-ef8ef35d28daa3ea7dd542078ac9c0d3f7a9a5e2.tar.gz
mv-ef8ef35d28daa3ea7dd542078ac9c0d3f7a9a5e2.tar.bz2
mv-ef8ef35d28daa3ea7dd542078ac9c0d3f7a9a5e2.tar.xz
mv-ef8ef35d28daa3ea7dd542078ac9c0d3f7a9a5e2.zip
Move some variables to better scope.
Diffstat (limited to 'src/gui/windows/chatwindow.cpp')
-rw-r--r--src/gui/windows/chatwindow.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index e29212063..25c85638a 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -702,13 +702,15 @@ void ChatWindow::doPresent() const
}
}
- const std::string log = strprintf(
- // TRANSLATORS: chat message
- _("Present: %s; %d players are present."),
- response.c_str(), playercount);
-
- if (getFocused() != nullptr)
- getFocused()->chatLog(log, ChatMsgType::BY_SERVER);
+ ChatTab *const tab = getFocused();
+ if (tab != nullptr)
+ {
+ const std::string log = strprintf(
+ // TRANSLATORS: chat message
+ _("Present: %s; %d players are present."),
+ response.c_str(), playercount);
+ tab->chatLog(log, ChatMsgType::BY_SERVER);
+ }
}
void ChatWindow::scroll(const int amount) const