From 703a3c4df3732e3e88559147001260f3355d42d6 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 9 Sep 2011 22:10:53 +0300 Subject: Continue fix for shadow variables/methods errors. --- src/gui/chatwindow.cpp | 8 ++++---- src/gui/chatwindow.h | 4 ++-- src/gui/inventorywindow.cpp | 11 +++-------- src/gui/itemamountwindow.cpp | 4 ++-- src/gui/logindialog.cpp | 8 ++++---- src/gui/logindialog.h | 2 +- src/gui/ministatuswindow.cpp | 4 ++-- src/gui/ministatuswindow.h | 2 +- src/gui/popupmenu.cpp | 15 +++++++++------ src/gui/register.cpp | 22 +++++++++++----------- src/gui/sdlfont.cpp | 4 ++-- src/gui/serverdialog.cpp | 10 +++++----- src/gui/setup_video.cpp | 16 ++++++++-------- src/gui/shopwindow.cpp | 2 +- src/gui/socialwindow.cpp | 6 +++--- src/gui/textcommandeditor.cpp | 4 ++-- src/gui/tradewindow.cpp | 4 ++-- src/gui/unregisterdialog.cpp | 16 ++++++++-------- src/gui/viewport.cpp | 2 +- src/gui/widgets/avatarlistbox.cpp | 2 +- src/gui/widgets/mouseevent.h | 10 +++++----- src/gui/windowmenu.cpp | 4 ++-- src/gui/windowmenu.h | 2 +- 23 files changed, 80 insertions(+), 82 deletions(-) (limited to 'src/gui') diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index c52511189..f3e4b88b8 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -907,9 +907,9 @@ void ChatWindow::addItemText(const std::string &item) addInputText(text.str()); } -void ChatWindow::setVisible(bool isVisible) +void ChatWindow::setVisible(bool visible) { - Window::setVisible(isVisible); + Window::setVisible(visible); /* * For whatever reason, if setVisible is called, the mTmpVisible effect @@ -918,8 +918,8 @@ void ChatWindow::setVisible(bool isVisible) mTmpVisible = false; } -void ChatWindow::whisper(const std::string &nick, - const std::string &mes, Own own) +void ChatWindow::addWhisper(const std::string &nick, + const std::string &mes, Own own) { if (mes.empty() || !player_node) return; diff --git a/src/gui/chatwindow.h b/src/gui/chatwindow.h index 97e366701..1ad468a3b 100644 --- a/src/gui/chatwindow.h +++ b/src/gui/chatwindow.h @@ -222,8 +222,8 @@ class ChatWindow : public Window, void doPresent(); - void whisper(const std::string &nick, const std::string &mes, - Own own = BY_OTHER); + void addWhisper(const std::string &nick, const std::string &mes, + Own own = BY_OTHER); ChatTab *addWhisperTab(const std::string &nick, bool switchTo = false); diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index da1c45782..c6afaaf1d 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -362,17 +362,12 @@ void InventoryWindow::action(const gcn::ActionEvent &event) else if (event.getId() == "split") { ItemAmountWindow::showWindow(ItemAmountWindow::ItemSplit, this, item, - (item->getQuantity() - 1)); + (item->getQuantity() - 1)); } else if (event.getId() == "retrieve") { - Item *item = mItems->getSelectedItem(); - - if (!item) - return; - - ItemAmountWindow::showWindow(ItemAmountWindow::StoreRemove, this, - item); + ItemAmountWindow::showWindow(ItemAmountWindow::StoreRemove, + this, item); } } diff --git a/src/gui/itemamountwindow.cpp b/src/gui/itemamountwindow.cpp index 059f3d785..9bd3f3ab3 100644 --- a/src/gui/itemamountwindow.cpp +++ b/src/gui/itemamountwindow.cpp @@ -53,11 +53,11 @@ class ItemsModal : public gcn::ListModel public: ItemsModal() { - std::map info = ItemDB::getItemInfos(); + std::map items = ItemDB::getItemInfos(); std::list tempStrings; for (std::map::const_iterator - i = info.begin(), i_end = info.end(); + i = items.begin(), i_end = items.end(); i != i_end; ++i) { if (i->first < 0) diff --git a/src/gui/logindialog.cpp b/src/gui/logindialog.cpp index ab5dc7401..adf499f75 100644 --- a/src/gui/logindialog.cpp +++ b/src/gui/logindialog.cpp @@ -81,10 +81,10 @@ public: } }; -LoginDialog::LoginDialog(LoginData *loginData, std::string serverName, +LoginDialog::LoginDialog(LoginData *data, std::string serverName, std::string *updateHost): Window(_("Login")), - mLoginData(loginData), + mLoginData(data), mUpdateHost(updateHost), mServerName(serverName) { @@ -94,7 +94,7 @@ LoginDialog::LoginDialog(LoginData *loginData, std::string serverName, gcn::Label *userLabel = new Label(_("Name:")); gcn::Label *passLabel = new Label(_("Password:")); mCustomUpdateHost = new CheckBox(_("Custom update host"), - loginData->updateType & LoginData::Upd_Custom, this, "customhost"); + mLoginData->updateType & LoginData::Upd_Custom, this, "customhost"); mUpdateHostText = new TextField(serverConfig.getValue( "customUpdateHost", "")); @@ -112,7 +112,7 @@ LoginDialog::LoginDialog(LoginData *loginData, std::string serverName, mUpdateTypeModel = new UpdateTypeModel(); mUpdateTypeDropDown = new DropDown(mUpdateTypeModel); mUpdateTypeDropDown->setActionEventId("updatetype"); - mUpdateTypeDropDown->setSelected((loginData->updateType + mUpdateTypeDropDown->setSelected((mLoginData->updateType | LoginData::Upd_Custom) ^ LoginData::Upd_Custom); if (!mCustomUpdateHost->isSelected()) diff --git a/src/gui/logindialog.h b/src/gui/logindialog.h index e464c6f24..0696bc680 100644 --- a/src/gui/logindialog.h +++ b/src/gui/logindialog.h @@ -49,7 +49,7 @@ class LoginDialog : public Window, public gcn::ActionListener, * * @see Window::Window */ - LoginDialog(LoginData *loginData, std::string serverName, + LoginDialog(LoginData *data, std::string serverName, std::string *updateHost); ~LoginDialog(); diff --git a/src/gui/ministatuswindow.cpp b/src/gui/ministatuswindow.cpp index b325bcef6..e3f441b60 100644 --- a/src/gui/ministatuswindow.cpp +++ b/src/gui/ministatuswindow.cpp @@ -400,12 +400,12 @@ void MiniStatusWindow::mouseExited(gcn::MouseEvent &event) mStatusPopup->hide(); } -void MiniStatusWindow::showBar(std::string name, bool isVisible) +void MiniStatusWindow::showBar(std::string name, bool visible) { ProgressBar *bar = mBarNames[name]; if (!bar) return; - bar->setVisible(isVisible); + bar->setVisible(visible); updateBars(); saveBars(); } diff --git a/src/gui/ministatuswindow.h b/src/gui/ministatuswindow.h index 91aebcfac..5e1b442dc 100644 --- a/src/gui/ministatuswindow.h +++ b/src/gui/ministatuswindow.h @@ -80,7 +80,7 @@ class MiniStatusWindow : public Popup, void mouseExited(gcn::MouseEvent &event); - void showBar(std::string name, bool isVisible); + void showBar(std::string name, bool visible); void updateBars(); diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 7e43c9954..e43ab35bc 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -879,7 +879,7 @@ void PopupMenu::handleLink(const std::string &link, } else if (link == "heal" && being && being->getType() != Being::MONSTER) { - actorSpriteManager->heal(player_node, being); + actorSpriteManager->heal(being); } else if (link == "unignore" && being && being->getType() == ActorSprite::PLAYER) @@ -1591,12 +1591,15 @@ void PopupMenu::handleLink(const std::string &link, } else if (!link.compare(0, 7, "player_")) { - mBeingId = atoi(link.substr(7).c_str()); - Being *being = actorSpriteManager->findBeing(mBeingId); - if (being) + if (actorSpriteManager) { - showPopup(getX(), getY(), being); - return; + mBeingId = atoi(link.substr(7).c_str()); + being = actorSpriteManager->findBeing(mBeingId); + if (being) + { + showPopup(getX(), getY(), being); + return; + } } } else if (!link.compare(0, 12, "hide button_")) diff --git a/src/gui/register.cpp b/src/gui/register.cpp index 913c958f2..e2c718359 100644 --- a/src/gui/register.cpp +++ b/src/gui/register.cpp @@ -62,21 +62,21 @@ void WrongDataNoticeListener::action(const gcn::ActionEvent &event) mTarget->requestFocus(); } -RegisterDialog::RegisterDialog(LoginData *loginData): +RegisterDialog::RegisterDialog(LoginData *data): Window(_("Register")), mEmailField(0), mMaleButton(0), mFemaleButton(0), mWrongDataNoticeListener(new WrongDataNoticeListener), - mLoginData(loginData) + mLoginData(data) { int optionalActions = Net::getLoginHandler()->supportedOptionalActions(); gcn::Label *userLabel = new Label(_("Name:")); gcn::Label *passwordLabel = new Label(_("Password:")); gcn::Label *confirmLabel = new Label(_("Confirm:")); - mUserField = new TextField(loginData->username); - mPasswordField = new PasswordField(loginData->password); + mUserField = new TextField(mLoginData->username); + mPasswordField = new PasswordField(mLoginData->password); mConfirmField = new PasswordField; mRegisterButton = new Button(_("Register"), "register", this); mCancelButton = new Button(_("Cancel"), "cancel", this); @@ -161,7 +161,7 @@ void RegisterDialog::action(const gcn::ActionEvent &event) const std::string user = mUserField->getText(); logger->log("RegisterDialog::register Username is %s", user.c_str()); - std::string errorMessage; + std::string errorMsg; int error = 0; unsigned int minUser = Net::getLoginHandler()->getMinUserNameLength(); @@ -172,7 +172,7 @@ void RegisterDialog::action(const gcn::ActionEvent &event) if (user.length() < minUser) { // Name too short - errorMessage = strprintf + errorMsg = strprintf (_("The username needs to be at least %d characters long."), minUser); error = 1; @@ -180,7 +180,7 @@ void RegisterDialog::action(const gcn::ActionEvent &event) else if (user.length() > maxUser - 1 ) { // Name too long - errorMessage = strprintf + errorMsg = strprintf (_("The username needs to be less than %d characters long."), maxUser); error = 1; @@ -188,7 +188,7 @@ void RegisterDialog::action(const gcn::ActionEvent &event) else if (mPasswordField->getText().length() < minPass) { // Pass too short - errorMessage = strprintf + errorMsg = strprintf (_("The password needs to be at least %d characters long."), minPass); error = 2; @@ -196,7 +196,7 @@ void RegisterDialog::action(const gcn::ActionEvent &event) else if (mPasswordField->getText().length() > maxPass - 1 ) { // Pass too long - errorMessage = strprintf + errorMsg = strprintf (_("The password needs to be less than %d characters long."), maxPass); error = 2; @@ -204,7 +204,7 @@ void RegisterDialog::action(const gcn::ActionEvent &event) else if (mPasswordField->getText() != mConfirmField->getText()) { // Password does not match with the confirmation one - errorMessage = _("Passwords do not match."); + errorMsg = _("Passwords do not match."); error = 2; } @@ -225,7 +225,7 @@ void RegisterDialog::action(const gcn::ActionEvent &event) mWrongDataNoticeListener->setTarget(this->mPasswordField); } - OkDialog *dlg = new OkDialog(_("Error"), errorMessage); + OkDialog *dlg = new OkDialog(_("Error"), errorMsg); dlg->addActionListener(mWrongDataNoticeListener); } else diff --git a/src/gui/sdlfont.cpp b/src/gui/sdlfont.cpp index 8dd7f929d..b196ae4e4 100644 --- a/src/gui/sdlfont.cpp +++ b/src/gui/sdlfont.cpp @@ -48,8 +48,8 @@ char *strBuf; class SDLTextChunk { public: - SDLTextChunk(const std::string &text, const gcn::Color &color) : - img(0), text(text), color(color) + SDLTextChunk(const std::string &text0, const gcn::Color &color0) : + img(0), text(text0), color(color0) { } diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index 763c190d6..f9d6ebfd0 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -548,7 +548,7 @@ void ServerDialog::mouseClicked(gcn::MouseEvent &mouseEvent) void ServerDialog::logic() { { - MutexLocker lock(&mMutex); + MutexLocker tempLock(&mMutex); if (mDownloadStatus == DOWNLOADING_COMPLETE) { mDownloadStatus = DOWNLOADING_OVER; @@ -636,11 +636,11 @@ void ServerDialog::loadServers(bool addNew) return; } - int version = XML::getProperty(rootNode, "version", 0); - if (version != 1) + int ver = XML::getProperty(rootNode, "version", 0); + if (ver != 1) { logger->log("Error: unsupported online server list version: %d", - version); + ver); return; } @@ -703,7 +703,7 @@ void ServerDialog::loadServers(bool addNew) server.version.first = gui->getFont()->getWidth(version); server.version.second = version; - MutexLocker lock(&mMutex); + MutexLocker tempLock(&mMutex); // Add the server to the local list if it's not already present bool found = false; for (unsigned int i = 0; i < mServers.size(); i++) diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index 7bbcd9a2c..bc210075a 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -478,20 +478,20 @@ void Setup_Video::apply() fullscreen = !fullscreen; if (!mainGraphics->setFullscreen(fullscreen)) { - std::stringstream errorMessage; + std::stringstream errorMsg; if (fullscreen) { - errorMessage << _("Failed to switch to windowed mode " - "and restoration of old mode also " - "failed!") << std::endl; + errorMsg << _("Failed to switch to windowed mode " + "and restoration of old mode also " + "failed!") << std::endl; } else { - errorMessage << _("Failed to switch to fullscreen mode" - " and restoration of old mode also " - "failed!") << std::endl; + errorMsg << _("Failed to switch to fullscreen mode" + " and restoration of old mode also " + "failed!") << std::endl; } - logger->error(errorMessage.str()); + logger->error(errorMsg.str()); } } #if defined(WIN32) || defined(__APPLE__) diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp index 5cf1573bb..c62c3254c 100644 --- a/src/gui/shopwindow.cpp +++ b/src/gui/shopwindow.cpp @@ -596,7 +596,7 @@ void ShopWindow::sendMessage(const std::string &nick, if (config.getBoolValue("hideShopMessages")) Net::getChatHandler()->privateMessage(nick, data); else if (chatWindow) - chatWindow->whisper(nick, data, BY_PLAYER); + chatWindow->addWhisper(nick, data, BY_PLAYER); //here was true } diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index 7feca8bf4..886894564 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -962,7 +962,7 @@ public: { name = *i; } - Avatar *ava = new Avatar(name); + ava = new Avatar(name); ava->setOnline(true); ava->setLevel(level); ava->setType(MapItem::PRIORITY); @@ -997,7 +997,7 @@ public: { name = *i; } - Avatar *ava = new Avatar(name); + ava = new Avatar(name); ava->setOnline(true); ava->setLevel(level); ava->setType(MapItem::ATTACK); @@ -1032,7 +1032,7 @@ public: { name = *i; } - Avatar *ava = new Avatar(name); + ava = new Avatar(name); ava->setOnline(false); ava->setLevel(level); ava->setType(MapItem::IGNORE_); diff --git a/src/gui/textcommandeditor.cpp b/src/gui/textcommandeditor.cpp index 9d759c4a2..1e18da57a 100644 --- a/src/gui/textcommandeditor.cpp +++ b/src/gui/textcommandeditor.cpp @@ -61,11 +61,11 @@ class IconsModal : public gcn::ListModel public: IconsModal() { - std::map info = ItemDB::getItemInfos(); + std::map items = ItemDB::getItemInfos(); std::list tempStrings; for (std::map::const_iterator - i = info.begin(), i_end = info.end(); + i = items.begin(), i_end = items.end(); i != i_end; ++i) { if (i->first < 0) diff --git a/src/gui/tradewindow.cpp b/src/gui/tradewindow.cpp index 3c19ee9c2..d0ae67746 100644 --- a/src/gui/tradewindow.cpp +++ b/src/gui/tradewindow.cpp @@ -443,10 +443,10 @@ void TradeWindow::initTrade(std::string nick) bool TradeWindow::checkItem(Item *item) { - Item *tradeItem = mMyInventory->findItem( + Item *tItem = mMyInventory->findItem( item->getId(), item->getColor()); - if (tradeItem && (tradeItem->getQuantity() > 1 + if (tItem && (tItem->getQuantity() > 1 || item->getQuantity() > 1)) { if (localChatTab) diff --git a/src/gui/unregisterdialog.cpp b/src/gui/unregisterdialog.cpp index 568e0613e..e875000c4 100644 --- a/src/gui/unregisterdialog.cpp +++ b/src/gui/unregisterdialog.cpp @@ -46,10 +46,10 @@ #include "debug.h" -UnRegisterDialog::UnRegisterDialog(LoginData *loginData): +UnRegisterDialog::UnRegisterDialog(LoginData *data): Window(_("Unregister"), true), mWrongDataNoticeListener(new WrongDataNoticeListener), - mLoginData(loginData) + mLoginData(data) { gcn::Label *userLabel = new Label(strprintf(_("Name: %s"), mLoginData-> username.c_str())); @@ -108,7 +108,7 @@ void UnRegisterDialog::action(const gcn::ActionEvent &event) logger->log("UnregisterDialog::unregistered, Username is %s", username.c_str()); - std::stringstream errorMessage; + std::stringstream errorMsg; bool error = false; unsigned int min = Net::getLoginHandler()->getMinPasswordLength(); @@ -118,15 +118,15 @@ void UnRegisterDialog::action(const gcn::ActionEvent &event) if (password.length() < min) { // Pass too short - errorMessage << strprintf(_("The password needs to be at least %d " - "characters long."), min); + errorMsg << strprintf(_("The password needs to be at least %d " + "characters long."), min); error = true; } else if (password.length() > max - 1) { // Pass too long - errorMessage << strprintf(_("The password needs to be less than " - "%d characters long."), max); + errorMsg << strprintf(_("The password needs to be less than " + "%d characters long."), max); error = true; } @@ -134,7 +134,7 @@ void UnRegisterDialog::action(const gcn::ActionEvent &event) { mWrongDataNoticeListener->setTarget(this->mPasswordField); - OkDialog *dlg = new OkDialog(_("Error"), errorMessage.str()); + OkDialog *dlg = new OkDialog(_("Error"), errorMsg.str()); dlg->addActionListener(mWrongDataNoticeListener); } else diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 073697459..461dd581d 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -489,7 +489,7 @@ void Viewport::mousePressed(gcn::MouseEvent &event) if (actorSpriteManager) { if (player_node != mHoverBeing || mSelfMouseHeal) - actorSpriteManager->heal(player_node, mHoverBeing); + actorSpriteManager->heal(mHoverBeing); } } else if (player_node->withinAttackRange(mHoverBeing) || diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index 29fca7662..18dc48417 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -330,7 +330,7 @@ void AvatarListBox::mousePressed(gcn::MouseEvent &event) Being* being = actorSpriteManager->findBeingByName(ava->getName(), Being::PLAYER); if (being) - actorSpriteManager->heal(player_node, being); + actorSpriteManager->heal(being); } else { diff --git a/src/gui/widgets/mouseevent.h b/src/gui/widgets/mouseevent.h index 5e9a46cfd..9484be0a5 100644 --- a/src/gui/widgets/mouseevent.h +++ b/src/gui/widgets/mouseevent.h @@ -28,12 +28,12 @@ class MouseEvent : public gcn::MouseEvent { public: - MouseEvent(gcn::Widget* source, bool isShiftPressed, - bool isControlPressed, bool isAltPressed, - bool isMetaPressed, unsigned int type, unsigned int button, + MouseEvent(gcn::Widget* source, bool shiftPressed, + bool controlPressed, bool altPressed, + bool metaPressed, unsigned int type, unsigned int button, int x, int y, int clickCount) : - gcn::MouseEvent(source, isShiftPressed, isControlPressed, - isAltPressed, isMetaPressed, type, button, x, y, + gcn::MouseEvent(source, shiftPressed, controlPressed, + altPressed, metaPressed, type, button, x, y, clickCount) { } diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index eaec791ee..487035350 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -315,13 +315,13 @@ void WindowMenu::mouseExited(gcn::MouseEvent& mouseEvent A_UNUSED) mTextPopup->hide(); } -void WindowMenu::showButton(std::string name, bool isVisible) +void WindowMenu::showButton(std::string name, bool visible) { Button *btn = dynamic_cast(mButtonNames[name]); if (!btn) return; - btn->setVisible(isVisible); + btn->setVisible(visible); updateButtons(); saveButtons(); } diff --git a/src/gui/windowmenu.h b/src/gui/windowmenu.h index 6572fe470..739a302ba 100644 --- a/src/gui/windowmenu.h +++ b/src/gui/windowmenu.h @@ -72,7 +72,7 @@ class WindowMenu : public Container, std::vector &getButtons() { return mButtons; } - void showButton(std::string name, bool isVisible); + void showButton(std::string name, bool visible); void loadButtons(); -- cgit v1.2.3-70-g09d2