MCPcopy Create free account
hub / github.com/DFHack/dfhack / build_choice_matches

Function build_choice_matches

plugins/jobutils.cpp:167–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165}
166
167static bool build_choice_matches(df::ui_build_item_req *req, df::build_req_choicest *choice,
168 MaterialInfo &new_mat, bool ignore_select)
169{
170 if (VIRTUAL_CAST_VAR(gen, df::build_req_choice_genst, choice))
171 {
172 if (gen->mat_type == new_mat.type &&
173 gen->mat_index == new_mat.index &&
174 (ignore_select || size_t(gen->used_count) < gen->candidates.size()))
175 {
176 return true;
177 }
178 }
179 else if (VIRTUAL_CAST_VAR(spec, df::build_req_choice_specst, choice))
180 {
181 if (spec->candidate &&
182 spec->candidate->getActualMaterial() == new_mat.type &&
183 spec->candidate->getActualMaterialIndex() == new_mat.index &&
184 (ignore_select || !req->candidate_selected[spec->candidate_id]))
185 {
186 return true;
187 }
188 }
189
190 return false;
191}
192
193static command_result job_material_in_build(color_ostream &out, MaterialInfo &new_mat)
194{

Callers 1

job_material_in_buildFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected