summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-02-26 00:01:56 +0300
committerAndrei Karas <akaras@inbox.ru>2013-02-26 00:01:56 +0300
commit803b6afd00b0e3574b40b866f21a0d3d01f6dc4d (patch)
tree8a55ef881f1eaac4d216b3f5d2c4605eb520070d /src/gui
parent8478d540748edccf36dc9bda5f0c3de0aa7bf763 (diff)
downloadmanaplus-803b6afd00b0e3574b40b866f21a0d3d01f6dc4d.tar.gz
manaplus-803b6afd00b0e3574b40b866f21a0d3d01f6dc4d.tar.bz2
manaplus-803b6afd00b0e3574b40b866f21a0d3d01f6dc4d.tar.xz
manaplus-803b6afd00b0e3574b40b866f21a0d3d01f6dc4d.zip
Improve string usage in other files.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/botcheckerwindow.cpp10
-rw-r--r--src/gui/buydialog.cpp2
-rw-r--r--src/gui/chatwindow.cpp28
-rw-r--r--src/gui/didyouknowwindow.cpp2
-rw-r--r--src/gui/gui.cpp24
-rw-r--r--src/gui/helpwindow.cpp4
-rw-r--r--src/gui/itempopup.cpp12
-rw-r--r--src/gui/minimap.cpp7
-rw-r--r--src/gui/npcdialog.cpp4
-rw-r--r--src/gui/outfitwindow.cpp9
-rw-r--r--src/gui/popupmenu.cpp8
-rw-r--r--src/gui/questswindow.cpp5
-rw-r--r--src/gui/sdlfont.cpp6
-rw-r--r--src/gui/serverdialog.cpp10
-rw-r--r--src/gui/setup_input.cpp2
-rw-r--r--src/gui/setup_theme.cpp4
-rw-r--r--src/gui/setup_video.cpp12
-rw-r--r--src/gui/shopwindow.cpp44
-rw-r--r--src/gui/statuswindow.cpp48
-rw-r--r--src/gui/theme.cpp15
-rw-r--r--src/gui/updaterwindow.cpp68
-rw-r--r--src/gui/whoisonline.cpp23
-rw-r--r--src/gui/worldselectdialog.cpp7
23 files changed, 197 insertions, 157 deletions
diff --git a/src/gui/botcheckerwindow.cpp b/src/gui/botcheckerwindow.cpp
index 7e8b16960..458da93c9 100644
--- a/src/gui/botcheckerwindow.cpp
+++ b/src/gui/botcheckerwindow.cpp
@@ -143,7 +143,7 @@ public:
else
{
widget = new Label(this, toString(curTime
- - player->getTestTime()) + "?");
+ - player->getTestTime()).append("?"));
}
mWidgets.push_back(widget);
@@ -155,7 +155,7 @@ public:
else
{
widget = new Label(this, toString(curTime
- - player->getTestTime()) + "?");
+ - player->getTestTime()).append("?"));
}
mWidgets.push_back(widget);
@@ -167,7 +167,7 @@ public:
else
{
widget = new Label(this, toString(curTime
- - player->getTestTime()) + "?");
+ - player->getTestTime()).append("?"));
}
mWidgets.push_back(widget);
@@ -199,14 +199,14 @@ public:
if (talk > 2 * 60)
{
talkBot = true;
- str += toString((talk) / 60) + " ";
+ str.append(toString((talk) / 60)).append(" ");
}
// attacking but not moving more than 2 minutes
if (move > 2 * 60)
{
moveBot = true;
- str += toString((move) / 60);
+ str.append(toString((move) / 60));
}
// attacking but not other activity more than 2 minutes
diff --git a/src/gui/buydialog.cpp b/src/gui/buydialog.cpp
index 404a126b7..06f878797 100644
--- a/src/gui/buydialog.cpp
+++ b/src/gui/buydialog.cpp
@@ -330,8 +330,6 @@ void BuyDialog::addItem(const int id, const unsigned char color,
void BuyDialog::action(const gcn::ActionEvent &event)
{
const std::string &eventId = event.getId();
- logger->log("event: " + eventId);
-
if (eventId == "quit")
{
close();
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp
index 78ffde880..12b4ee17b 100644
--- a/src/gui/chatwindow.cpp
+++ b/src/gui/chatwindow.cpp
@@ -702,8 +702,8 @@ void ChatWindow::doPresent() const
if ((*it)->getType() == ActorSprite::PLAYER)
{
if (!response.empty())
- response += ", ";
- response += static_cast<Being*>(*it)->getName();
+ response.append(", ");
+ response.append(static_cast<Being*>(*it)->getName());
++playercount;
}
}
@@ -978,12 +978,15 @@ void ChatWindow::processEvent(Channels channel, const DepricatedEvent &event)
- event.getInt("oldValue");
if (change != 0)
- battleChatLog("+" + toString(change) + " xp");
+ {
+ battleChatLog(std::string("+").append(toString(
+ change)).append(" xp"));
+ }
break;
}
case PlayerInfo::LEVEL:
- battleChatLog("Level: " + toString(
- event.getInt("newValue")));
+ battleChatLog(std::string("Level: ").append(toString(
+ event.getInt("newValue"))));
break;
default:
break;
@@ -1007,7 +1010,10 @@ void ChatWindow::processEvent(Channels channel, const DepricatedEvent &event)
const int change = exp.first - event.getInt("oldValue1");
if (change != 0)
- battleChatLog("+" + toString(change) + " job");
+ {
+ battleChatLog(std::string("+").append(
+ toString(change)).append(" job"));
+ }
}
}
}
@@ -1131,7 +1137,8 @@ void ChatWindow::addWhisper(const std::string &nick,
}
else
{
- localChatTab->chatLog(nick + " : " + mes, ACT_WHISPER, false);
+ localChatTab->chatLog(std::string(nick).append(
+ " : ").append(mes), ACT_WHISPER, false);
if (player_node)
player_node->afkRespond(nullptr, nick);
}
@@ -1246,7 +1253,7 @@ std::string ChatWindow::addColors(std::string &msg)
}
// simple colors
- return "##" + toString(mChatColor - 1) + msg;
+ return std::string("##").append(toString(mChatColor - 1)).append(msg);
}
void ChatWindow::autoComplete()
@@ -1309,8 +1316,9 @@ void ChatWindow::autoComplete()
{
newName = "_" + newName;
}
- mChatInput->setText(inputText.substr(0, startName) + newName
- + inputText.substr(caretPos, inputText.length() - caretPos));
+ mChatInput->setText(inputText.substr(0, startName).append(newName)
+ .append(inputText.substr(caretPos,
+ inputText.length() - caretPos)));
const int len = caretPos - static_cast<int>(name.length())
+ static_cast<int>(newName.length());
diff --git a/src/gui/didyouknowwindow.cpp b/src/gui/didyouknowwindow.cpp
index bd59e8cd3..8589a0a9a 100644
--- a/src/gui/didyouknowwindow.cpp
+++ b/src/gui/didyouknowwindow.cpp
@@ -150,7 +150,7 @@ void DidYouKnowWindow::loadFile(const int num)
helpPath = paths.getStringValue("help");
StringVect lines;
- TranslationManager::translateFile(helpPath + file + ".txt",
+ TranslationManager::translateFile(helpPath.append(file).append(".txt"),
translator, lines);
for (size_t i = 0, sz = lines.size(); i < sz; ++i)
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 3a5964924..205bdff5a 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -129,8 +129,8 @@ Gui::Gui(Graphics *const graphics) :
}
catch (const gcn::Exception &e)
{
- logger->error(std::string("Unable to load '") + fontFile +
- std::string("': ") + e.getMessage());
+ logger->error(std::string("Unable to load '").append(fontFile)
+ .append("': ").append(e.getMessage()));
}
// Set particle font
@@ -154,8 +154,8 @@ Gui::Gui(Graphics *const graphics) :
}
catch (const gcn::Exception &e)
{
- logger->error(std::string("Unable to load '") + fontFile +
- std::string("': ") + e.getMessage());
+ logger->error(std::string("Unable to load '").append(fontFile)
+ .append("': ").append(e.getMessage()));
}
// Set bold font
@@ -169,8 +169,8 @@ Gui::Gui(Graphics *const graphics) :
}
catch (const gcn::Exception &e)
{
- logger->error(std::string("Unable to load '") + fontFile +
- std::string("': ") + e.getMessage());
+ logger->error(std::string("Unable to load '").append(fontFile)
+ .append("': ").append(e.getMessage()));
}
// Set help font
@@ -184,8 +184,8 @@ Gui::Gui(Graphics *const graphics) :
}
catch (const gcn::Exception &e)
{
- logger->error(std::string("Unable to load '") + fontFile +
- std::string("': ") + e.getMessage());
+ logger->error(std::string("Unable to load '").append(fontFile)
+ .append("': ").append(e.getMessage()));
}
// Set secure font
@@ -199,8 +199,8 @@ Gui::Gui(Graphics *const graphics) :
}
catch (const gcn::Exception &e)
{
- logger->error(std::string("Unable to load '") + fontFile +
- std::string("': ") + e.getMessage());
+ logger->error(std::string("Unable to load '").append(fontFile)
+ .append("': ").append(e.getMessage()));
}
// Set npc font
@@ -215,8 +215,8 @@ Gui::Gui(Graphics *const graphics) :
}
catch (const gcn::Exception &e)
{
- logger->error(std::string("Unable to load '") + fontFile +
- std::string("': ") + e.getMessage());
+ logger->error(std::string("Unable to load '").append(fontFile)
+ .append("': ").append(e.getMessage()));
}
gcn::Widget::setGlobalFont(mGuiFont);
diff --git a/src/gui/helpwindow.cpp b/src/gui/helpwindow.cpp
index 712d9fa6a..1e73e658d 100644
--- a/src/gui/helpwindow.cpp
+++ b/src/gui/helpwindow.cpp
@@ -120,7 +120,7 @@ void HelpWindow::loadFile(std::string file)
helpPath = paths.getStringValue("help");
StringVect lines;
- TranslationManager::translateFile(helpPath + file + ".txt",
+ TranslationManager::translateFile(helpPath.append(file).append(".txt"),
translator, lines);
for (size_t i = 0, sz = lines.size(); i < sz; ++i)
@@ -133,7 +133,7 @@ void HelpWindow::loadTags()
if (helpPath.empty())
helpPath = paths.getStringValue("help");
StringVect lines;
- ResourceManager::loadTextFile(helpPath + "tags.idx", lines);
+ ResourceManager::loadTextFile(helpPath.append("tags.idx"), lines);
FOR_EACH (StringVectCIter, it, lines)
{
const std::string &str = *it;
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
index b58b245c8..f84a42ce7 100644
--- a/src/gui/itempopup.cpp
+++ b/src/gui/itempopup.cpp
@@ -143,8 +143,8 @@ void ItemPopup::setItem(const ItemInfo &item, const unsigned char color,
{
ResourceManager *const resman = ResourceManager::getInstance();
Image *const image = resman->getImage(combineDye2(
- paths.getStringValue("itemIcons")
- + item.getDisplay().image, item.getDyeColorsString(color)));
+ paths.getStringValue("itemIcons").append(
+ item.getDisplay().image), item.getDyeColorsString(color)));
mIcon->setImage(image);
if (image)
@@ -165,14 +165,14 @@ void ItemPopup::setItem(const ItemInfo &item, const unsigned char color,
if (serverVersion > 0)
{
- mItemName->setCaption(item.getName(color) + _(", ")
- + toString(id));
+ mItemName->setCaption(std::string(item.getName(color)).append(
+ _(", ")).append(toString(id)));
mItemDesc->setTextWrapped(item.getDescription(color), 196);
}
else
{
- mItemName->setCaption(item.getName() + _(", ")
- + toString(id));
+ mItemName->setCaption(std::string(item.getName()).append(
+ _(", ")).append(toString(id)));
mItemDesc->setTextWrapped(item.getDescription(), 196);
}
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp
index d35a29088..c9362471f 100644
--- a/src/gui/minimap.cpp
+++ b/src/gui/minimap.cpp
@@ -156,8 +156,8 @@ void Minimap::setMap(const Map *const map)
}
else
{
- std::string tempname = paths.getStringValue("minimaps")
- + map->getFilename() + ".png";
+ std::string tempname = paths.getStringValue("minimaps").append(
+ map->getFilename()).append(".png");
ResourceManager *const resman = ResourceManager::getInstance();
minimapName = map->getProperty("minimap");
@@ -167,7 +167,8 @@ void Minimap::setMap(const Map *const map)
if (minimapName.empty())
{
- tempname = "graphics/minimaps/" + map->getFilename() + ".png";
+ tempname = std::string("graphics/minimaps/").append(
+ map->getFilename()).append(".png");
if (resman->exists(tempname))
minimapName = tempname;
}
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp
index 0fbd52456..c2de9b1ad 100644
--- a/src/gui/npcdialog.cpp
+++ b/src/gui/npcdialog.cpp
@@ -235,7 +235,7 @@ void NpcDialog::addText(const std::string &text, const bool save)
if (mText.size() > 5000)
mText.clear();
- mNewText += text;
+ mNewText.append(text);
mTextBox->addRow(text);
// setText(mText + text + "\n");
}
@@ -413,7 +413,7 @@ void NpcDialog::parseListItems(const std::string &itemString)
mItems.push_back(tmp.substr(pos + 1));
Image *const img = resman->getImage(
paths.getStringValue("guiIcons")
- + tmp.substr(0, pos) + ".png");
+ .append(tmp.substr(0, pos)).append(".png"));
mImages.push_back(img);
}
}
diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp
index cd7e23038..c56df4ef7 100644
--- a/src/gui/outfitwindow.cpp
+++ b/src/gui/outfitwindow.cpp
@@ -190,12 +190,13 @@ void OutfitWindow::save()
const int res = mItems[o][i] ? mItems[o][i] : -1;
if (res != -1)
good = true;
- outfitStr += toString(res);
+ outfitStr.append(toString(res));
if (i < OUTFIT_ITEM_COUNT - 1)
- outfitStr += " ";
- outfitColorsStr += toString(static_cast<int>(mItemColors[o][i]));
+ outfitStr.append(" ");
+ outfitColorsStr.append(toString(static_cast<int>(
+ mItemColors[o][i])));
if (i < OUTFIT_ITEM_COUNT - 1)
- outfitColorsStr += " ";
+ outfitColorsStr.append(" ");
}
if (good)
{
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index e88322d97..8bc53836f 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -130,7 +130,6 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being)
mY = y;
const std::string &name = mNick;
-
mBrowserBox->addRow(name + being->getGenderSignWithSpace());
switch (being->getType())
@@ -924,9 +923,14 @@ void PopupMenu::handleLink(const std::string &link,
if (chatWindow)
{
if (config.getBoolValue("whispertab"))
+ {
chatWindow->localChatInput("/q " + mNick);
+ }
else
- chatWindow->addInputText("/w \"" + mNick + "\" ");
+ {
+ chatWindow->addInputText(std::string("/w \"").append(
+ mNick).append("\" "));
+ }
}
}
else if (link == "move" && !mNick.empty())
diff --git a/src/gui/questswindow.cpp b/src/gui/questswindow.cpp
index 164f3ce26..076e042f9 100644
--- a/src/gui/questswindow.cpp
+++ b/src/gui/questswindow.cpp
@@ -393,7 +393,7 @@ void QuestsWindow::rebuild(const bool playSound)
void QuestsWindow::showQuest(const QuestItem *const quest)
{
- if (!quest)
+ if (!quest || !translator)
return;
const std::vector<QuestItemText> &texts = quest->texts;
@@ -409,7 +409,8 @@ void QuestsWindow::showQuest(const QuestItem *const quest)
mText->addRow(translator->getStr(data.text));
break;
case QUEST_NAME:
- mText->addRow("[" + translator->getStr(data.text) + "]");
+ mText->addRow(std::string("[").append(translator->getStr(
+ data.text)).append("]"));
break;
}
}
diff --git a/src/gui/sdlfont.cpp b/src/gui/sdlfont.cpp
index 404e1d319..8b53cafe1 100644
--- a/src/gui/sdlfont.cpp
+++ b/src/gui/sdlfont.cpp
@@ -295,7 +295,8 @@ void SDLFont::drawString(gcn::Graphics *const graphics,
#endif
}
#ifdef DEBUG_FONT
- logger->log("drawString: " + text + ", iterations: " + toString(cnt));
+ logger->log(std::string("drawString: ").append(text).append(
+ ", iterations: ").append(toString(cnt)));
#endif
// Surface not found
@@ -382,7 +383,8 @@ int SDLFont::getWidth(const std::string &text) const
}
#ifdef DEBUG_FONT
- logger->log("getWidth: " + text + ", iterations: " + toString(cnt));
+ logger->log(std::string("getWidth: ").append(text).append(
+ ", iterations: ").append(toString(cnt)));
#endif
int w, h;
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index 9e3372dca..6bb09d8e9 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -130,7 +130,7 @@ std::string ServersListModel::getElementAt(int elementIndex)
MutexLocker lock = mParent->lock();
const ServerInfo &server = mServers->at(elementIndex);
std::string myServer;
- myServer += server.hostname;
+ myServer.append(server.hostname);
// myServer += ":";
// myServer += toString(server.port);
return myServer;
@@ -543,8 +543,8 @@ void ServerDialog::downloadServerList()
}
mDownload = new Net::Download(this, listFile, &downloadUpdate);
- mDownload->setFile(mDir + "/" + branding.getStringValue(
- "onlineServerFile"));
+ mDownload->setFile(std::string(mDir).append("/").append(
+ branding.getStringValue("onlineServerFile")));
mDownload->start();
config.setValue("serverslistupdate", getDateString());
@@ -552,8 +552,8 @@ void ServerDialog::downloadServerList()
void ServerDialog::loadServers(const bool addNew)
{
- XML::Document doc(mDir + "/" + branding.getStringValue(
- "onlineServerFile"), false);
+ XML::Document doc(std::string(mDir).append("/").append(
+ branding.getStringValue("onlineServerFile")), false);
const XmlNodePtr rootNode = doc.rootNode();
if (!rootNode || !xmlNameEqual(rootNode, "serverlist"))
diff --git a/src/gui/setup_input.cpp b/src/gui/setup_input.cpp
index 1f1823136..a0eea1d3c 100644
--- a/src/gui/setup_input.cpp
+++ b/src/gui/setup_input.cpp
@@ -248,7 +248,7 @@ void Setup_Input::action(const gcn::ActionEvent &event)
const int ik = key.actionId;
inputManager.setNewKeyIndex(ik);
mKeyListModel->setElementAt(i, std::string(
- gettext(key.name.c_str())) + ": ?");
+ gettext(key.name.c_str())).append(": ?"));
}
}
else if (id == "unassign")
diff --git a/src/gui/setup_theme.cpp b/src/gui/setup_theme.cpp
index ec275654b..9c618473e 100644
--- a/src/gui/setup_theme.cpp
+++ b/src/gui/setup_theme.cpp
@@ -335,8 +335,8 @@ void Setup_Theme::updateInfo()
ThemeInfo *info = Theme::loadInfo(mTheme);
if (info)
{
- mThemeInfo = "Name: " + info->name
- + "\nCopyright:\n" + info->copyright;
+ mThemeInfo = std::string("Name: ").append(info->name)
+ .append("\nCopyright:\n").append(info->copyright);
}
else
{
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index 3fc4a66e5..c64bec32f 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -142,8 +142,8 @@ ModeListModel::ModeListModel()
addCustomMode("1280x1024");
addCustomMode("1400x900");
addCustomMode("1500x990");
- addCustomMode(toString(mainGraphics->mWidth) + "x"
- + toString(mainGraphics->mHeight));
+ addCustomMode(toString(mainGraphics->mWidth).append("x")
+ .append(toString(mainGraphics->mHeight)));
std::sort(mVideoModes.begin(), mVideoModes.end(), modeSorter);
mVideoModes.push_back("custom");
@@ -274,8 +274,8 @@ Setup_Video::Setup_Video(const Widget2 *const widget) :
mFpsCheckBox->setSelected(mFps > 0);
// Pre-select the current video mode.
- std::string videoMode = toString(mainGraphics->mWidth) + "x"
- + toString(mainGraphics->mHeight);
+ std::string videoMode = toString(mainGraphics->mWidth).append("x")
+ .append(toString(mainGraphics->mHeight));
mModeList->setSelected(mModeListModel->getIndexOf(videoMode));
mModeList->setActionEventId("videomode");
@@ -452,8 +452,8 @@ void Setup_Video::cancel()
config.setValue("screen", mFullScreenEnabled);
// Set back to the current video mode.
- std::string videoMode = toString(mainGraphics->mWidth) + "x"
- + toString(mainGraphics->mHeight);
+ std::string videoMode = toString(mainGraphics->mWidth).append("x")
+ .append(toString(mainGraphics->mHeight));
mModeList->setSelected(mModeListModel->getIndexOf(videoMode));
config.setValue("screenwidth", mainGraphics->mWidth);
config.setValue("screenheight", mainGraphics->mHeight);
diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp
index dfecdbbe5..d42583f62 100644
--- a/src/gui/shopwindow.cpp
+++ b/src/gui/shopwindow.cpp
@@ -440,9 +440,9 @@ void ShopWindow::announce(ShopItems *const list, const int mode)
std::string data = "\302\202";
if (mode == BUY)
- data += "Buy ";
+ data.append("Buy ");
else
- data += "Sell ";
+ data.append("Sell ");
if (mAnnonceTime && (mAnnonceTime + (2 * 60) > cur_time
|| mAnnonceTime > cur_time))
@@ -465,30 +465,28 @@ void ShopWindow::announce(ShopItems *const list, const int mode)
{
if (mAnnounceLinks->isSelected())
{
- data += strprintf("[@@%d|%s@@] (%dGP) %d, ", item->getId(),
- item->getInfo().getName().c_str(),
- item->getPrice(), item->getQuantity());
+ data.append(strprintf("[@@%d|%s@@] (%dGP) %d, ", item->getId(),
+ item->getInfo().getName().c_str(),
+ item->getPrice(), item->getQuantity()));
}
else
{
- data += strprintf("%s (%dGP) %d, ",
- item->getInfo().getName().c_str(),
- item->getPrice(), item->getQuantity());
+ data.append(strprintf("%s (%dGP) %d, ",
+ item->getInfo().getName().c_str(),
+ item->getPrice(), item->getQuantity()));
}
}
else
{
if (mAnnounceLinks->isSelected())
{
- data += strprintf("[@@%d|%s@@] (%dGP), ", item->getId(),
- item->getInfo().getName().c_str(),
- item->getPrice());
+ data.append(strprintf("[@@%d|%s@@] (%dGP), ", item->getId(),
+ item->getInfo().getName().c_str(), item->getPrice()));
}
else
{
- data += strprintf("%s (%dGP), ",
- item->getInfo().getName().c_str(),
- item->getPrice());
+ data.append(strprintf("%s (%dGP), ",
+ item->getInfo().getName().c_str(), item->getPrice()));
}
}
}
@@ -507,12 +505,12 @@ void ShopWindow::giveList(const std::string &nick, const int mode)
if (mode == BUY)
{
list = mBuyShopItems;
- data += "S1";
+ data.append("S1");
}
else
{
list = mSellShopItems;
- data += "B1";
+ data.append("B1");
}
if (!list)
return;
@@ -541,10 +539,10 @@ void ShopWindow::giveList(const std::string &nick, const int mode)
if (amount)
{
- data += strprintf("%s%s%s",
+ data.append(strprintf("%s%s%s",
encodeStr(item->getId(), 2).c_str(),
encodeStr(item->getPrice(), 4).c_str(),
- encodeStr(amount, 3).c_str());
+ encodeStr(amount, 3).c_str()));
}
}
}
@@ -560,10 +558,10 @@ void ShopWindow::giveList(const std::string &nick, const int mode)
if (amount > 0)
{
- data += strprintf("%s%s%s",
- encodeStr(item->getId(), 2).c_str(),
- encodeStr(item->getPrice(), 4).c_str(),
- encodeStr(amount, 3).c_str());
+ data.append(strprintf("%s%s%s",
+ encodeStr(item->getId(), 2).c_str(),
+ encodeStr(item->getPrice(), 4).c_str(),
+ encodeStr(amount, 3).c_str()));
}
}
}
@@ -581,7 +579,7 @@ void ShopWindow::sendMessage(const std::string &nick,
mRandCounter ++;
if (mRandCounter > 200)
mRandCounter = 0;
- data += encodeStr(mRandCounter, 2);
+ data.append(encodeStr(mRandCounter, 2));
}
if (config.getBoolValue("hideShopMessages"))
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp
index 3e34b088d..99ee0e655 100644
--- a/src/gui/statuswindow.cpp
+++ b/src/gui/statuswindow.cpp
@@ -473,8 +473,9 @@ void StatusWindow::updateHPBar(ProgressBar *const bar, const bool showMax)
if (showMax)
{
- bar->setText(toString(PlayerInfo::getAttribute(PlayerInfo::HP)) +
- "/" + toString(PlayerInfo::getAttribute(PlayerInfo::MAX_HP)));
+ bar->setText(toString(PlayerInfo::getAttribute(PlayerInfo::HP)).append(
+ "/").append(toString(PlayerInfo::getAttribute(
+ PlayerInfo::MAX_HP))));
}
else
{
@@ -498,8 +499,9 @@ void StatusWindow::updateMPBar(ProgressBar *const bar, const bool showMax)
if (showMax)
{
- bar->setText(toString(PlayerInfo::getAttribute(PlayerInfo::MP)) +
- "/" + toString(PlayerInfo::getAttribute(PlayerInfo::MAX_MP)));
+ bar->setText(toString(PlayerInfo::getAttribute(PlayerInfo::MP)).append(
+ "/").append(toString(PlayerInfo::getAttribute(
+ PlayerInfo::MAX_MP))));
}
else
{
@@ -555,7 +557,7 @@ void StatusWindow::updateProgressBar(ProgressBar *const bar, const int value,
}
else
{
- bar->setText(toString(value) + "/" + toString(max));
+ bar->setText(toString(value).append("/").append(toString(max)));
}
bar->setProgress(progress);
@@ -694,19 +696,23 @@ void StatusWindow::updateStatusBar(ProgressBar *const bar,
return;
bar->setText(translateLetter2(player_node->getInvertDirectionString())
- += translateLetter2(player_node->getCrazyMoveTypeString())
- += translateLetter2(player_node->getMoveToTargetTypeString())
- += translateLetter2(player_node->getFollowModeString())
- += " " + translateLetter2(player_node->getAttackWeaponTypeString())
- += translateLetter2(player_node->getAttackTypeString())
- += translateLetter2(player_node->getMagicAttackString())
- += translateLetter2(player_node->getPvpAttackString())
- += " " + translateLetter2(player_node->getQuickDropCounterString())
- += translateLetter2(player_node->getPickUpTypeString())
- += " " + translateLetter2(player_node->getDebugPathString())
- += " " + translateLetter2(player_node->getImitationModeString())
- += translateLetter2(player_node->getCameraModeString())
- += translateLetter2(player_node->getAwayModeString()));
+ .append(translateLetter2(player_node->getCrazyMoveTypeString()))
+ .append(translateLetter2(player_node->getMoveToTargetTypeString()))
+ .append(translateLetter2(player_node->getFollowModeString()))
+ .append(" ").append(translateLetter2(
+ player_node->getAttackWeaponTypeString()))
+ .append(translateLetter2(player_node->getAttackTypeString()))
+ .append(translateLetter2(player_node->getMagicAttackString()))
+ .append(translateLetter2(player_node->getPvpAttackString()))
+ .append(" ").append(translateLetter2(
+ player_node->getQuickDropCounterString()))
+ .append(translateLetter2(player_node->getPickUpTypeString()))
+ .append(" ").append(translateLetter2(
+ player_node->getDebugPathString()))
+ .append(" ").append(translateLetter2(
+ player_node->getImitationModeString()))
+ .append(translateLetter2(player_node->getCameraModeString()))
+ .append(translateLetter2(player_node->getAwayModeString())));
bar->setProgress(50);
if (player_node->getDisableGameModifiers())
@@ -743,8 +749,8 @@ void StatusWindow::action(const gcn::ActionEvent &event)
(*it).second);
if (attr)
{
- str += strprintf("%s:%s ", attr->getShortName().c_str(),
- attr->getValue().c_str());
+ str.append(strprintf("%s:%s ", attr->getShortName().c_str(),
+ attr->getValue().c_str()));
}
++ it;
}
@@ -781,7 +787,7 @@ std::string AttrDisplay::update()
const int bonus = PlayerInfo::getStatMod(mId);
std::string value = toString(base + bonus);
if (bonus)
- value += strprintf("=%d%+d", base, bonus);
+ value.append(strprintf("=%d%+d", base, bonus));
mValue->setCaption(value);
return mName;
}
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp
index 202bfed20..846bb45c4 100644
--- a/src/gui/theme.cpp
+++ b/src/gui/theme.cpp
@@ -691,13 +691,13 @@ std::string Theme::resolveThemePath(const std::string &path)
}
// Try the theme
- file = getThemePath() + "/" + file;
+ file = getThemePath().append("/").append(file);
if (PhysFs::exists(file.c_str()))
- return getThemePath() + "/" + path;
+ return getThemePath().append("/").append(path);
// Backup
- return branding.getStringValue("guiPath") + path;
+ return branding.getStringValue("guiPath").append(path);
}
Image *Theme::getImageFromTheme(const std::string &path)
@@ -967,7 +967,7 @@ void Theme::loadColors(std::string file)
if (file == "")
file = "colors.xml";
else
- file += "/colors.xml";
+ file.append("/colors.xml");
XML::Document doc(resolveThemePath(file));
const XmlNodePtr root = doc.rootNode();
@@ -1135,9 +1135,14 @@ ThemeInfo *Theme::loadInfo(const std::string &themeName)
{
std::string path;
if (themeName.empty())
+ {
path = "graphics/gui/info.xml";
+ }
else
- path = defaultThemePath + themeName + "/info.xml";
+ {
+ path = std::string(defaultThemePath).append(
+ themeName).append("/info.xml");
+ }
logger->log("loading: " + path);
XML::Document doc(path);
const XmlNodePtr rootNode = doc.rootNode();
diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp
index 033bf3ee4..e99d9144e 100644
--- a/src/gui/updaterwindow.cpp
+++ b/src/gui/updaterwindow.cpp
@@ -439,8 +439,8 @@ int UpdaterWindow::updateProgress(void *ptr, DownloadStatus status,
if (progress > 1.0f)
progress = 1.0f;
- uw->setLabel(uw->mCurrentFile + " ("
- + toString(static_cast<int>(progress * 100)) + "%)");
+ uw->setLabel(std::string(uw->mCurrentFile).append(" (")
+ .append(toString(static_cast<int>(progress * 100))).append("%)"));
uw->setProgress(progress);
@@ -485,8 +485,8 @@ void UpdaterWindow::download()
}
else
{
- mDownload = new Net::Download(this, mUpdateHost + "/" + mCurrentFile,
- updateProgress);
+ mDownload = new Net::Download(this, std::string(mUpdateHost).append(
+ "/").append(mCurrentFile), updateProgress);
}
if (mStoreInMemory)
@@ -497,12 +497,13 @@ void UpdaterWindow::download()
{
if (mDownloadStatus == UPDATE_RESOURCES)
{
- mDownload->setFile(mUpdatesDir + "/" + mCurrentFile,
- mCurrentChecksum);
+ mDownload->setFile(std::string(mUpdatesDir).append("/").append(
+ mCurrentFile), mCurrentChecksum);
}
else
{
- mDownload->setFile(mUpdatesDir + "/" + mCurrentFile);
+ mDownload->setFile(std::string(mUpdatesDir).append(
+ "/").append(mCurrentFile));
}
}
@@ -522,13 +523,15 @@ void UpdaterWindow::loadUpdates()
if (mUpdateFiles.empty())
{ // updates not downloaded
- mUpdateFiles = loadXMLFile(mUpdatesDir + "/" + xmlUpdateFile);
+ mUpdateFiles = loadXMLFile(std::string(mUpdatesDir).append(
+ "/").append(xmlUpdateFile));
if (mUpdateFiles.empty())
{
logger->log("Warning this server does not have a"
" %s file falling back to %s", xmlUpdateFile.c_str(),
txtUpdateFile.c_str());
- mUpdateFiles = loadTxtFile(mUpdatesDir + "/" + txtUpdateFile);
+ mUpdateFiles = loadTxtFile(std::string(mUpdatesDir).append(
+ "/").append(txtUpdateFile));
}
}
@@ -547,14 +550,15 @@ void UpdaterWindow::loadLocalUpdates(const std::string &dir)
const ResourceManager *const resman = ResourceManager::getInstance();
std::vector<updateFile> updateFiles
- = loadXMLFile(dir + "/" + xmlUpdateFile);
+ = loadXMLFile(std::string(dir).append("/").append(xmlUpdateFile));
if (updateFiles.empty())
{
logger->log("Warning this server does not have a"
" %s file falling back to %s", xmlUpdateFile.c_str(),
txtUpdateFile.c_str());
- updateFiles = loadTxtFile(dir + "/" + txtUpdateFile);
+ updateFiles = loadTxtFile(std::string(dir).append(
+ "/").append(txtUpdateFile));
}
std::string fixPath = dir + "/fix";
@@ -572,7 +576,7 @@ void UpdaterWindow::loadManaPlusUpdates(const std::string &dir,
{
std::string fixPath = dir + "/fix";
std::vector<updateFile> updateFiles
- = loadXMLFile(fixPath + "/" + xmlUpdateFile);
+ = loadXMLFile(std::string(fixPath).append("/").append(xmlUpdateFile));
for (unsigned int updateIndex = 0, sz = static_cast<unsigned int>(
updateFiles.size()); updateIndex < sz; updateIndex ++)
@@ -581,7 +585,7 @@ void UpdaterWindow::loadManaPlusUpdates(const std::string &dir,
if (strStartWith(name, "manaplus_"))
{
struct stat statbuf;
- std::string file = fixPath + "/" + name;
+ std::string file = std::string(fixPath).append("/").append(name);
if (!stat(file.c_str(), &statbuf))
resman->addToSearchPath(file, false);
}
@@ -594,16 +598,17 @@ void UpdaterWindow::addUpdateFile(const ResourceManager *const resman,
const std::string &file,
const bool append)
{
+ const std::string tmpPath = std::string(path).append("/").append(file);
if (!append)
- resman->addToSearchPath(path + "/" + file, append);
+ resman->addToSearchPath(tmpPath, append);
- const std::string fixFile = fixPath + "/" + file;
+ const std::string fixFile = std::string(fixPath).append("/").append(file);
struct stat statbuf;
if (!stat(fixFile.c_str(), &statbuf))
resman->addToSearchPath(fixFile, append);
if (append)
- resman->addToSearchPath(path + "/" + file, append);
+ resman->addToSearchPath(tmpPath, append);
}
void UpdaterWindow::logic()
@@ -671,7 +676,7 @@ void UpdaterWindow::logic()
loadPatch();
mUpdateHost = updateServer2 + mUpdateServerPath;
- mUpdatesDir += "/fix";
+ mUpdatesDir.append("/fix");
mCurrentFile = xmlUpdateFile;
mStoreInMemory = false;
mDownloadStatus = UPDATE_LIST2;
@@ -684,8 +689,8 @@ void UpdaterWindow::logic()
{
if (mCurrentFile == xmlUpdateFile)
{
- mUpdateFiles = loadXMLFile(
- mUpdatesDir + "/" + xmlUpdateFile);
+ mUpdateFiles = loadXMLFile(std::string(mUpdatesDir).append(
+ "/").append(xmlUpdateFile));
if (mUpdateFiles.empty())
{
@@ -705,8 +710,8 @@ void UpdaterWindow::logic()
}
else if (mCurrentFile == txtUpdateFile)
{
- mUpdateFiles = loadTxtFile(
- mUpdatesDir + "/" + txtUpdateFile);
+ mUpdateFiles = loadTxtFile(std::string(mUpdatesDir).append(
+ "/").append(txtUpdateFile));
}
mStoreInMemory = false;
mDownloadStatus = UPDATE_RESOURCES;
@@ -740,11 +745,11 @@ void UpdaterWindow::logic()
std::stringstream ss(checksum);
ss >> std::hex >> mCurrentChecksum;
- std::ifstream temp(
- (mUpdatesDir + "/" + mCurrentFile).c_str());
+ std::ifstream temp((std::string(mUpdatesDir).append(
+ "/").append(mCurrentFile)).c_str());
- if (!temp.is_open() || !validateFile(mUpdatesDir + "/"
- + mCurrentFile, mCurrentChecksum))
+ if (!temp.is_open() || !validateFile(std::string(mUpdatesDir).append(
+ "/").append(mCurrentFile), mCurrentChecksum))
{
temp.close();
download();
@@ -773,8 +778,8 @@ void UpdaterWindow::logic()
{
if (mCurrentFile == xmlUpdateFile)
{
- mTempUpdateFiles = loadXMLFile(
- mUpdatesDir + "/" + xmlUpdateFile);
+ mTempUpdateFiles = loadXMLFile(std::string(
+ mUpdatesDir).append("/").append(xmlUpdateFile));
}
mUpdateIndexOffset = mUpdateIndex;
mUpdateIndex = 0;
@@ -795,11 +800,12 @@ void UpdaterWindow::logic()
std::stringstream ss(checksum);
ss >> std::hex >> mCurrentChecksum;
- std::ifstream temp(
- (mUpdatesDir + "/" + mCurrentFile).c_str());
+ std::ifstream temp((std::string(mUpdatesDir).append(
+ "/").append(mCurrentFile)).c_str());
- if (!temp.is_open() || !validateFile(mUpdatesDir + "/"
- + mCurrentFile, mCurrentChecksum))
+ if (!temp.is_open() || !validateFile(std::string(
+ mUpdatesDir).append("/").append(mCurrentFile),
+ mCurrentChecksum))
{
temp.close();
download();
diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp
index 3a03eec13..a1058928d 100644
--- a/src/gui/whoisonline.cpp
+++ b/src/gui/whoisonline.cpp
@@ -156,9 +156,14 @@ void WhoIsOnline::handleLink(const std::string& link, gcn::MouseEvent *event)
{
std::string text = decodeLinkText(link);
if (config.getBoolValue("whispertab"))
+ {
chatWindow->localChatInput("/q " + text);
+ }
else
- chatWindow->addInputText("/w \"" + text + "\" ");
+ {
+ chatWindow->addInputText(std::string("/w \"").append(
+ text).append("\" "));
+ }
}
}
else if (event->getButton() == gcn::MouseEvent::RIGHT)
@@ -805,29 +810,29 @@ void OnlinePlayer::setText(std::string color)
}
if ((mStatus != 255 && mStatus & Being::FLAG_GM) || mIsGM)
- mText += "(GM) ";
+ mText.append("(GM) ");
if (mLevel > 0)
- mText += strprintf("%d", mLevel);
+ mText.append(strprintf("%d", mLevel));
if (mGender == GENDER_FEMALE)
- mText += "\u2640";
+ mText.append("\u2640");
else if (mGender == GENDER_MALE)
- mText += "\u2642";
+ mText.append("\u2642");
if (mStatus > 0 && mStatus != 255)
{
if (mStatus & Being::FLAG_SHOP)
- mText += "$";
+ mText.append("$");
if (mStatus & Being::FLAG_AWAY)
{
// TRANSLATORS: this away status writed in player nick
- mText += _("A");
+ mText.append(_("A"));
}
if (mStatus & Being::FLAG_INACTIVE)
{
// TRANSLATORS: this inactive status writed in player nick
- mText += _("I");
+ mText.append(_("I"));
}
if (mStatus & Being::FLAG_GM && color == "0")
@@ -839,7 +844,7 @@ void OnlinePlayer::setText(std::string color)
}
if (mVersion > 0)
- mText += strprintf(" - %d", mVersion);
+ mText.append(strprintf(" - %d", mVersion));
const char *const text = encodeLinkText(mNick).c_str();
mText = strprintf("@@%s|##%s%s %s@@", text, color.c_str(),
diff --git a/src/gui/worldselectdialog.cpp b/src/gui/worldselectdialog.cpp
index 93314ff16..b62311555 100644
--- a/src/gui/worldselectdialog.cpp
+++ b/src/gui/worldselectdialog.cpp
@@ -68,9 +68,14 @@ class WorldListModel final : public gcn::ListModel
{
const WorldInfo *const si = mWorlds[i];
if (si)
- return si->name + " (" + toString(si->online_users) + ")";
+ {
+ return std::string(si->name).append(" (").append(
+ toString(si->online_users)).append(")");
+ }
else
+ {
return "???";
+ }
}
private:
Worlds mWorlds;