Skip to content

Commit

Permalink
Check items against exclude rules if AUTO_PICKUP_ZERO is enabled.
Browse files Browse the repository at this point in the history
  • Loading branch information
OzoneH3 committed Jul 8, 2014
1 parent aef9543 commit 4aee442
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/auto_pickup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,19 @@ void createPickupRules(const std::string sItemNameIn)
}
}

bool checkExcludeRules(const std::string sItemNameIn)
{
for (std::vector<cPickupRules>::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
Expand Down
1 change: 1 addition & 0 deletions src/auto_pickup.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion src/pickup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 4aee442

Please sign in to comment.