Merge pull request #1385 from ab9rf/labormanager-cleaning

labormanager: assign more dwarves to cleaning
develop
Lethosor 2018-12-23 23:14:53 -05:00 committed by GitHub
commit 0209e76f19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

@ -1911,6 +1911,11 @@ public:
labors_changed = true; labors_changed = true;
} }
} }
else if (l == df::unit_labor::CLEAN && best_score < 0)
{
if (Units::isValidLabor((*bestdwarf)->dwarf, l))
set_labor(*bestdwarf, l, true);
}
else if ((*bestdwarf)->state == IDLE) else if ((*bestdwarf)->state == IDLE)
{ {
if (Units::isValidLabor((*bestdwarf)->dwarf, l)) if (Units::isValidLabor((*bestdwarf)->dwarf, l))
@ -1961,6 +1966,10 @@ public:
{ {
set_labor(*d, l, true); set_labor(*d, l, true);
} }
if (score < 0)
set_labor(*d, df::unit_labor::CLEAN, true);
if ((*d)->using_labor != df::unit_labor::NONE && if ((*d)->using_labor != df::unit_labor::NONE &&
(score > current_score + 5000 || base_priority[(*d)->using_labor] < base_priority[l]) && (score > current_score + 5000 || base_priority[(*d)->using_labor] < base_priority[l]) &&
default_labor_infos[(*d)->using_labor].tool == TOOL_NONE) default_labor_infos[(*d)->using_labor].tool == TOOL_NONE)
@ -1990,6 +1999,8 @@ public:
set_labor(canary_dwarf, l, true); set_labor(canary_dwarf, l, true);
} }
set_labor(canary_dwarf, df::unit_labor::CLEAN, true);
/* Also set the canary to remove constructions, because we have no way yet to tell if there are constructions needing removal */ /* Also set the canary to remove constructions, because we have no way yet to tell if there are constructions needing removal */
set_labor(canary_dwarf, df::unit_labor::REMOVE_CONSTRUCTION, true); set_labor(canary_dwarf, df::unit_labor::REMOVE_CONSTRUCTION, true);