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

Function getVectorIds

plugins/buildingplan/buildingplan.cpp:425–455  ·  view source on GitHub ↗

get a list of item vectors that we should search for matches

Source from the content-addressed store, hash-verified

423
424// get a list of item vectors that we should search for matches
425vector<df::job_item_vector_id> getVectorIds(color_ostream &out, const df::job_item *job_item, bool ignore_filters) {
426 std::vector<df::job_item_vector_id> ret;
427
428 // if the filter already has the vector_id set to something specific, use it
429 if (job_item->vector_id > df::job_item_vector_id::IN_PLAY)
430 {
431 DEBUG(control,out).print("using vector_id from job_item: {}\n",
432 ENUM_KEY_STR(job_item_vector_id, job_item->vector_id));
433 ret.push_back(job_item->vector_id);
434 return ret;
435 }
436
437 // if the filter is for building material, refer to our global settings for
438 // which vectors to search
439 if (job_item->flags2.bits.building_material)
440 {
441 if (ignore_filters || config.get_bool(CONFIG_BLOCKS))
442 ret.push_back(df::job_item_vector_id::BLOCKS);
443 if (ignore_filters || config.get_bool(CONFIG_BOULDERS))
444 ret.push_back(df::job_item_vector_id::BOULDER);
445 if (ignore_filters || config.get_bool(CONFIG_LOGS))
446 ret.push_back(df::job_item_vector_id::WOOD);
447 if (ignore_filters || config.get_bool(CONFIG_BARS))
448 ret.push_back(df::job_item_vector_id::BAR);
449 }
450
451 // fall back to IN_PLAY if no other vector was appropriate
452 if (ret.empty())
453 ret.push_back(df::job_item_vector_id::IN_PLAY);
454 return ret;
455}
456
457static bool registerPlannedBuilding(color_ostream &out, PlannedBuilding & pb, bool unsuspend_on_finalize) {
458 df::building * bld = pb.getBuildingIfValidOrRemoveIfNot(out);

Callers 2

scanAvailableItemsFunction · 0.85
get_vector_idsFunction · 0.85

Calls 2

printMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected