Autolabor: splints and crutches are furniture (at least at a forge); remove test that excludes pet owners from being given jobs when they're idle; add test for hungry/thirsty dwarves to trigger a feed/water civilians requirement; add a vehicle hauling requirement based on the existence of hauling routes

develop
Kelly Martin 2012-12-03 04:28:08 -06:00
parent 9563dae5d7
commit 208b9915ea
1 changed files with 18 additions and 5 deletions

@ -56,6 +56,7 @@
#include <df/unit_health_info.h>
#include <df/unit_health_flags.h>
#include <df/building_design.h>
#include <df/vehicle.h>
#include <MiscUtils.h>
@ -1143,9 +1144,9 @@ public:
job_to_labor_table[df::job_type::ConstructGrate] = jlf_make_furniture;
job_to_labor_table[df::job_type::RemoveStairs] = jlf_const(df::unit_labor::MINE);
job_to_labor_table[df::job_type::ConstructQuern] = jlf_make_furniture;
job_to_labor_table[df::job_type::ConstructMillstone] = jlf_make_furniture ;
job_to_labor_table[df::job_type::ConstructSplint] = jlf_make_object ;
job_to_labor_table[df::job_type::ConstructCrutch] = jlf_make_object;
job_to_labor_table[df::job_type::ConstructMillstone] = jlf_make_furniture;
job_to_labor_table[df::job_type::ConstructSplint] = jlf_make_furniture;
job_to_labor_table[df::job_type::ConstructCrutch] = jlf_make_furniture;
job_to_labor_table[df::job_type::ConstructTractionBench] = jlf_const(df::unit_labor::MECHANIC);
job_to_labor_table[df::job_type::CleanSelf] = jlf_no_labor;
job_to_labor_table[df::job_type::BringCrutch] = jlf_no_labor;
@ -1422,6 +1423,8 @@ private:
int cnt_traction;
int cnt_crutch;
int need_food_water;
std::map<df::unit_labor, int> labor_needed;
std::vector<dwarf_info_t*> dwarf_info;
std::list<dwarf_info_t*> available_dwarfs;
@ -1667,8 +1670,6 @@ private:
{
if (is_on_break)
state = OTHER;
else if (dwarf->dwarf->specific_refs.size() > 0)
state = OTHER;
else if (dwarf->dwarf->burrows.size() > 0)
state = OTHER; // dwarfs assigned to burrows are treated as if permanently busy
else if (dwarf->dwarf->status2.able_grasp_impair == 0)
@ -1721,6 +1722,9 @@ private:
cnt_crutch++;
}
if (dwarf->dwarf->counters2.hunger_timer > 60000 || dwarf->dwarf->counters2.thirst_timer > 40000)
need_food_water++;
// find dwarf's highest effective skill
int high_skill = 0;
@ -1788,6 +1792,7 @@ public:
dig_count = tree_count = plant_count = detail_count = pick_count = axe_count = 0;
cnt_recover_wounded = cnt_diagnosis = cnt_immobilize = cnt_dressing = cnt_cleaning = cnt_surgery = cnt_suture =
cnt_setting = cnt_traction = cnt_crutch = 0;
need_food_water = 0;
FOR_ENUM_ITEMS(unit_labor, l)
{
@ -1837,6 +1842,8 @@ public:
labor_needed[df::unit_labor::BONE_SETTING] += cnt_traction;
labor_needed[df::unit_labor::HAUL_ITEM] += cnt_crutch;
labor_needed[df::unit_labor::FEED_WATER_CIVILIANS] += need_food_water;
// add entries for hauling jobs
labor_needed[df::unit_labor::HAUL_STONE] += world->stockpile.num_jobs[1];
@ -1848,6 +1855,12 @@ public:
labor_needed[df::unit_labor::HAUL_FURNITURE] += world->stockpile.num_jobs[8];
labor_needed[df::unit_labor::HAUL_ANIMAL] += world->stockpile.num_jobs[9];
// add entries for vehicle hauling
for (auto v = world->vehicles.all.begin(); v != world->vehicles.all.end(); v++)
if ((*v)->route_id != -1)
labor_needed[df::unit_labor::PUSH_HAUL_VEHICLE]++;
if (print_debug)
{
for (auto i = labor_needed.begin(); i != labor_needed.end(); i++)