diff --git a/src/auto_pickup.cpp b/src/auto_pickup.cpp index cfbe3bb67cb1f..d8373dd9312e3 100644 --- a/src/auto_pickup.cpp +++ b/src/auto_pickup.cpp @@ -644,6 +644,19 @@ void createPickupRules(const std::string sItemNameIn) } } +bool checkExcludeRules(const std::string sItemNameIn) +{ + for (std::vector::iterator pattern_it = vAutoPickupRules[APU_MERGED].begin(); + pattern_it != vAutoPickupRules[APU_MERGED].end(); ++pattern_it) { + if (pattern_it->bExclude && pattern_it->bActive && + auto_pickup_match(sItemNameIn, pattern_it->sRule)) { + return false; + } + } + + return true; +} + void save_reset_changes(bool bReset) { for (int i = APU_GLOBAL; i <= APU_CHARACTER; i++) { //Loop through global 1 and character 2 diff --git a/src/auto_pickup.h b/src/auto_pickup.h index 1a140b0976139..093fb8738189f 100644 --- a/src/auto_pickup.h +++ b/src/auto_pickup.h @@ -45,6 +45,7 @@ bool hasPickupRule(std::string sRule); void addPickupRule(std::string sRule); void removePickupRule(std::string sRule); void createPickupRules(const std::string sItemNameIn = ""); +bool checkExcludeRules(const std::string sItemNameIn); void save_reset_changes(bool bReset); void show_auto_pickup(); void load_auto_pickup(bool bCharacter); diff --git a/src/pickup.cpp b/src/pickup.cpp index 216ec6bcd7be6..356a3027d6b25 100644 --- a/src/pickup.cpp +++ b/src/pickup.cpp @@ -388,7 +388,8 @@ void Pickup::pick_up(int posx, int posy, int min) //Auto Pickup all items with 0 Volume and Weight <= AUTO_PICKUP_ZERO * 50 if (OPTIONS["AUTO_PICKUP_ZERO"]) { if (here[i].volume() == 0 && - here[i].weight() <= OPTIONS["AUTO_PICKUP_ZERO"] * 50) { + here[i].weight() <= OPTIONS["AUTO_PICKUP_ZERO"] * 50 && + checkExcludeRules(here[i].tname())) { bPickup = true; } }