From aef5053e87c93a8987f89e4fdaf6cf3dd23efe81 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 11 Apr 2014 21:08:02 +0300 Subject: fix code style. --- src/being/being.cpp | 2 +- src/being/localplayer.cpp | 2 +- src/being/playerrelations.cpp | 2 +- src/gui/models/iconsmodel.h | 2 +- src/gui/models/itemsmodel.h | 2 +- src/gui/popups/popupmenu.cpp | 2 +- src/gui/widgets/tabs/setup_input.cpp | 2 +- src/gui/widgets/window.cpp | 7 ------- src/gui/widgets/window.h | 5 ----- src/gui/windows/changeemaildialog.cpp | 4 ++-- src/gui/windows/changepassworddialog.cpp | 6 +++--- src/gui/windows/charcreatedialog.cpp | 2 +- src/gui/windows/chatwindow.cpp | 6 +++--- src/gui/windows/outfitwindow.cpp | 2 +- src/gui/windows/registerdialog.cpp | 2 +- src/gui/windows/unregisterdialog.cpp | 2 +- src/gui/windows/updaterwindow.cpp | 4 ++-- src/particle/particleemitter.cpp | 2 +- src/spellshortcut.cpp | 2 +- 19 files changed, 23 insertions(+), 35 deletions(-) diff --git a/src/being/being.cpp b/src/being/being.cpp index 9f99a2ab8..621b61d02 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -2003,7 +2003,7 @@ void Being::setSprite(const unsigned int slot, const int id, else { const ItemInfo &info = ItemDB::get(id); - const std::string filename = info.getSprite(mGender, mSubType); + const std::string &filename = info.getSprite(mGender, mSubType); AnimatedSprite *equipmentSprite = nullptr; if (!isTempSprite && mType == PLAYER) diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index c774b985b..b75ee0ebd 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -3639,7 +3639,7 @@ void LocalPlayer::checkNewName(Being *const being) if (!being) return; - const std::string nick = being->getName(); + const std::string &nick = being->getName(); if (being->getType() == ActorSprite::PLAYER) { const Guild *const guild = getGuild(); diff --git a/src/being/playerrelations.cpp b/src/being/playerrelations.cpp index 4404791ca..06815baeb 100644 --- a/src/being/playerrelations.cpp +++ b/src/being/playerrelations.cpp @@ -586,7 +586,7 @@ bool PlayerRelationsManager::isGoodName(Being *const being) const if (being->getGoodStatus() != -1) return (being->getGoodStatus() == 1); - const std::string name = being->getName(); + const std::string &name = being->getName(); const size_t size = name.size(); if (size < 3) diff --git a/src/gui/models/iconsmodel.h b/src/gui/models/iconsmodel.h index c3031169c..b462f8a23 100644 --- a/src/gui/models/iconsmodel.h +++ b/src/gui/models/iconsmodel.h @@ -48,7 +48,7 @@ class IconsModel final : public ListModel continue; const ItemInfo &info = (*i->second); - const std::string name = info.getName(); + const std::string &name = info.getName(); if (name != "unnamed" && !info.getName().empty() && info.getName() != "unnamed") { diff --git a/src/gui/models/itemsmodel.h b/src/gui/models/itemsmodel.h index 808ae0f04..83d9f0776 100644 --- a/src/gui/models/itemsmodel.h +++ b/src/gui/models/itemsmodel.h @@ -50,7 +50,7 @@ class ItemsModal final : public ListModel continue; const ItemInfo &info = *i->second; - const std::string name = info.getName(); + const std::string &name = info.getName(); if (name != "unnamed" && !info.getName().empty() && info.getName() != "unnamed") { diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 504ad6426..c8416f66d 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -814,7 +814,7 @@ void PopupMenu::showChangePos(const int x, const int y) const Guild *const guild = player_node->getGuild(); if (guild) { - const PositionsMap map = guild->getPositions(); + const PositionsMap &map = guild->getPositions(); FOR_EACH (PositionsMap::const_iterator, itr, map) { mBrowserBox->addRow(strprintf("@@guild-pos-%u|%s@@", diff --git a/src/gui/widgets/tabs/setup_input.cpp b/src/gui/widgets/tabs/setup_input.cpp index a29e0d797..74ee7a3dc 100644 --- a/src/gui/widgets/tabs/setup_input.cpp +++ b/src/gui/widgets/tabs/setup_input.cpp @@ -212,7 +212,7 @@ void Setup_Input::cancel() void Setup_Input::action(const ActionEvent &event) { - const std::string id = event.getId(); + const std::string &id = event.getId(); if (event.getSource() == mKeyList) { diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 7cad9999c..c7212314d 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -1217,13 +1217,6 @@ bool Window::isResizeAllowed(const MouseEvent &event) const return false; } -int Window::getGuiAlpha() const -{ - const float alpha = std::max(client->getGuiAlpha(), - theme->getMinimumOpacity()); - return static_cast(alpha * 255.0F); -} - Layout &Window::getLayout() { if (!mLayout) diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index 175cc25f0..1795f2843 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -448,11 +448,6 @@ class Window : public BasicContainer2, */ void setModal(const bool modal); - /** - * Gets the alpha value used by the window, in a GUIChan usable format. - */ - int getGuiAlpha() const A_WARN_UNUSED; - Rect getWindowArea() const A_WARN_UNUSED; bool isResizeAllowed(const MouseEvent &event) const A_WARN_UNUSED; diff --git a/src/gui/windows/changeemaildialog.cpp b/src/gui/windows/changeemaildialog.cpp index ce9ec84e8..0f4086a0b 100644 --- a/src/gui/windows/changeemaildialog.cpp +++ b/src/gui/windows/changeemaildialog.cpp @@ -119,8 +119,8 @@ void ChangeEmailDialog::action(const ActionEvent &event) else if (eventId == "change_email") { const std::string username = mLoginData->username.c_str(); - const std::string newFirstEmail = mFirstEmailField->getText(); - const std::string newSecondEmail = mSecondEmailField->getText(); + const std::string &newFirstEmail = mFirstEmailField->getText(); + const std::string &newSecondEmail = mSecondEmailField->getText(); logger->log("ChangeEmailDialog::Email change, Username is %s", username.c_str()); diff --git a/src/gui/windows/changepassworddialog.cpp b/src/gui/windows/changepassworddialog.cpp index 051fa6434..eb7380f20 100644 --- a/src/gui/windows/changepassworddialog.cpp +++ b/src/gui/windows/changepassworddialog.cpp @@ -98,9 +98,9 @@ void ChangePasswordDialog::action(const ActionEvent &event) else if (eventId == "change_password") { const std::string username = mLoginData->username.c_str(); - const std::string oldPassword = mOldPassField->getText(); - const std::string newFirstPass = mFirstPassField->getText(); - const std::string newSecondPass = mSecondPassField->getText(); + const std::string &oldPassword = mOldPassField->getText(); + const std::string &newFirstPass = mFirstPassField->getText(); + const std::string &newSecondPass = mSecondPassField->getText(); logger->log("ChangePasswordDialog::Password change, Username is %s", username.c_str()); diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp index f0a9781f2..0fe412e5c 100644 --- a/src/gui/windows/charcreatedialog.cpp +++ b/src/gui/windows/charcreatedialog.cpp @@ -321,7 +321,7 @@ CharCreateDialog::~CharCreateDialog() void CharCreateDialog::action(const ActionEvent &event) { - const std::string id = event.getId(); + const std::string &id = event.getId(); if (id == "create") { if (getName().length() >= 4) diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index c3a3569f7..be2daf6a9 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -1021,7 +1021,7 @@ void ChatWindow::processEvent(const Channels channel, void ChatWindow::addInputText(const std::string &text, const bool space) { const int caretPos = mChatInput->getCaretPosition(); - const std::string inputText = mChatInput->getText(); + const std::string &inputText = mChatInput->getText(); std::ostringstream ss; ss << inputText.substr(0, caretPos) << text; @@ -1275,7 +1275,7 @@ void ChatWindow::autoComplete() { const int caretPos = mChatInput->getCaretPosition(); int startName = 0; - const std::string inputText = mChatInput->getText(); + const std::string &inputText = mChatInput->getText(); std::string name = inputText.substr(0, caretPos); for (int f = caretPos - 1; f > -1; f --) @@ -1643,7 +1643,7 @@ void ChatWindow::updateOnline(std::set &onlinePlayers) const } else { - const std::string nick = tab->getNick(); + const std::string &nick = tab->getNick(); if (actorManager) { const Being *const being = actorManager->findBeingByName( diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp index b1355ba46..601101bef 100644 --- a/src/gui/windows/outfitwindow.cpp +++ b/src/gui/windows/outfitwindow.cpp @@ -227,7 +227,7 @@ void OutfitWindow::save() const void OutfitWindow::action(const ActionEvent &event) { - const std::string eventId = event.getId(); + const std::string &eventId = event.getId(); if (eventId == "next") { next(); diff --git a/src/gui/windows/registerdialog.cpp b/src/gui/windows/registerdialog.cpp index 55a328fa8..6d3cf9d9f 100644 --- a/src/gui/windows/registerdialog.cpp +++ b/src/gui/windows/registerdialog.cpp @@ -182,7 +182,7 @@ void RegisterDialog::action(const ActionEvent &event) } else if (eventId == "register" && canSubmit()) { - const std::string user = mUserField->getText(); + const std::string &user = mUserField->getText(); logger->log("RegisterDialog::register Username is %s", user.c_str()); std::string errorMsg; diff --git a/src/gui/windows/unregisterdialog.cpp b/src/gui/windows/unregisterdialog.cpp index bb309c6f1..3d8627add 100644 --- a/src/gui/windows/unregisterdialog.cpp +++ b/src/gui/windows/unregisterdialog.cpp @@ -111,7 +111,7 @@ void UnRegisterDialog::action(const ActionEvent &event) else if (eventId == "unregister") { const std::string username = mLoginData->username.c_str(); - const std::string password = mPasswordField->getText(); + const std::string &password = mPasswordField->getText(); logger->log("UnregisterDialog::unregistered, Username is %s", username.c_str()); diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index 80275325a..824d8e0f6 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -1072,7 +1072,7 @@ void UpdaterWindow::loadDirMods(const std::string &dir) const ModInfo *const mod = (*modIt).second; if (mod) { - const std::string localDir = mod->getLocalDir(); + const std::string &localDir = mod->getLocalDir(); if (!localDir.empty()) resman->addToSearchPath(dir + "/" + localDir, false); } @@ -1095,7 +1095,7 @@ void UpdaterWindow::unloadMods(const std::string &dir) const ModInfo *const mod = (*modIt).second; if (mod) { - const std::string localDir = mod->getLocalDir(); + const std::string &localDir = mod->getLocalDir(); if (!localDir.empty()) resman->removeFromSearchPath(dir + "/" + localDir); } diff --git a/src/particle/particleemitter.cpp b/src/particle/particleemitter.cpp index 27f01d4e1..54c3623c4 100644 --- a/src/particle/particleemitter.cpp +++ b/src/particle/particleemitter.cpp @@ -574,7 +574,7 @@ std::list ParticleEmitter::createParticles(const int tick) Particle *newParticle = nullptr; if (mParticleImage) { - const std::string name = mParticleImage->getIdPath(); + const std::string &name = mParticleImage->getIdPath(); if (ImageParticle::imageParticleCountByName.find(name) == ImageParticle::imageParticleCountByName.end()) { diff --git a/src/spellshortcut.cpp b/src/spellshortcut.cpp index ecdf3a8ae..4e0e5a180 100644 --- a/src/spellshortcut.cpp +++ b/src/spellshortcut.cpp @@ -44,7 +44,7 @@ void SpellShortcut::load() if (!spellManager) return; - const std::vector spells = spellManager->getAll(); + const std::vector &spells = spellManager->getAll(); unsigned k = 0; for (std::vector::const_iterator i = spells.begin(), -- cgit v1.2.3-70-g09d2