From 9563dae5d738950b4201b87194b7860ff2b8ceb6 Mon Sep 17 00:00:00 2001 From: Kelly Martin Date: Mon, 3 Dec 2012 01:41:02 -0600 Subject: [PATCH] Autolabor: add labors for construct bridge, construct nestbox, construct trap, deconstruct wagon; fix error in labor for deconstruct furnace/tradedepot/construction; actually update the "active dwarf" numbers displayed in "autolabor list"; increase assignment penalty for dwarfs using skills lower than their best skill; increase assignment bonus for continuing in the same labor and for having the right tool for the job. --- plugins/autolabor.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/plugins/autolabor.cpp b/plugins/autolabor.cpp index 711701f78..d880d3fcc 100644 --- a/plugins/autolabor.cpp +++ b/plugins/autolabor.cpp @@ -726,6 +726,7 @@ private: case df::building_type::Furnace: case df::building_type::TradeDepot: case df::building_type::Construction: + case df::building_type::Bridge: { df::building_actual* b = (df::building_actual*) bld; if (b->design && !b->design->flags.bits.designed) @@ -749,7 +750,10 @@ private: case df::building_type::WindowGlass: case df::building_type::WindowGem: case df::building_type::Cage: + case df::building_type::NestBox: return df::unit_labor::HAUL_FURNITURE; + case df::building_type::Trap: + return df::unit_labor::MECHANIC; } debug ("AUTOLABOR: Cannot deduce labor for construct building job of type %s\n", @@ -785,9 +789,10 @@ private: case df::building_type::Furnace: case df::building_type::TradeDepot: case df::building_type::Construction: + case df::building_type::Wagon: { df::building_actual* b = (df::building_actual*) bld; - return construction_build_labor(j->items[0]->item); + return construction_build_labor(b->contained_items[0]->item); } break; case df::building_type::FarmPlot: @@ -1784,6 +1789,14 @@ public: cnt_recover_wounded = cnt_diagnosis = cnt_immobilize = cnt_dressing = cnt_cleaning = cnt_surgery = cnt_suture = cnt_setting = cnt_traction = cnt_crutch = 0; + FOR_ENUM_ITEMS(unit_labor, l) + { + if (l == df::unit_labor::NONE) + continue; + + labor_infos[l].active_dwarfs = 0; + } + // scan for specific buildings of interest scan_buildings(); @@ -1893,13 +1906,13 @@ public: int skill_level = Units::getEffectiveSkill(d->dwarf, skill); } - int score = skill_level * 100 - (d->high_skill - skill_level) * 100; + int score = skill_level * 100 - (d->high_skill - skill_level) * 200; if (d->dwarf->status.labors[labor]) - score += 300; + score += 500; if ((labor == df::unit_labor::MINE && d->has_pick) || (labor == df::unit_labor::CUTWOOD && d->has_axe) || (labor == df::unit_labor::HUNT && d->has_crossbow)) - score += 300; + score += 500; if (score > best_score) { bestdwarf = k; @@ -1919,6 +1932,7 @@ public: if (labor >= df::unit_labor::HAUL_STONE && labor <= df::unit_labor::HAUL_ANIMAL) canary &= ~(1 << labor); + labor_infos[labor].active_dwarfs++; available_dwarfs.erase(bestdwarf); pq.pop();