diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-12-25 03:08:37 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-12-25 03:08:37 +0300 |
commit | 39029943851dfc318fabb95357e00b81d2735547 (patch) | |
tree | dfd195791587c51e6dca166dda8a016a1760d3bf /src/gui | |
parent | 10f59701112130cf953a2af7ef4ae82d9d823fe6 (diff) | |
download | plus-39029943851dfc318fabb95357e00b81d2735547.tar.gz plus-39029943851dfc318fabb95357e00b81d2735547.tar.bz2 plus-39029943851dfc318fabb95357e00b81d2735547.tar.xz plus-39029943851dfc318fabb95357e00b81d2735547.zip |
Improve empty strings manipulation.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/chatwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/itempopup.cpp | 2 | ||||
-rw-r--r-- | src/gui/logindialog.cpp | 8 | ||||
-rw-r--r-- | src/gui/npcdialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/outfitwindow.cpp | 4 | ||||
-rw-r--r-- | src/gui/popupmenu.cpp | 10 | ||||
-rw-r--r-- | src/gui/serverdialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/setup_theme.cpp | 6 | ||||
-rw-r--r-- | src/gui/shopwindow.cpp | 6 | ||||
-rw-r--r-- | src/gui/skilldialog.cpp | 4 | ||||
-rw-r--r-- | src/gui/socialwindow.cpp | 4 | ||||
-rw-r--r-- | src/gui/theme.cpp | 4 | ||||
-rw-r--r-- | src/gui/tradewindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/updaterwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/whoisonline.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/avatarlistbox.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/browserbox.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/chattab.cpp | 8 | ||||
-rw-r--r-- | src/gui/widgets/passwordfield.cpp | 2 |
19 files changed, 39 insertions, 39 deletions
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index 960554be1..cc9f76ce4 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -679,7 +679,7 @@ void ChatWindow::doPresent() const return; const ActorSprites &actors = actorSpriteManager->getAll(); - std::string response = ""; + std::string response; int playercount = 0; for (ActorSpritesConstIterator it = actors.begin(), it_end = actors.end(); diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp index ba78adcfd..07073fb71 100644 --- a/src/gui/itempopup.cpp +++ b/src/gui/itempopup.cpp @@ -260,6 +260,6 @@ void ItemPopup::mouseMoved(gcn::MouseEvent &event) // When the mouse moved on top of the popup, hide it setVisible(false); - mLastName = ""; + mLastName.clear(); mLastColor = 1; } diff --git a/src/gui/logindialog.cpp b/src/gui/logindialog.cpp index 00c5ab54d..41016b05c 100644 --- a/src/gui/logindialog.cpp +++ b/src/gui/logindialog.cpp @@ -268,8 +268,8 @@ void LoginDialog::action(const gcn::ActionEvent &event) } else { - mLoginData->updateHost = ""; - *mUpdateHost = ""; + mLoginData->updateHost.clear(); + (*mUpdateHost).clear(); } } else if (mUpdateHostDropDown) @@ -283,8 +283,8 @@ void LoginDialog::action(const gcn::ActionEvent &event) } else { - mLoginData->updateHost = ""; - *mUpdateHost = ""; + mLoginData->updateHost.clear(); + (*mUpdateHost).clear(); } } diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp index f552deb60..84ca51a18 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 (save || mLogInteraction) { if (mText.size() > 5000) - mText = ""; + mText.clear(); mNewText += text; mTextBox->addRow(text); diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp index 383b85ca7..3e29adb5f 100644 --- a/src/gui/outfitwindow.cpp +++ b/src/gui/outfitwindow.cpp @@ -218,8 +218,8 @@ void OutfitWindow::save() serverConfig.setValue("OutfitUnequip" + toString(o), mItemsUnequip[o]); } - outfitStr = ""; - outfitColorsStr = ""; + outfitStr.clear(); + outfitColorsStr.clear(); } serverConfig.setValue("OutfitAwayIndex", mAwayOutfit); } diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index c6838079c..77c022ffe 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -663,7 +663,7 @@ void PopupMenu::showChangePos(const int x, const int y) mFloorItemId = 0; mItem = nullptr; mMapItem = nullptr; - mNick = ""; + mNick.clear(); mType = static_cast<int>(Being::UNKNOWN); mX = 0; mY = 0; @@ -1611,7 +1611,7 @@ void PopupMenu::handleLink(const std::string &link, mItemId = 0; mItemColor = 1; mMapItem = nullptr; - mNick = ""; + mNick.clear(); mType = static_cast<int>(Being::UNKNOWN); mX = 0; mY = 0; @@ -1629,7 +1629,7 @@ void PopupMenu::showPopup(Window *const parent, const int x, const int y, mWindow = parent; mX = x; mY = y; - mNick = ""; + mNick.clear(); mBrowserBox->clearRows(); const int cnt = item->getQuantity(); @@ -1760,7 +1760,7 @@ void PopupMenu::showItemPopup(const int x, const int y, Item *const item) mItemId = 0; mItemColor = 1; } - mNick = ""; + mNick.clear(); mBrowserBox->clearRows(); if (item) @@ -1813,7 +1813,7 @@ void PopupMenu::showDropPopup(const int x, const int y, Item *const item) mItem = item; mX = x; mY = y; - mNick = ""; + mNick.clear(); mBrowserBox->clearRows(); if (item) diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index ec97b73c6..4ff77bdbd 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -373,7 +373,7 @@ void ServerDialog::connectToSelectedServer() if (!LoginDialog::savedPasswordKey.empty()) { if (mServerInfo->hostname != LoginDialog::savedPasswordKey) - LoginDialog::savedPassword = ""; + LoginDialog::savedPassword.clear(); } config.setValue("usePersistentIP", diff --git a/src/gui/setup_theme.cpp b/src/gui/setup_theme.cpp index 658877eed..277ddadae 100644 --- a/src/gui/setup_theme.cpp +++ b/src/gui/setup_theme.cpp @@ -312,7 +312,7 @@ void Setup_Theme::updateInfo() } else { - mThemeInfo = ""; + mThemeInfo.clear(); } replaceAll(mThemeInfo, "\\n", "\n"); mInfoButton->setEnabled(!mThemeInfo.empty()); @@ -324,7 +324,7 @@ void Setup_Theme::action(const gcn::ActionEvent &event) if (event.getId() == ACTION_THEME) { if (mThemeDropDown->getSelected() == 0) - mTheme = ""; + mTheme.clear(); else mTheme = mThemeDropDown->getSelectedString(); updateInfo(); @@ -337,7 +337,7 @@ void Setup_Theme::action(const gcn::ActionEvent &event) { const int id = mLangDropDown->getSelected(); if (id < 0 || id >= langs_count) - mLang = ""; + mLang.clear(); else mLang = LANG_NAME[id].value; } diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp index 8be665d08..0d65c1524 100644 --- a/src/gui/shopwindow.cpp +++ b/src/gui/shopwindow.cpp @@ -200,12 +200,12 @@ void ShopWindow::action(const gcn::ActionEvent &event) } else if (event.getId() == "no") { - mTradeNick = ""; + mTradeNick.clear(); } else if (event.getId() == "ignore") { player_relations.ignoreTrade(mTradeNick); - mTradeNick = ""; + mTradeNick.clear(); } else if (event.getId() == "delete buy" && mBuyShopItemList && mBuyShopItemList->getSelected() >= 0) @@ -286,7 +286,7 @@ void ShopWindow::startTrade() } Net::getTradeHandler()->request(being); tradePartnerName = mTradeNick; - mTradeNick = ""; + mTradeNick.clear(); } void ShopWindow::valueChanged(const gcn::SelectionEvent &event A_UNUSED) diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index aa60fedb1..219223240 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -407,7 +407,7 @@ void SkillDialog::loadSkills() SkillInfo *const skill = new SkillInfo; skill->id = 1; skill->data->name = _("basic"); - skill->data->description = ""; + skill->data->description.clear(); skill->data->dispName = _("basic, 1"); skill->data->shortName = "bas"; skill->data->setIcon(""); @@ -544,7 +544,7 @@ void SkillDialog::addSkill(const int id, const int level, const int range, skill->id = static_cast<short unsigned>(id); skill->data->name = "Unknown skill Id: " + toString(id); skill->data->dispName = "Unknown skill Id: " + toString(id); - skill->data->description = ""; + skill->data->description.clear(); skill->data->setIcon(""); skill->modifiable = modifiable; skill->visible = false; diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index fd8114584..90899ea6f 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -1331,7 +1331,7 @@ SocialWindow::~SocialWindow() mPartyAcceptDialog->scheduleDelete(); mPartyAcceptDialog = nullptr; - mPartyInviter = ""; + mPartyInviter.clear(); } delete mCreatePopup; mCreatePopup = nullptr; @@ -1446,7 +1446,7 @@ void SocialWindow::action(const gcn::ActionEvent &event) Net::getPartyHandler()->inviteResponse(mPartyInviter, false); } - mPartyInviter = ""; + mPartyInviter.clear(); mPartyAcceptDialog = nullptr; } else if (event.getSource() == mGuildAcceptDialog) diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 8a4f3573c..8be991bd6 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -646,8 +646,8 @@ void Theme::prepareThemePath() { initDefaultThemePath(); - mThemePath = ""; - mThemeName = ""; + mThemePath.clear(); + mThemeName.clear(); // Try theme from settings if (tryThemePath(config.getStringValue("theme"))) diff --git a/src/gui/tradewindow.cpp b/src/gui/tradewindow.cpp index 4adb718c4..4bbfed638 100644 --- a/src/gui/tradewindow.cpp +++ b/src/gui/tradewindow.cpp @@ -398,7 +398,7 @@ void TradeWindow::close() void TradeWindow::clear() { mAutoAddItem = nullptr; - mAutoAddToNick = ""; + mAutoAddToNick.clear(); mAutoMoney = 0; mAutoAddAmount = 0; mGotMoney = 0; diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp index 2abb8979c..e6dbfc05d 100644 --- a/src/gui/updaterwindow.cpp +++ b/src/gui/updaterwindow.cpp @@ -117,7 +117,7 @@ std::vector<updateFile> loadTxtFile(const std::string &fileName) thisFile.hash = hash; thisFile.type = "data"; thisFile.required = true; - thisFile.desc = ""; + thisFile.desc.clear(); if (!thisFile.name.empty() && checkPath(thisFile.name)) files.push_back(thisFile); diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp index 4dd1df2b6..f0b0ab538 100644 --- a/src/gui/whoisonline.cpp +++ b/src/gui/whoisonline.cpp @@ -365,7 +365,7 @@ void WhoIsOnline::loadWebList() else { nick = lineStr; - lineStr = ""; + lineStr.clear(); } trim(nick); @@ -736,7 +736,7 @@ void WhoIsOnline::optionChanged(const std::string &name) void OnlinePlayer::setText(std::string color) { - mText = ""; + mText.clear(); if (mStatus != 255 && actorSpriteManager) { diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index dcb280596..5a5027982 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -344,7 +344,7 @@ void AvatarListBox::mousePressed(gcn::MouseEvent &event) { std::string name; if (model->getAvatarAt(selected)->getLevel() == 0) - name = ""; + name.clear(); else name = model->getAvatarAt(selected)->getName(); @@ -357,7 +357,7 @@ void AvatarListBox::mousePressed(gcn::MouseEvent &event) { std::string name; if (model->getAvatarAt(selected)->getLevel() == 0) - name = ""; + name.clear(); else name = model->getAvatarAt(selected)->getName(); diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 55bbcc89c..776b2eb29 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -695,7 +695,7 @@ std::string BrowserBox::getTextAtPos(const int x, const int y) const // textX = x - textX; textY = y - textY; - std::string str = ""; + std::string str; int lastY = 0; diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index d2d66e681..2fc19a473 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -110,7 +110,7 @@ void ChatTab::chatLog(std::string line, Own own, CHATLOG tmp; tmp.own = own; - tmp.nick = ""; + tmp.nick.clear(); tmp.text = line; const size_t pos = line.find(" : "); @@ -173,7 +173,7 @@ void ChatTab::chatLog(std::string line, Own own, lineColor = "##S"; break; case BY_CHANNEL: - tmp.nick = ""; + tmp.nick.clear(); // TODO: Use a predefined color lineColor = "##2"; // Equiv. to BrowserBox::GREEN break; @@ -185,7 +185,7 @@ void ChatTab::chatLog(std::string line, Own own, lineColor = "##I"; break; case BY_LOGGER: - tmp.nick = ""; + tmp.nick.clear(); tmp.text = line; lineColor = "##L"; break; @@ -196,7 +196,7 @@ void ChatTab::chatLog(std::string line, Own own, if (tmp.nick == ": ") { - tmp.nick = ""; + tmp.nick.clear(); lineColor = "##S"; } diff --git a/src/gui/widgets/passwordfield.cpp b/src/gui/widgets/passwordfield.cpp index 512c12761..42bd8d0d0 100644 --- a/src/gui/widgets/passwordfield.cpp +++ b/src/gui/widgets/passwordfield.cpp @@ -39,7 +39,7 @@ void PasswordField::draw(gcn::Graphics *graphics) if (mPasswordChar) mText.assign(mText.length(), mPasswordChar); else - mText = ""; + mText.clear(); TextField::draw(graphics); mText = original; BLOCK_END("PasswordField::draw") |