|
|
@ -66,32 +66,38 @@ bool itemPassesScreen(color_ostream& out, df::item* item) {
|
|
|
|
&& isAccessible(out, item);
|
|
|
|
&& isAccessible(out, item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
df::job_item getJobItemWithHeatSafety(const df::job_item *job_item, HeatSafety heat) {
|
|
|
|
bool matchesHeatSafety(int16_t mat_type, int32_t mat_index, HeatSafety heat) {
|
|
|
|
df::job_item jitem = *job_item;
|
|
|
|
if (heat == HEAT_SAFETY_ANY)
|
|
|
|
if (heat >= HEAT_SAFETY_MAGMA) {
|
|
|
|
return true;
|
|
|
|
jitem.flags2.bits.magma_safe = true;
|
|
|
|
|
|
|
|
jitem.flags2.bits.fire_safe = false;
|
|
|
|
MaterialInfo minfo(mat_type, mat_index);
|
|
|
|
} else if (heat == HEAT_SAFETY_FIRE && !jitem.flags2.bits.magma_safe)
|
|
|
|
df::job_item_flags2 ok;
|
|
|
|
jitem.flags2.bits.fire_safe = true;
|
|
|
|
df::job_item_flags2 mask;
|
|
|
|
return jitem;
|
|
|
|
minfo.getMatchBits(ok, mask);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (heat >= HEAT_SAFETY_MAGMA)
|
|
|
|
|
|
|
|
return ok.bits.magma_safe;
|
|
|
|
|
|
|
|
if (heat == HEAT_SAFETY_FIRE)
|
|
|
|
|
|
|
|
return ok.bits.fire_safe || ok.bits.magma_safe;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool matchesFilters(df::item * item, const df::job_item * job_item, HeatSafety heat, const ItemFilter &item_filter, const std::set<string> &specials) {
|
|
|
|
bool matchesFilters(df::item * item, const df::job_item * jitem, HeatSafety heat, const ItemFilter &item_filter, const std::set<string> &specials) {
|
|
|
|
// check the properties that are not checked by Job::isSuitableItem()
|
|
|
|
// check the properties that are not checked by Job::isSuitableItem()
|
|
|
|
if (job_item->item_type > -1 && job_item->item_type != item->getType())
|
|
|
|
if (jitem->item_type > -1 && jitem->item_type != item->getType())
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
if (job_item->item_subtype > -1 &&
|
|
|
|
if (jitem->item_subtype > -1 &&
|
|
|
|
job_item->item_subtype != item->getSubtype())
|
|
|
|
jitem->item_subtype != item->getSubtype())
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
if (job_item->flags2.bits.building_material && !item->isBuildMat())
|
|
|
|
if (jitem->flags2.bits.building_material && !item->isBuildMat())
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
if ((job_item->flags1.bits.empty || job_item->flags2.bits.lye_milk_free)) {
|
|
|
|
if ((jitem->flags1.bits.empty || jitem->flags2.bits.lye_milk_free)) {
|
|
|
|
auto gref = Items::getGeneralRef(item, df::general_ref_type::CONTAINS_ITEM);
|
|
|
|
auto gref = Items::getGeneralRef(item, df::general_ref_type::CONTAINS_ITEM);
|
|
|
|
if (gref) {
|
|
|
|
if (gref) {
|
|
|
|
if (job_item->flags1.bits.empty)
|
|
|
|
if (jitem->flags1.bits.empty)
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
if (auto contained_item = gref->getItem(); contained_item) {
|
|
|
|
if (auto contained_item = gref->getItem(); contained_item) {
|
|
|
|
MaterialInfo mi;
|
|
|
|
MaterialInfo mi;
|
|
|
@ -102,23 +108,24 @@ bool matchesFilters(df::item * item, const df::job_item * job_item, HeatSafety h
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (job_item->metal_ore > -1 && !item->isMetalOre(job_item->metal_ore))
|
|
|
|
if (jitem->metal_ore > -1 && !item->isMetalOre(jitem->metal_ore))
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
if (job_item->has_tool_use > df::tool_uses::NONE
|
|
|
|
if (jitem->has_tool_use > df::tool_uses::NONE
|
|
|
|
&& !item->hasToolUse(job_item->has_tool_use))
|
|
|
|
&& !item->hasToolUse(jitem->has_tool_use))
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
if (item->getType() == df::item_type::SLAB && specials.count("engraved")
|
|
|
|
if (item->getType() == df::item_type::SLAB && specials.count("engraved")
|
|
|
|
&& static_cast<df::item_slabst *>(item)->engraving_type != df::slab_engraving_type::Memorial)
|
|
|
|
&& static_cast<df::item_slabst *>(item)->engraving_type != df::slab_engraving_type::Memorial)
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
df::job_item jitem = getJobItemWithHeatSafety(job_item, heat);
|
|
|
|
if (!matchesHeatSafety(item->getMaterial(), item->getMaterialIndex(), heat))
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
return Job::isSuitableItem(
|
|
|
|
return Job::isSuitableItem(
|
|
|
|
&jitem, item->getType(), item->getSubtype())
|
|
|
|
jitem, item->getType(), item->getSubtype())
|
|
|
|
&& Job::isSuitableMaterial(
|
|
|
|
&& Job::isSuitableMaterial(
|
|
|
|
&jitem, item->getMaterial(), item->getMaterialIndex(),
|
|
|
|
jitem, item->getMaterial(), item->getMaterialIndex(),
|
|
|
|
item->getType())
|
|
|
|
item->getType())
|
|
|
|
&& item_filter.matches(item);
|
|
|
|
&& item_filter.matches(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|