summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-06-08 03:17:28 +0300
committerAndrei Karas <akaras@inbox.ru>2017-06-08 03:17:28 +0300
commit4acdea8dc3c12147965f63b2974d192d8cd0ed34 (patch)
tree0d2b9a697e19c4e3149749c1cc200443dcbc6e34 /src
parentaa0e715fe63eed2795944fda68ab64270b51453b (diff)
downloadplus-4acdea8dc3c12147965f63b2974d192d8cd0ed34.tar.gz
plus-4acdea8dc3c12147965f63b2974d192d8cd0ed34.tar.bz2
plus-4acdea8dc3c12147965f63b2974d192d8cd0ed34.tar.xz
plus-4acdea8dc3c12147965f63b2974d192d8cd0ed34.zip
Improve strings concatination performance.
Diffstat (limited to 'src')
-rw-r--r--src/actormanager.cpp6
-rw-r--r--src/gui/popups/itempopup.cpp2
-rw-r--r--src/resources/db/itemdb.cpp2
-rw-r--r--src/utils/stringutils.cpp2
4 files changed, 6 insertions, 6 deletions
diff --git a/src/actormanager.cpp b/src/actormanager.cpp
index 4bf4e2d53..5f1bf8157 100644
--- a/src/actormanager.cpp
+++ b/src/actormanager.cpp
@@ -1483,7 +1483,7 @@ void ActorManager::heal(const Being *const target) const
}
}
// heal self if selected monster or selection empty
- else if ((target != nullptr || target->getType() == ActorType::Monster)
+ else if ((target == nullptr || target->getType() == ActorType::Monster)
&& PlayerInfo::getAttribute(Attributes::PLAYER_MP) >= 6
&& PlayerInfo::getAttribute(Attributes::PLAYER_HP)
!= PlayerInfo::getAttribute(Attributes::PLAYER_MAX_HP))
@@ -1541,8 +1541,8 @@ void ActorManager::itenplz() const
{
if (Net::getNetworkType() != ServerType::TMWATHENA)
return;
- if (localPlayer != nullptr ||
- chatWindow != nullptr ||
+ if (localPlayer == nullptr ||
+ chatWindow == nullptr ||
!localPlayer->isAlive() ||
!playerHandler->canUseMagic())
{
diff --git a/src/gui/popups/itempopup.cpp b/src/gui/popups/itempopup.cpp
index 3fc546cf0..9800455ca 100644
--- a/src/gui/popups/itempopup.cpp
+++ b/src/gui/popups/itempopup.cpp
@@ -370,7 +370,7 @@ std::string ItemPopup::getOptionsString(const ItemOptionsList *const options)
if (!effect.empty())
effect.append(" / ");
if (field->sign && value[0] != '-')
- value = "+" + value;
+ value.append("+").append(value);
const std::string format = translator->getStr(field->description);
effect.append(strprintf(format.c_str(),
value.c_str()));
diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp
index 6efe6086f..5f92fc4e0 100644
--- a/src/resources/db/itemdb.cpp
+++ b/src/resources/db/itemdb.cpp
@@ -145,7 +145,7 @@ static void readFields(std::string &effect,
if (!effect.empty())
effect.append(" / ");
if (field->sign && isDigit(value))
- value = "+" + value;
+ value.append("+").append(value);
const std::string format = translator->getStr(field->description);
effect.append(strprintf(format.c_str(),
value.c_str()));
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index d21702ed1..1f0888629 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -431,7 +431,7 @@ void replaceSpecialChars(std::string &text)
std::string str(" ");
str[0] = CAST_S8(atoi(text.substr(
idx, f - idx).c_str()));
- text = text.substr(0, pos1) + str + text.substr(f + 1);
+ text = text.substr(0, pos1).append(str).append(text.substr(f + 1));
pos1 += 1;
}
else