From d626990ac850936ffaec2bee36ae13a7b8fd4059 Mon Sep 17 00:00:00 2001 From: nocico Date: Tue, 29 Nov 2016 01:12:40 +0200 Subject: [PATCH 1/3] labormanager: trap components --- plugins/labormanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/labormanager.cpp b/plugins/labormanager.cpp index ce8e18a6d..cf84faf8b 100644 --- a/plugins/labormanager.cpp +++ b/plugins/labormanager.cpp @@ -1272,7 +1272,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) ; From 5c16b5a2b730959a44f6f712c98ef5e40ee6c133 Mon Sep 17 00:00:00 2001 From: nocico Date: Tue, 29 Nov 2016 04:24:25 +0200 Subject: [PATCH 2/3] labormanager: multimaterial constructions --- plugins/labormanager.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/plugins/labormanager.cpp b/plugins/labormanager.cpp index cf84faf8b..d263c1c66 100644 --- a/plugins/labormanager.cpp +++ b/plugins/labormanager.cpp @@ -672,8 +672,15 @@ 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; + auto a = (df::building_actual *) b; + // 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 = a->contained_items.back()->item; MaterialInfo matinfo; if (i && matinfo.decode(i)) { @@ -812,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: @@ -910,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: From d5d0775f1ad3888ea671df1f9f2de80324996672 Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Tue, 29 Nov 2016 00:22:34 -0600 Subject: [PATCH 3/3] Remove redundant cast --- plugins/labormanager.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/labormanager.cpp b/plugins/labormanager.cpp index d263c1c66..53fce05ea 100644 --- a/plugins/labormanager.cpp +++ b/plugins/labormanager.cpp @@ -676,11 +676,10 @@ static df::unit_labor construction_build_labor (df::building_actual* b) { if (b->getType() == df::building_type::RoadPaved) return df::unit_labor::BUILD_ROAD; - auto a = (df::building_actual *) b; // 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 = a->contained_items.back()->item; + df::item* i = b->contained_items.back()->item; MaterialInfo matinfo; if (i && matinfo.decode(i)) {