Skip to content

Commit

Permalink
check stockpile settings for item types
Browse files Browse the repository at this point in the history
  • Loading branch information
myk002 committed Mar 10, 2024
1 parent 0324c3e commit f321eb4
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions plugins/logistics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "df/building_stockpilest.h"
#include "df/building_tradedepotst.h"
#include "df/caravan_state.h"
#include "df/furniture_type.h"
#include "df/general_ref_building_holderst.h"
#include "df/item.h"
#include "df/plotinfost.h"
Expand Down Expand Up @@ -448,18 +449,18 @@ static void scan_item(color_ostream &out, df::item *item, StockProcessor &proces
}

// quick check for type. this is intended to catch the case of newly empty storage item
// that happens to still be on the stockpile. we can do a more careful check if this isn't sufficient
// that happens to still be on the stockpile. we can do a more careful check (e.g. including
// item quality) if this isn't sufficient
static bool non_accepted_storage_item(df::building_stockpilest *bld, df::item *item) {
auto & flags = bld->settings.flags;
if (!flags.bits.furniture)
return false;
if (item->getType() == df::item_type::BIN)
return !flags.bits.furniture;

return !bld->settings.furniture.type[df::furniture_type::BIN];
if (item->hasToolUse(df::tool_uses::HEAVY_OBJECT_HAULING))
return !flags.bits.furniture;

return !bld->settings.furniture.type[df::furniture_type::WHEELBARROW];
if (item->isFoodStorage())
return !flags.bits.furniture;

return !bld->settings.furniture.type[df::furniture_type::FOOD_STORAGE];
return false;
}

Expand Down

0 comments on commit f321eb4

Please sign in to comment.