summaryrefslogtreecommitdiff
path: root/src/gui/widgets/chattab.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-02-26 01:40:00 +0300
committerAndrei Karas <akaras@inbox.ru>2013-02-26 01:40:00 +0300
commitd4febba47388979b26cd4680cb8a6f20e548e399 (patch)
tree2d520db672ed39b755e668828d27f0dd9d18ed6e /src/gui/widgets/chattab.cpp
parent803b6afd00b0e3574b40b866f21a0d3d01f6dc4d (diff)
downloadmv-d4febba47388979b26cd4680cb8a6f20e548e399.tar.gz
mv-d4febba47388979b26cd4680cb8a6f20e548e399.tar.bz2
mv-d4febba47388979b26cd4680cb8a6f20e548e399.tar.xz
mv-d4febba47388979b26cd4680cb8a6f20e548e399.zip
Improve string usage in other files.
Diffstat (limited to 'src/gui/widgets/chattab.cpp')
-rw-r--r--src/gui/widgets/chattab.cpp18
1 files changed, 8 insertions, 10 deletions
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<int>((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)