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

Method set_labor

plugins/autolabor/labormanager.cpp:660–683  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

658
659private:
660 void set_labor(dwarf_info_t* dwarf, df::unit_labor labor, bool value)
661 {
662 if (labor >= 0 && labor <= ENUM_LAST_ITEM(unit_labor) && !labor_infos[labor].is_unmanaged())
663 {
664 if (!Units::isValidLabor(dwarf->dwarf, labor))
665 {
666 debug("WARN(labormanager): Attempted to %s dwarf %s with ineligible labor %s\n",
667 value ? "set" : "unset",
668 dwarf->dwarf->name.first_name.c_str(),
669 ENUM_KEY_STR(unit_labor, labor).c_str());
670 return;
671 }
672 bool old = dwarf->dwarf->status.labors[labor];
673 dwarf->dwarf->status.labors[labor] = value;
674 if (old != value)
675 {
676 labors_changed = true;
677
678 tools_enum tool = default_labor_infos[labor].tool;
679 if (tool != TOOL_NONE)
680 tool_in_use[tool] += value ? 1 : -1;
681 }
682 }
683 }
684
685 void process_job(df::job* j)
686 {

Callers 1

FOR_ENUM_ITEMSFunction · 0.80

Calls 3

debugFunction · 0.85
is_unmanagedMethod · 0.80
c_strMethod · 0.80

Tested by

no test coverage detected