summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-02-26 13:35:24 +0300
committerAndrei Karas <akaras@inbox.ru>2013-02-26 13:35:24 +0300
commit5190fe2cdac7c259d96619e4686f8543bdc96af4 (patch)
tree3a49895b4371fcd58a2446c0b3b0128ca1933568 /src
parentd4febba47388979b26cd4680cb8a6f20e548e399 (diff)
downloadplus-5190fe2cdac7c259d96619e4686f8543bdc96af4.tar.gz
plus-5190fe2cdac7c259d96619e4686f8543bdc96af4.tar.bz2
plus-5190fe2cdac7c259d96619e4686f8543bdc96af4.tar.xz
plus-5190fe2cdac7c259d96619e4686f8543bdc96af4.zip
Improve string usage in other files.
Diffstat (limited to 'src')
-rw-r--r--src/guichan/widgets/textbox.cpp5
-rw-r--r--src/net/ea/chathandler.cpp2
-rw-r--r--src/net/ea/network.cpp6
-rw-r--r--src/net/ea/skillhandler.cpp26
-rw-r--r--src/net/eathena/chathandler.cpp3
-rw-r--r--src/net/eathena/guildhandler.cpp3
-rw-r--r--src/net/tmwa/chathandler.cpp3
-rw-r--r--src/net/tmwa/guildhandler.cpp3
-rw-r--r--src/utils/translation/poparser.cpp12
9 files changed, 33 insertions, 30 deletions
diff --git a/src/guichan/widgets/textbox.cpp b/src/guichan/widgets/textbox.cpp
index 94edba281..c858c7ede 100644
--- a/src/guichan/widgets/textbox.cpp
+++ b/src/guichan/widgets/textbox.cpp
@@ -269,9 +269,8 @@ namespace gcn
const int sz = static_cast<int>(mTextRows.size());
for (i = 0; i < sz - 1; ++ i)
- text = text + mTextRows[i] + "\n";
-
- text = text + mTextRows[i];
+ text.append(mTextRows[i]).append("\n");
+ text.append(mTextRows[i]);
return text;
}
diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp
index 61ae2eee7..b72c301e9 100644
--- a/src/net/ea/chathandler.cpp
+++ b/src/net/ea/chathandler.cpp
@@ -307,7 +307,7 @@ void ChatHandler::processBeingChat(Net::MessageIn &msg)
PlayerRelation::SPEECH_LOG) && chatWindow)
{
chatWindow->resortChatLog(removeColors(sender_name)
- + " : " + chatMsg, BY_OTHER);
+ .append(" : ").append(chatMsg), BY_OTHER);
}
if (player_relations.hasPermission(sender_name,
diff --git a/src/net/ea/network.cpp b/src/net/ea/network.cpp
index af2c1837d..b0a2802bd 100644
--- a/src/net/ea/network.cpp
+++ b/src/net/ea/network.cpp
@@ -150,7 +150,7 @@ void Network::flush()
SDL_mutexP(mMutex);
ret = SDLNet_TCP_Send(mSocket, mOutBuffer, mOutSize);
- DEBUGLOG("Send " + toString(mOutSize) + " bytes");
+ DEBUGLOG(std::string("Send ").append(toString(mOutSize)).append(" bytes"));
if (ret < static_cast<int>(mOutSize))
{
setError("Error in SDLNet_TCP_Send(): " +
@@ -191,8 +191,8 @@ bool Network::realConnect()
if (SDLNet_ResolveHost(&ipAddress, mServer.hostname.c_str(),
mServer.port) == -1)
{
- std::string errorMessage = _("Unable to resolve host \"") +
- mServer.hostname + "\"";
+ std::string errorMessage = std::string(_("Unable to resolve host \""))
+ .append(mServer.hostname).append("\"");
setError(errorMessage);
logger->log("SDLNet_ResolveHost: %s", errorMessage.c_str());
return false;
diff --git a/src/net/ea/skillhandler.cpp b/src/net/ea/skillhandler.cpp
index 5a7268a6e..35a809ac9 100644
--- a/src/net/ea/skillhandler.cpp
+++ b/src/net/ea/skillhandler.cpp
@@ -176,43 +176,43 @@ void SkillHandler::processSkillFailed(Net::MessageIn &msg)
break;
}
- txt += " ";
+ txt.append(" ");
switch (reason)
{
case RFAIL_SKILLDEP:
- txt += _("You have not yet reached a high enough lvl!");
+ txt.append(_("You have not yet reached a high enough lvl!"));
break;
case RFAIL_INSUFHP:
- txt += _("Insufficient HP!");
+ txt.append(_("Insufficient HP!"));
break;
case RFAIL_INSUFSP:
- txt += _("Insufficient SP!");
+ txt.append(_("Insufficient SP!"));
break;
case RFAIL_NOMEMO:
- txt += _("You have no memos!");
+ txt.append(_("You have no memos!"));
break;
case RFAIL_SKILLDELAY:
- txt += _("You cannot do that right now!");
+ txt.append(_("You cannot do that right now!"));
break;
case RFAIL_ZENY:
- txt += _("Seems you need more money... ;-)");
+ txt.append(_("Seems you need more money... ;-)"));
break;
case RFAIL_WEAPON:
- txt += _("You cannot use this skill with that "
- "kind of weapon!");
+ txt.append(_("You cannot use this skill with that "
+ "kind of weapon!"));
break;
case RFAIL_REDGEM:
- txt += _("You need another red gem!");
+ txt.append(_("You need another red gem!"));
break;
case RFAIL_BLUEGEM:
- txt += _("You need another blue gem!");
+ txt.append(_("You need another blue gem!"));
break;
case RFAIL_OVERWEIGHT:
- txt += _("You're carrying to much to do this!");
+ txt.append(_("You're carrying to much to do this!"));
break;
default:
- txt += _("Huh? What's that?");
+ txt.append(_("Huh? What's that?"));
logger->log("QQQ SMSG_SKILL_FAILED: reason "
+ toString(reason));
break;
diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp
index 19e5c2112..f88d40689 100644
--- a/src/net/eathena/chathandler.cpp
+++ b/src/net/eathena/chathandler.cpp
@@ -107,7 +107,8 @@ void ChatHandler::talk(const std::string &text)
if (!player_node)
return;
- std::string mes = player_node->getName() + " : " + text;
+ std::string mes = std::string(player_node->getName()).append(
+ " : ").append(text);
MessageOut outMsg(CMSG_CHAT_MESSAGE);
// Added + 1 in order to let eAthena parse admin commands correctly
diff --git a/src/net/eathena/guildhandler.cpp b/src/net/eathena/guildhandler.cpp
index e26a252ab..13c0a1f2e 100644
--- a/src/net/eathena/guildhandler.cpp
+++ b/src/net/eathena/guildhandler.cpp
@@ -264,7 +264,8 @@ void GuildHandler::chat(int guildId A_UNUSED, const std::string &text)
if (!player_node)
return;
- std::string str = player_node->getName() + " : " + text;
+ std::string str = std::string(player_node->getName()).append(
+ " : ").append(text);
MessageOut msg(CMSG_GUILD_MESSAGE);
msg.writeInt16(static_cast<uint16_t>(str.size() + 4));
msg.writeString(str, static_cast<int>(str.length()));
diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp
index 9147a448a..723a164f2 100644
--- a/src/net/tmwa/chathandler.cpp
+++ b/src/net/tmwa/chathandler.cpp
@@ -109,7 +109,8 @@ void ChatHandler::talk(const std::string &text)
if (!player_node)
return;
- std::string mes = player_node->getName() + " : " + text;
+ std::string mes = std::string(player_node->getName()).append(
+ " : ").append(text);
MessageOut outMsg(CMSG_CHAT_MESSAGE);
// Added + 1 in order to let eAthena parse admin commands correctly
diff --git a/src/net/tmwa/guildhandler.cpp b/src/net/tmwa/guildhandler.cpp
index 96d1c9a9d..4e1ceba08 100644
--- a/src/net/tmwa/guildhandler.cpp
+++ b/src/net/tmwa/guildhandler.cpp
@@ -266,7 +266,8 @@ void GuildHandler::chat(int guildId A_UNUSED, const std::string &text)
if (!player_node)
return;
- std::string str = player_node->getName() + " : " + text;
+ std::string str = std::string(player_node->getName()).append(
+ " : ").append(text);
MessageOut msg(CMSG_GUILD_MESSAGE);
msg.writeInt16(static_cast<uint16_t>(str.size() + 4));
msg.writeString(str, static_cast<int>(str.length()));
diff --git a/src/utils/translation/poparser.cpp b/src/utils/translation/poparser.cpp
index c0f518b52..d4426a2e3 100644
--- a/src/utils/translation/poparser.cpp
+++ b/src/utils/translation/poparser.cpp
@@ -134,7 +134,7 @@ bool PoParser::readMsgId()
else if (checkLine())
{
// reading text from: "text"
- mMsgId += mLine.substr(1, mLine.size() - 2);
+ mMsgId.append(mLine.substr(1, mLine.size() - 2));
mLine.clear();
return true;
}
@@ -149,8 +149,8 @@ bool PoParser::readMsgId()
{
mReadingId = true;
// reading text from: msgid "text"
- mMsgId += mLine.substr(msgId1.size(),
- mLine.size() - 1 - msgId1.size());
+ mMsgId.append(mLine.substr(msgId1.size(),
+ mLine.size() - 1 - msgId1.size()));
mLine.clear();
return true;
}
@@ -175,7 +175,7 @@ bool PoParser::readMsgStr()
if (checkLine())
{
// reading text from: "text"
- mMsgStr += mLine.substr(1, mLine.size() - 2);
+ mMsgStr.append(mLine.substr(1, mLine.size() - 2));
mLine.clear();
return true;
}
@@ -189,8 +189,8 @@ bool PoParser::readMsgStr()
{
mReadingStr = true;
// reading text from: msgid "text"
- mMsgStr += mLine.substr(msgStr1.size(),
- mLine.size() - 1 - msgStr1.size());
+ mMsgStr.append(mLine.substr(msgStr1.size(),
+ mLine.size() - 1 - msgStr1.size()));
mLine.clear();
return true;
}