From d4febba47388979b26cd4680cb8a6f20e548e399 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 26 Feb 2013 01:40:00 +0300 Subject: Improve string usage in other files. --- src/gui/widgets/chattab.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src/gui/widgets/chattab.cpp') diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index fd336e116..ae18740a9 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -146,30 +146,27 @@ void ChatTab::chatLog(std::string line, Own own, case BY_GM: if (tmp.nick.empty()) { - tmp.nick = std::string(_("Global announcement:")); - tmp.nick += " "; + tmp.nick = std::string(_("Global announcement:")).append(" "); lineColor = "##G"; } else { tmp.nick = strprintf(_("Global announcement from %s:"), - tmp.nick.c_str()); - tmp.nick += " "; + tmp.nick.c_str()).append(" "); lineColor = "##1"; // Equiv. to BrowserBox::RED } break; case BY_PLAYER: - tmp.nick += ": "; + tmp.nick.append(": "); lineColor = "##Y"; break; case BY_OTHER: case BY_UNKNOWN: - tmp.nick += ": "; + tmp.nick.append(": "); lineColor = "##C"; break; case BY_SERVER: - tmp.nick = _("Server:"); - tmp.nick += " "; + tmp.nick = std::string(_("Server:")).append(" "); tmp.text = line; lineColor = "##S"; break; @@ -243,7 +240,8 @@ void ChatTab::chatLog(std::string line, Own own, << ":" << (((t / 60) % 60 < 10) ? "0" : "") << static_cast((t / 60) % 60) << "] "; - line = lineColor + timeStr.str() + tmp.nick + tmp.text; + line = std::string(lineColor).append(timeStr.str()).append( + tmp.nick).append(tmp.text); } if (config.getBoolValue("enableChatLog")) @@ -330,7 +328,7 @@ void ChatTab::chatLog(const std::string &nick, std::string msg) const Own byWho = (nick == player_node->getName() ? BY_PLAYER : BY_OTHER); if (byWho == BY_OTHER && config.getBoolValue("removeColors")) msg = removeColors(msg); - chatLog(nick + " : " + msg, byWho, false, false); + chatLog(std::string(nick).append(" : ").append(msg), byWho, false, false); } void ChatTab::chatInput(const std::string &message) -- cgit v1.2.3-70-g09d2