| 658 | |
| 659 | private: |
| 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 | { |
no test coverage detected