|
|
|
@ -1016,7 +1016,7 @@ private:
|
|
|
|
|
|
|
|
|
|
df::unit_labor labor = labor_mapper->find_job_labor(j);
|
|
|
|
|
|
|
|
|
|
if (labor != df::unit_labor::NONE)
|
|
|
|
|
if (labor != df::unit_labor::NONE && !labor_infos[labor].is_disabled())
|
|
|
|
|
{
|
|
|
|
|
labor_needed[labor]++;
|
|
|
|
|
if (worker == -1)
|
|
|
|
@ -1143,7 +1143,7 @@ private:
|
|
|
|
|
{
|
|
|
|
|
df::item* item = *i;
|
|
|
|
|
|
|
|
|
|
if (item->flags.bits.dump)
|
|
|
|
|
if (item->flags.bits.dump && !labor_infos[df::unit_labor::HAUL_REFUSE].is_disabled())
|
|
|
|
|
labor_needed[df::unit_labor::HAUL_REFUSE]++;
|
|
|
|
|
|
|
|
|
|
if (item->flags.whole & bad_flags.whole)
|
|
|
|
@ -1443,7 +1443,7 @@ private:
|
|
|
|
|
|
|
|
|
|
FOR_ENUM_ITEMS(unit_labor, labor)
|
|
|
|
|
{
|
|
|
|
|
if (labor == df::unit_labor::NONE)
|
|
|
|
|
if (labor == df::unit_labor::NONE || labor_infos[labor].is_disabled())
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
df::job_skill skill = labor_to_skill[labor];
|
|
|
|
@ -1463,7 +1463,7 @@ private:
|
|
|
|
|
{
|
|
|
|
|
FOR_ENUM_ITEMS(unit_labor, labor)
|
|
|
|
|
{
|
|
|
|
|
if (labor == unit_labor::NONE)
|
|
|
|
|
if (labor == unit_labor::NONE || labor_infos[labor].is_disabled())
|
|
|
|
|
continue;
|
|
|
|
|
if (Units::isValidLabor(dwarf->dwarf, labor))
|
|
|
|
|
set_labor(dwarf, labor, false);
|
|
|
|
@ -1707,6 +1707,8 @@ public:
|
|
|
|
|
if (l == df::unit_labor::NONE)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (!labor_infos[l].is_disabled())
|
|
|
|
|
{
|
|
|
|
|
int before = labor_needed[l];
|
|
|
|
|
|
|
|
|
|
labor_needed[l] = max(0, labor_needed[l] - labor_in_use[l]);
|
|
|
|
@ -1716,11 +1718,16 @@ public:
|
|
|
|
|
|
|
|
|
|
if (print_debug && before != labor_needed[l])
|
|
|
|
|
out.print("labor %s reduced from %d to %d\n", ENUM_KEY_STR(unit_labor, l).c_str(), before, labor_needed[l]);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
labor_needed[l] = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* assign food haulers for rotting food items */
|
|
|
|
|
|
|
|
|
|
if (!labor_infos[df::unit_labor::HAUL_FOOD].is_disabled())
|
|
|
|
|
{
|
|
|
|
|
if (priority_food > 0 && labor_infos[df::unit_labor::HAUL_FOOD].idle_dwarfs > 0)
|
|
|
|
|
priority_food = 1;
|
|
|
|
|
|
|
|
|
@ -1769,6 +1776,11 @@ public:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
priority_food = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (print_debug)
|
|
|
|
|
{
|
|
|
|
@ -1786,12 +1798,11 @@ public:
|
|
|
|
|
for (auto i = labor_needed.begin(); i != labor_needed.end(); i++)
|
|
|
|
|
{
|
|
|
|
|
df::unit_labor l = i->first;
|
|
|
|
|
if (l == df::unit_labor::NONE)
|
|
|
|
|
if (l == df::unit_labor::NONE || labor_infos[l].is_disabled())
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
const int user_specified_max_dwarfs = labor_infos[l].maximum_dwarfs();
|
|
|
|
|
|
|
|
|
|
// Allow values less than 0, they will disable this labor.
|
|
|
|
|
if (user_specified_max_dwarfs != MAX_DWARFS_NONE && i->second > user_specified_max_dwarfs)
|
|
|
|
|
{
|
|
|
|
|
i->second = user_specified_max_dwarfs;
|
|
|
|
@ -1951,7 +1962,7 @@ public:
|
|
|
|
|
|
|
|
|
|
FOR_ENUM_ITEMS(unit_labor, l)
|
|
|
|
|
{
|
|
|
|
|
if (l == df::unit_labor::NONE)
|
|
|
|
|
if (l == df::unit_labor::NONE || labor_infos[l].is_disabled())
|
|
|
|
|
continue;
|
|
|
|
|
if (l == (*d)->using_labor)
|
|
|
|
|
continue;
|
|
|
|
@ -2002,12 +2013,17 @@ public:
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Also set the canary to remove constructions, because we have no way yet to tell if there are constructions needing removal */
|
|
|
|
|
|
|
|
|
|
if (!labor_infos[df::unit_labor::REMOVE_CONSTRUCTION].is_disabled())
|
|
|
|
|
{
|
|
|
|
|
set_labor(canary_dwarf, df::unit_labor::REMOVE_CONSTRUCTION, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Set HAUL_WATER so we can detect ponds that need to be filled ponds. */
|
|
|
|
|
|
|
|
|
|
if (!labor_infos[df::unit_labor::HAUL_WATER].is_disabled())
|
|
|
|
|
{
|
|
|
|
|
set_labor(canary_dwarf, df::unit_labor::HAUL_WATER, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (print_debug)
|
|
|
|
|
out.print("Setting %s as the hauling canary\n", canary_dwarf->dwarf->name.first_name.c_str());
|
|
|
|
@ -2027,7 +2043,7 @@ public:
|
|
|
|
|
{
|
|
|
|
|
FOR_ENUM_ITEMS(unit_labor, l)
|
|
|
|
|
{
|
|
|
|
|
if (l == df::unit_labor::NONE)
|
|
|
|
|
if (l == df::unit_labor::NONE || labor_infos[l].is_disabled())
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (Units::isValidLabor((*d)->dwarf, l))
|
|
|
|
@ -2059,13 +2075,16 @@ public:
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!labor_infos[df::unit_labor::PULL_LEVER].is_disabled())
|
|
|
|
|
{
|
|
|
|
|
set_labor(*d, df::unit_labor::PULL_LEVER, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (any) continue;
|
|
|
|
|
|
|
|
|
|
FOR_ENUM_ITEMS(unit_labor, l)
|
|
|
|
|
{
|
|
|
|
|
if (l == df::unit_labor::NONE)
|
|
|
|
|
if (l == df::unit_labor::NONE || labor_infos[l].is_disabled())
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (to_assign[l] > 0 || l == df::unit_labor::CLEAN)
|
|
|
|
@ -2086,7 +2105,7 @@ public:
|
|
|
|
|
|
|
|
|
|
FOR_ENUM_ITEMS(unit_labor, l)
|
|
|
|
|
{
|
|
|
|
|
if (l == df::unit_labor::NONE)
|
|
|
|
|
if (l == df::unit_labor::NONE || labor_infos[l].is_disabled())
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
tools_enum t = default_labor_infos[l].tool;
|
|
|
|
|