diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-02-24 22:59:54 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-02-24 22:59:54 +0300 |
commit | 6ce49efadfadd8eacb048df274979736bb04daf0 (patch) | |
tree | 60d4c2c2a803db003f6fa28e932468e925112580 /src/units.cpp | |
parent | 466829aef10af6b95d0f443226e8549f4399b567 (diff) | |
download | ManaVerse-6ce49efadfadd8eacb048df274979736bb04daf0.tar.gz ManaVerse-6ce49efadfadd8eacb048df274979736bb04daf0.tar.bz2 ManaVerse-6ce49efadfadd8eacb048df274979736bb04daf0.tar.xz ManaVerse-6ce49efadfadd8eacb048df274979736bb04daf0.zip |
Improve string usage in some files.
Diffstat (limited to 'src/units.cpp')
-rw-r--r-- | src/units.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/units.cpp b/src/units.cpp index b4542658e..4931f416b 100644 --- a/src/units.cpp +++ b/src/units.cpp @@ -205,7 +205,7 @@ static std::string formatUnit(const int value, const int type) if (amount > 0) { output = splitNumber(strprintf("%.*f", pl.round, - amount), pl.separator) + pl.symbol; + amount), pl.separator).append(pl.symbol); } for (unsigned int i = 2; i < ud.levels.size(); i++) @@ -222,7 +222,7 @@ static std::string formatUnit(const int value, const int type) if (levelAmount > 0) { output = splitNumber(strprintf("%d", levelAmount), - pl.separator) + pl.symbol + output; + pl.separator).append(pl.symbol).append(output); } if (!nextAmount) @@ -247,7 +247,7 @@ static std::string formatUnit(const int value, const int type) } return splitNumber(strprintf("%.*f", ul.round, amount), - ul.separator) + ul.symbol; + ul.separator).append(ul.symbol); } } } @@ -278,15 +278,20 @@ static std::string splitNumber(std::string str, const std::string &separator) while (str.size() >= 3) { if (str.size() >= 6) - result = separator + str.substr(str.size() - 3) + result; + { + result = std::string(separator).append(str.substr( + str.size() - 3)).append(result); + } else - result = str.substr(str.size() - 3) + result; + { + result = str.substr(str.size() - 3).append(result); + } str = str.substr(0, str.size() - 3); } if (!str.empty()) { if (!result.empty()) - result = str + separator + result; + result = std::string(str).append(separator).append(result); else result = str; } |