summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/actormanager.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/actormanager.cpp b/src/actormanager.cpp
index e33798bab..73248cab3 100644
--- a/src/actormanager.cpp
+++ b/src/actormanager.cpp
@@ -2071,18 +2071,26 @@ void ActorManager::storeAttackList() const
bool ActorManager::checkForPickup(const FloorItem *const item) const
{
- if (mPickupItemsSet.find(std::string()) != mPickupItemsSet.end())
+ // if "default" is in pickup items set, then the ignore list acts
+ // as a blacklist. Otherwise, the pickup list acts as a whitelist.
+ const bool allowAll = mPickupItemsSet.find(std::string())
+ != mPickupItemsSet.end();
+
+ if (allowAll)
{
- if (mIgnorePickupItemsSet.find(item->getName())
- == mIgnorePickupItemsSet.end())
+ if (mIgnorePickupItemsSet.find(item->getName()) ==
+ mIgnorePickupItemsSet.end())
{
return true;
}
}
- else if ((item != nullptr) && mPickupItemsSet.find(item->getName())
- != mPickupItemsSet.end())
+ else
{
- return true;
+ if (mPickupItemsSet.find(item->getName()) !=
+ mPickupItemsSet.end())
+ {
+ return true;
+ }
}
return false;
}