Merge pull request #3 from ab9rf/labormanager-0.43.03-working

Incorporate more updates cherrypicked from nocico
develop
Kelly Kinkade 2016-11-29 00:24:31 -06:00 committed by GitHub
commit 0ab3005a89
1 changed files with 11 additions and 5 deletions

@ -673,8 +673,14 @@ static df::building* get_building_from_job(df::job* j)
return 0;
}
static df::unit_labor construction_build_labor (df::item* i)
static df::unit_labor construction_build_labor (df::building_actual* b)
{
if (b->getType() == df::building_type::RoadPaved)
return df::unit_labor::BUILD_ROAD;
// For screw pumps contained_items[0] = pipe, 1 corkscrew, 2 block
// For wells 0 mechanism, 1 rope, 2 bucket, 3 block
// Trade depots and bridges use the last one too
df::item* i = b->contained_items.back()->item;
MaterialInfo matinfo;
if (i && matinfo.decode(i))
{
@ -813,7 +819,7 @@ private:
df::building_actual* b = (df::building_actual*) bld;
if (b->design && !b->design->flags.bits.designed)
return df::unit_labor::ARCHITECT;
return construction_build_labor(j->items[0]->item);
return construction_build_labor(b);
}
break;
case df::building_type::FarmPlot:
@ -911,8 +917,8 @@ private:
case df::building_type::Well:
case df::building_type::Windmill:
{
df::building_actual* b = (df::building_actual*) bld;
return construction_build_labor(b->contained_items[0]->item);
auto b = (df::building_actual*) bld;
return construction_build_labor(b);
}
break;
case df::building_type::FarmPlot:
@ -1273,7 +1279,7 @@ public:
job_to_labor_table[df::job_type::FireCatapult] = jlf_const(df::unit_labor::SIEGEOPERATE);
job_to_labor_table[df::job_type::FireBallista] = jlf_const(df::unit_labor::SIEGEOPERATE);
job_to_labor_table[df::job_type::ConstructMechanisms] = jlf_const(df::unit_labor::MECHANIC);
job_to_labor_table[df::job_type::MakeTrapComponent] = jlf_const(df::unit_labor::MECHANIC) ;
job_to_labor_table[df::job_type::MakeTrapComponent] = jlf_make_weapon;
job_to_labor_table[df::job_type::LoadCageTrap] = jlf_const(df::unit_labor::MECHANIC) ;
job_to_labor_table[df::job_type::LoadStoneTrap] = jlf_const(df::unit_labor::MECHANIC) ;
job_to_labor_table[df::job_type::LoadWeaponTrap] = jlf_const(df::unit_labor::MECHANIC) ;