Skip to content

Commit

Permalink
Autolabor: add in the rest of the building construct and deconstruct …
Browse files Browse the repository at this point in the history
…labors. Also handle wood crafts at the craftdwarf's shop.
  • Loading branch information
ab9rf committed Feb 13, 2013
1 parent 675e92f commit 27f5dc7
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions plugins/autolabor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,8 @@ class JobLaborMapper {
df::building* bld = get_building_from_job (j);
switch (bld->getType())
{
case df::building_type::Hive:
return df::unit_labor::BEEKEEPING;
case df::building_type::Workshop:
{
df::building_workshopst* ws = (df::building_workshopst*) bld;
Expand All @@ -783,6 +785,10 @@ class JobLaborMapper {
case df::building_type::RoadPaved:
case df::building_type::Well:
case df::building_type::ScrewPump:
case df::building_type::Wagon:
case df::building_type::Shop:
case df::building_type::Support:
case df::building_type::Windmill:
{
df::building_actual* b = (df::building_actual*) bld;
if (b->design && !b->design->flags.bits.designed)
Expand Down Expand Up @@ -811,12 +817,27 @@ class JobLaborMapper {
case df::building_type::Slab:
case df::building_type::Chain:
case df::building_type::GrateFloor:
case df::building_type::Hatch:
case df::building_type::BarsFloor:
case df::building_type::BarsVertical:
case df::building_type::GrateWall:
return df::unit_labor::HAUL_FURNITURE;
case df::building_type::Trap:
case df::building_type::GearAssembly:
case df::building_type::AxleHorizontal:
case df::building_type::AxleVertical:
case df::building_type::Rollers:
return df::unit_labor::MECHANIC;
case df::building_type::AnimalTrap:
return df::unit_labor::TRAPPER;
case df::building_type::Civzone:
case df::building_type::Nest:
case df::building_type::RoadDirt:
case df::building_type::Stockpile:
case df::building_type::Weapon:
return df::unit_labor::NONE;
case df::building_type::SiegeEngine:
return df::unit_labor::SIEGECRAFT;
}

debug ("AUTOLABOR: Cannot deduce labor for construct building job of type %s\n",
Expand All @@ -837,6 +858,8 @@ class JobLaborMapper {

switch (bld->getType())
{
case df::building_type::Hive:
return df::unit_labor::BEEKEEPING;
case df::building_type::Workshop:
{
df::building_workshopst* ws = (df::building_workshopst*) bld;
Expand All @@ -855,6 +878,13 @@ class JobLaborMapper {
case df::building_type::Wagon:
case df::building_type::Bridge:
case df::building_type::ScrewPump:
case df::building_type::ArcheryTarget:
case df::building_type::RoadPaved:
case df::building_type::Shop:
case df::building_type::Support:
case df::building_type::WaterWheel:
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);
Expand All @@ -863,6 +893,10 @@ class JobLaborMapper {
case df::building_type::FarmPlot:
return df::unit_labor::PLANT;
case df::building_type::Trap:
case df::building_type::AxleHorizontal:
case df::building_type::AxleVertical:
case df::building_type::GearAssembly:
case df::building_type::Rollers:
return df::unit_labor::MECHANIC;
case df::building_type::Chair:
case df::building_type::Bed:
Expand All @@ -883,7 +917,21 @@ class JobLaborMapper {
case df::building_type::Slab:
case df::building_type::Chain:
case df::building_type::Hatch:
case df::building_type::BarsFloor:
case df::building_type::BarsVertical:
case df::building_type::GrateFloor:
case df::building_type::GrateWall:
return df::unit_labor::HAUL_FURNITURE;
case df::building_type::AnimalTrap:
return df::unit_labor::TRAPPER;
case df::building_type::Civzone:
case df::building_type::Nest:
case df::building_type::RoadDirt:
case df::building_type::Stockpile:
case df::building_type::Weapon:
return df::unit_labor::NONE;
case df::building_type::SiegeEngine:
return df::unit_labor::SIEGECRAFT;
}

debug ("AUTOLABOR: Cannot deduce labor for destroy building job of type %s\n",
Expand Down Expand Up @@ -924,6 +972,8 @@ class JobLaborMapper {
debug ("AUTOLABOR: Cannot deduce labor for make crafts job (not bone)\n");
return df::unit_labor::NONE;
}
case df::item_type::WOOD:
return df::unit_labor::WOOD_CRAFT;
default:
debug ("AUTOLABOR: Cannot deduce labor for make crafts job, item type %s\n",
ENUM_KEY_STR(item_type, jobitem).c_str());
Expand Down

0 comments on commit 27f5dc7

Please sign in to comment.