From eb0c8a2a08a7b55eb80667b106657aeee4023dd9 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 27 Jan 2016 18:55:52 +0300 Subject: remove removepickup action from social window popup menu. --- src/actions/commands.cpp | 20 +++++++++++++++++++- src/actormanager.cpp | 5 +++++ src/actormanager.h | 2 ++ src/gui/popups/popupmenu.cpp | 27 +-------------------------- 4 files changed, 27 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index b57883841..9f38844ee 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -1158,6 +1158,7 @@ impHandler(addPickup) { if (actorManager) { + actorManager->removePickupItem(event.args); actorManager->addPickupItem(event.args); if (socialWindow) socialWindow->updatePickupFilter(); @@ -1170,7 +1171,23 @@ impHandler(removePickup) { if (actorManager) { - actorManager->removePickupItem(event.args); + if (event.args.empty()) + { // default pickup manipulation + if (actorManager->checkDefaultPickup()) + { + actorManager->removePickupItem(event.args); + actorManager->addIgnorePickupItem(event.args); + } + else + { + actorManager->removePickupItem(event.args); + actorManager->addPickupItem(event.args); + } + } + else + { // any other pickups + actorManager->removePickupItem(event.args); + } if (socialWindow) socialWindow->updatePickupFilter(); return true; @@ -1182,6 +1199,7 @@ impHandler(ignorePickup) { if (actorManager) { + actorManager->removePickupItem(event.args); actorManager->addIgnorePickupItem(event.args); if (socialWindow) socialWindow->updatePickupFilter(); diff --git a/src/actormanager.cpp b/src/actormanager.cpp index 70dcd8c30..ba8822bf0 100644 --- a/src/actormanager.cpp +++ b/src/actormanager.cpp @@ -1879,6 +1879,11 @@ bool ActorManager::checkForPickup(const FloorItem *const item) const return false; } +bool ActorManager::checkDefaultPickup() const +{ + return mPickupItemsSet.find("") != mPickupItemsSet.end(); +} + void ActorManager::updateEffects(const std::map &addEffects, const std::set &removeEffects) const diff --git a/src/actormanager.h b/src/actormanager.h index add1a4e54..536c70b63 100644 --- a/src/actormanager.h +++ b/src/actormanager.h @@ -347,6 +347,8 @@ class ActorManager final: public ConfigListener bool checkForPickup(const FloorItem *const item) const A_WARN_UNUSED; + bool checkDefaultPickup() const A_WARN_UNUSED; + void updateEffects(const std::map &addEffects, const std::set &removeEffects) const; diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index e792b2bb4..d2e4a100d 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -1289,31 +1289,6 @@ void PopupMenu::handleLink(const std::string &link, socialWindow->updateAttackFilter(); } } - else if (link == "pickup remove") - { - if (actorManager) - { - if (mNick.empty()) - { - if (actorManager->isInPickupList(mNick)) - { - actorManager->removePickupItem(mNick); - actorManager->addIgnorePickupItem(mNick); - } - else - { - actorManager->removePickupItem(mNick); - actorManager->addPickupItem(mNick); - } - } - else - { - actorManager->removePickupItem(mNick); - } - if (socialWindow) - socialWindow->updatePickupFilter(); - } - } else if (link == "reset yellow") { GameModifiers::resetModifiers(); @@ -2129,7 +2104,7 @@ void PopupMenu::showPickupItemPopup(const int x, const int y, // TRANSLATORS: popup menu item // TRANSLATORS: remove item from pickup filter - mBrowserBox->addRow("pickup remove", _("Remove")); + mBrowserBox->addRow("/removepickup 'NAME'", _("Remove")); mBrowserBox->addRow("##3---"); // TRANSLATORS: popup menu item // TRANSLATORS: close menu -- cgit v1.2.3-70-g09d2