|
|
@ -157,26 +157,30 @@ static const char *state_names[] = {
|
|
|
|
"BUSY",
|
|
|
|
"BUSY",
|
|
|
|
"MILITARY",
|
|
|
|
"MILITARY",
|
|
|
|
"CHILD",
|
|
|
|
"CHILD",
|
|
|
|
"OTHER",
|
|
|
|
"OTHER"
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// List of possible activites of a dwarf that will be further narrowed to states
|
|
|
|
// List of possible activites of a dwarf that will be further narrowed to states
|
|
|
|
|
|
|
|
// IDLE - Specifically waiting to be assigned a task (No Job)
|
|
|
|
|
|
|
|
// BUSY - Performing a toggleable labor, or a support action for that labor.
|
|
|
|
|
|
|
|
// OTHER - Doing something else
|
|
|
|
|
|
|
|
|
|
|
|
static const dwarf_state dwarf_states[] = {
|
|
|
|
static const dwarf_state dwarf_states[] = {
|
|
|
|
BUSY /* CarveFortification */,
|
|
|
|
BUSY /* CarveFortification */,
|
|
|
|
BUSY /* DetailWall */,
|
|
|
|
BUSY /* DetailWall */,
|
|
|
|
BUSY /* DetailFloor */,
|
|
|
|
BUSY /* DetailFloor */,
|
|
|
|
BUSY /* Dig */,
|
|
|
|
BUSY /* Dig */,
|
|
|
|
BUSY /* CarveUpwardStaircase */,
|
|
|
|
BUSY /* CarveUpwardStaircase */,
|
|
|
|
BUSY /* CarveDownwardStaircase */,
|
|
|
|
BUSY /* CarveDownwardStaircase */,
|
|
|
|
BUSY /* CarveUpDownStaircase */,
|
|
|
|
BUSY /* CarveUpDownStaircase */,
|
|
|
|
BUSY /* CarveRamp */,
|
|
|
|
BUSY /* CarveRamp */,
|
|
|
|
BUSY /* DigChannel */,
|
|
|
|
BUSY /* DigChannel */,
|
|
|
|
BUSY /* FellTree */,
|
|
|
|
BUSY /* FellTree */,
|
|
|
|
BUSY /* GatherPlants */,
|
|
|
|
BUSY /* GatherPlants */,
|
|
|
|
BUSY /* RemoveConstruction */,
|
|
|
|
BUSY /* RemoveConstruction */,
|
|
|
|
BUSY /* CollectWebs */,
|
|
|
|
BUSY /* CollectWebs */,
|
|
|
|
BUSY /* BringItemToDepot */,
|
|
|
|
BUSY /* BringItemToDepot */,
|
|
|
|
BUSY /* BringItemToShop */,
|
|
|
|
BUSY /* BringItemToShop */,
|
|
|
|
OTHER /* Eat */,
|
|
|
|
OTHER /* Eat */,
|
|
|
|
OTHER /* GetProvisions */,
|
|
|
|
OTHER /* GetProvisions */,
|
|
|
|
OTHER /* Drink */,
|
|
|
|
OTHER /* Drink */,
|
|
|
@ -184,39 +188,39 @@ static const dwarf_state dwarf_states[] = {
|
|
|
|
OTHER /* FillWaterskin */,
|
|
|
|
OTHER /* FillWaterskin */,
|
|
|
|
OTHER /* FillWaterskin2 */,
|
|
|
|
OTHER /* FillWaterskin2 */,
|
|
|
|
OTHER /* Sleep */,
|
|
|
|
OTHER /* Sleep */,
|
|
|
|
BUSY /* CollectSand */,
|
|
|
|
BUSY /* CollectSand */,
|
|
|
|
BUSY /* Fish */,
|
|
|
|
BUSY /* Fish */,
|
|
|
|
BUSY /* Hunt */,
|
|
|
|
BUSY /* Hunt */,
|
|
|
|
OTHER /* HuntVermin */,
|
|
|
|
BUSY /* HuntVermin */,
|
|
|
|
BUSY /* Kidnap */,
|
|
|
|
OTHER /* Kidnap */,
|
|
|
|
BUSY /* BeatCriminal */,
|
|
|
|
OTHER /* BeatCriminal */,
|
|
|
|
BUSY /* StartingFistFight */,
|
|
|
|
OTHER /* StartingFistFight */,
|
|
|
|
BUSY /* CollectTaxes */,
|
|
|
|
OTHER /* CollectTaxes */,
|
|
|
|
BUSY /* GuardTaxCollector */,
|
|
|
|
OTHER /* GuardTaxCollector */,
|
|
|
|
BUSY /* CatchLiveLandAnimal */,
|
|
|
|
BUSY /* CatchLiveLandAnimal */,
|
|
|
|
BUSY /* CatchLiveFish */,
|
|
|
|
BUSY /* CatchLiveFish */,
|
|
|
|
BUSY /* ReturnKill */,
|
|
|
|
OTHER /* ReturnKill */,
|
|
|
|
BUSY /* CheckChest */,
|
|
|
|
OTHER /* CheckChest */,
|
|
|
|
BUSY /* StoreOwnedItem */,
|
|
|
|
OTHER /* StoreOwnedItem */,
|
|
|
|
BUSY /* PlaceItemInTomb */,
|
|
|
|
BUSY /* PlaceItemInTomb */,
|
|
|
|
BUSY /* StoreItemInStockpile */,
|
|
|
|
BUSY /* StoreItemInStockpile */,
|
|
|
|
BUSY /* StoreItemInBag */,
|
|
|
|
BUSY /* StoreItemInBag */,
|
|
|
|
BUSY /* StoreItemInHospital */,
|
|
|
|
BUSY /* StoreItemInHospital */,
|
|
|
|
BUSY /* StoreItemInChest */,
|
|
|
|
BUSY /* StoreItemInChest */,
|
|
|
|
BUSY /* StoreItemInCabinet */,
|
|
|
|
BUSY /* StoreItemInCabinet */,
|
|
|
|
BUSY /* StoreWeapon */,
|
|
|
|
BUSY /* StoreWeapon */,
|
|
|
|
BUSY /* StoreArmor */,
|
|
|
|
BUSY /* StoreArmor */,
|
|
|
|
BUSY /* StoreItemInBarrel */,
|
|
|
|
BUSY /* StoreItemInBarrel */,
|
|
|
|
BUSY /* StoreItemInBin */,
|
|
|
|
BUSY /* StoreItemInBin */,
|
|
|
|
BUSY /* SeekArtifact */,
|
|
|
|
OTHER /* SeekArtifact */,
|
|
|
|
BUSY /* SeekInfant */,
|
|
|
|
OTHER /* SeekInfant */,
|
|
|
|
OTHER /* AttendParty */,
|
|
|
|
OTHER /* AttendParty */,
|
|
|
|
OTHER /* GoShopping */,
|
|
|
|
OTHER /* GoShopping */,
|
|
|
|
OTHER /* GoShopping2 */,
|
|
|
|
OTHER /* GoShopping2 */,
|
|
|
|
BUSY /* Clean */,
|
|
|
|
OTHER /* Clean */,
|
|
|
|
OTHER /* Rest */,
|
|
|
|
OTHER /* Rest */,
|
|
|
|
BUSY /* PickupEquipment */,
|
|
|
|
BUSY /* PickupEquipment */,
|
|
|
|
BUSY /* DumpItem */,
|
|
|
|
BUSY /* DumpItem */,
|
|
|
|
OTHER /* StrangeMoodCrafter */,
|
|
|
|
OTHER /* StrangeMoodCrafter */,
|
|
|
|
OTHER /* StrangeMoodJeweller */,
|
|
|
|
OTHER /* StrangeMoodJeweller */,
|
|
|
|
OTHER /* StrangeMoodForge */,
|
|
|
|
OTHER /* StrangeMoodForge */,
|
|
|
@ -230,170 +234,170 @@ static const dwarf_state dwarf_states[] = {
|
|
|
|
OTHER /* StrangeMoodWeaver */,
|
|
|
|
OTHER /* StrangeMoodWeaver */,
|
|
|
|
OTHER /* StrangeMoodGlassmaker */,
|
|
|
|
OTHER /* StrangeMoodGlassmaker */,
|
|
|
|
OTHER /* StrangeMoodMechanics */,
|
|
|
|
OTHER /* StrangeMoodMechanics */,
|
|
|
|
BUSY /* ConstructBuilding */,
|
|
|
|
BUSY /* ConstructBuilding */,
|
|
|
|
BUSY /* ConstructDoor */,
|
|
|
|
BUSY /* ConstructDoor */,
|
|
|
|
BUSY /* ConstructFloodgate */,
|
|
|
|
BUSY /* ConstructFloodgate */,
|
|
|
|
BUSY /* ConstructBed */,
|
|
|
|
BUSY /* ConstructBed */,
|
|
|
|
BUSY /* ConstructThrone */,
|
|
|
|
BUSY /* ConstructThrone */,
|
|
|
|
BUSY /* ConstructCoffin */,
|
|
|
|
BUSY /* ConstructCoffin */,
|
|
|
|
BUSY /* ConstructTable */,
|
|
|
|
BUSY /* ConstructTable */,
|
|
|
|
BUSY /* ConstructChest */,
|
|
|
|
BUSY /* ConstructChest */,
|
|
|
|
BUSY /* ConstructBin */,
|
|
|
|
BUSY /* ConstructBin */,
|
|
|
|
BUSY /* ConstructArmorStand */,
|
|
|
|
BUSY /* ConstructArmorStand */,
|
|
|
|
BUSY /* ConstructWeaponRack */,
|
|
|
|
BUSY /* ConstructWeaponRack */,
|
|
|
|
BUSY /* ConstructCabinet */,
|
|
|
|
BUSY /* ConstructCabinet */,
|
|
|
|
BUSY /* ConstructStatue */,
|
|
|
|
BUSY /* ConstructStatue */,
|
|
|
|
BUSY /* ConstructBlocks */,
|
|
|
|
BUSY /* ConstructBlocks */,
|
|
|
|
BUSY /* MakeRawGlass */,
|
|
|
|
BUSY /* MakeRawGlass */,
|
|
|
|
BUSY /* MakeCrafts */,
|
|
|
|
BUSY /* MakeCrafts */,
|
|
|
|
BUSY /* MintCoins */,
|
|
|
|
BUSY /* MintCoins */,
|
|
|
|
BUSY /* CutGems */,
|
|
|
|
BUSY /* CutGems */,
|
|
|
|
BUSY /* CutGlass */,
|
|
|
|
BUSY /* CutGlass */,
|
|
|
|
BUSY /* EncrustWithGems */,
|
|
|
|
BUSY /* EncrustWithGems */,
|
|
|
|
BUSY /* EncrustWithGlass */,
|
|
|
|
BUSY /* EncrustWithGlass */,
|
|
|
|
BUSY /* DestroyBuilding */,
|
|
|
|
BUSY /* DestroyBuilding */,
|
|
|
|
BUSY /* SmeltOre */,
|
|
|
|
BUSY /* SmeltOre */,
|
|
|
|
BUSY /* MeltMetalObject */,
|
|
|
|
BUSY /* MeltMetalObject */,
|
|
|
|
BUSY /* ExtractMetalStrands */,
|
|
|
|
BUSY /* ExtractMetalStrands */,
|
|
|
|
BUSY /* PlantSeeds */,
|
|
|
|
BUSY /* PlantSeeds */,
|
|
|
|
BUSY /* HarvestPlants */,
|
|
|
|
BUSY /* HarvestPlants */,
|
|
|
|
BUSY /* TrainHuntingAnimal */,
|
|
|
|
BUSY /* TrainHuntingAnimal */,
|
|
|
|
BUSY /* TrainWarAnimal */,
|
|
|
|
BUSY /* TrainWarAnimal */,
|
|
|
|
BUSY /* MakeWeapon */,
|
|
|
|
BUSY /* MakeWeapon */,
|
|
|
|
BUSY /* ForgeAnvil */,
|
|
|
|
BUSY /* ForgeAnvil */,
|
|
|
|
BUSY /* ConstructCatapultParts */,
|
|
|
|
BUSY /* ConstructCatapultParts */,
|
|
|
|
BUSY /* ConstructBallistaParts */,
|
|
|
|
BUSY /* ConstructBallistaParts */,
|
|
|
|
BUSY /* MakeArmor */,
|
|
|
|
BUSY /* MakeArmor */,
|
|
|
|
BUSY /* MakeHelm */,
|
|
|
|
BUSY /* MakeHelm */,
|
|
|
|
BUSY /* MakePants */,
|
|
|
|
BUSY /* MakePants */,
|
|
|
|
BUSY /* StudWith */,
|
|
|
|
BUSY /* StudWith */,
|
|
|
|
BUSY /* ButcherAnimal */,
|
|
|
|
BUSY /* ButcherAnimal */,
|
|
|
|
BUSY /* PrepareRawFish */,
|
|
|
|
BUSY /* PrepareRawFish */,
|
|
|
|
BUSY /* MillPlants */,
|
|
|
|
BUSY /* MillPlants */,
|
|
|
|
BUSY /* BaitTrap */,
|
|
|
|
BUSY /* BaitTrap */,
|
|
|
|
BUSY /* MilkCreature */,
|
|
|
|
BUSY /* MilkCreature */,
|
|
|
|
BUSY /* MakeCheese */,
|
|
|
|
BUSY /* MakeCheese */,
|
|
|
|
BUSY /* ProcessPlants */,
|
|
|
|
BUSY /* ProcessPlants */,
|
|
|
|
BUSY /* ProcessPlantsBag */,
|
|
|
|
BUSY /* ProcessPlantsBag */,
|
|
|
|
BUSY /* ProcessPlantsVial */,
|
|
|
|
BUSY /* ProcessPlantsVial */,
|
|
|
|
BUSY /* ProcessPlantsBarrel */,
|
|
|
|
BUSY /* ProcessPlantsBarrel */,
|
|
|
|
BUSY /* PrepareMeal */,
|
|
|
|
BUSY /* PrepareMeal */,
|
|
|
|
BUSY /* WeaveCloth */,
|
|
|
|
BUSY /* WeaveCloth */,
|
|
|
|
BUSY /* MakeGloves */,
|
|
|
|
BUSY /* MakeGloves */,
|
|
|
|
BUSY /* MakeShoes */,
|
|
|
|
BUSY /* MakeShoes */,
|
|
|
|
BUSY /* MakeShield */,
|
|
|
|
BUSY /* MakeShield */,
|
|
|
|
BUSY /* MakeCage */,
|
|
|
|
BUSY /* MakeCage */,
|
|
|
|
BUSY /* MakeChain */,
|
|
|
|
BUSY /* MakeChain */,
|
|
|
|
BUSY /* MakeFlask */,
|
|
|
|
BUSY /* MakeFlask */,
|
|
|
|
BUSY /* MakeGoblet */,
|
|
|
|
BUSY /* MakeGoblet */,
|
|
|
|
BUSY /* MakeInstrument */,
|
|
|
|
BUSY /* MakeInstrument */,
|
|
|
|
BUSY /* MakeToy */,
|
|
|
|
BUSY /* MakeToy */,
|
|
|
|
BUSY /* MakeAnimalTrap */,
|
|
|
|
BUSY /* MakeAnimalTrap */,
|
|
|
|
BUSY /* MakeBarrel */,
|
|
|
|
BUSY /* MakeBarrel */,
|
|
|
|
BUSY /* MakeBucket */,
|
|
|
|
BUSY /* MakeBucket */,
|
|
|
|
BUSY /* MakeWindow */,
|
|
|
|
BUSY /* MakeWindow */,
|
|
|
|
BUSY /* MakeTotem */,
|
|
|
|
BUSY /* MakeTotem */,
|
|
|
|
BUSY /* MakeAmmo */,
|
|
|
|
BUSY /* MakeAmmo */,
|
|
|
|
BUSY /* DecorateWith */,
|
|
|
|
BUSY /* DecorateWith */,
|
|
|
|
BUSY /* MakeBackpack */,
|
|
|
|
BUSY /* MakeBackpack */,
|
|
|
|
BUSY /* MakeQuiver */,
|
|
|
|
BUSY /* MakeQuiver */,
|
|
|
|
BUSY /* MakeBallistaArrowHead */,
|
|
|
|
BUSY /* MakeBallistaArrowHead */,
|
|
|
|
BUSY /* AssembleSiegeAmmo */,
|
|
|
|
BUSY /* AssembleSiegeAmmo */,
|
|
|
|
BUSY /* LoadCatapult */,
|
|
|
|
BUSY /* LoadCatapult */,
|
|
|
|
BUSY /* LoadBallista */,
|
|
|
|
BUSY /* LoadBallista */,
|
|
|
|
BUSY /* FireCatapult */,
|
|
|
|
BUSY /* FireCatapult */,
|
|
|
|
BUSY /* FireBallista */,
|
|
|
|
BUSY /* FireBallista */,
|
|
|
|
BUSY /* ConstructMechanisms */,
|
|
|
|
BUSY /* ConstructMechanisms */,
|
|
|
|
BUSY /* MakeTrapComponent */,
|
|
|
|
BUSY /* MakeTrapComponent */,
|
|
|
|
BUSY /* LoadCageTrap */,
|
|
|
|
BUSY /* LoadCageTrap */,
|
|
|
|
BUSY /* LoadStoneTrap */,
|
|
|
|
BUSY /* LoadStoneTrap */,
|
|
|
|
BUSY /* LoadWeaponTrap */,
|
|
|
|
BUSY /* LoadWeaponTrap */,
|
|
|
|
BUSY /* CleanTrap */,
|
|
|
|
BUSY /* CleanTrap */,
|
|
|
|
BUSY /* CastSpell */,
|
|
|
|
OTHER /* CastSpell */,
|
|
|
|
BUSY /* LinkBuildingToTrigger */,
|
|
|
|
BUSY /* LinkBuildingToTrigger */,
|
|
|
|
BUSY /* PullLever */,
|
|
|
|
BUSY /* PullLever */,
|
|
|
|
BUSY /* BrewDrink */,
|
|
|
|
BUSY /* BrewDrink */,
|
|
|
|
BUSY /* ExtractFromPlants */,
|
|
|
|
BUSY /* ExtractFromPlants */,
|
|
|
|
BUSY /* ExtractFromRawFish */,
|
|
|
|
BUSY /* ExtractFromRawFish */,
|
|
|
|
BUSY /* ExtractFromLandAnimal */,
|
|
|
|
BUSY /* ExtractFromLandAnimal */,
|
|
|
|
BUSY /* TameVermin */,
|
|
|
|
BUSY /* TameVermin */,
|
|
|
|
BUSY /* TameAnimal */,
|
|
|
|
BUSY /* TameAnimal */,
|
|
|
|
BUSY /* ChainAnimal */,
|
|
|
|
BUSY /* ChainAnimal */,
|
|
|
|
BUSY /* UnchainAnimal */,
|
|
|
|
BUSY /* UnchainAnimal */,
|
|
|
|
BUSY /* UnchainPet */,
|
|
|
|
BUSY /* UnchainPet */,
|
|
|
|
BUSY /* ReleaseLargeCreature */,
|
|
|
|
BUSY /* ReleaseLargeCreature */,
|
|
|
|
BUSY /* ReleasePet */,
|
|
|
|
BUSY /* ReleasePet */,
|
|
|
|
BUSY /* ReleaseSmallCreature */,
|
|
|
|
BUSY /* ReleaseSmallCreature */,
|
|
|
|
BUSY /* HandleSmallCreature */,
|
|
|
|
BUSY /* HandleSmallCreature */,
|
|
|
|
BUSY /* HandleLargeCreature */,
|
|
|
|
BUSY /* HandleLargeCreature */,
|
|
|
|
BUSY /* CageLargeCreature */,
|
|
|
|
BUSY /* CageLargeCreature */,
|
|
|
|
BUSY /* CageSmallCreature */,
|
|
|
|
BUSY /* CageSmallCreature */,
|
|
|
|
BUSY /* RecoverWounded */,
|
|
|
|
BUSY /* RecoverWounded */,
|
|
|
|
BUSY /* DiagnosePatient */,
|
|
|
|
BUSY /* DiagnosePatient */,
|
|
|
|
BUSY /* ImmobilizeBreak */,
|
|
|
|
BUSY /* ImmobilizeBreak */,
|
|
|
|
BUSY /* DressWound */,
|
|
|
|
BUSY /* DressWound */,
|
|
|
|
BUSY /* CleanPatient */,
|
|
|
|
BUSY /* CleanPatient */,
|
|
|
|
BUSY /* Surgery */,
|
|
|
|
BUSY /* Surgery */,
|
|
|
|
BUSY /* Suture */,
|
|
|
|
BUSY /* Suture */,
|
|
|
|
BUSY /* SetBone */,
|
|
|
|
BUSY /* SetBone */,
|
|
|
|
BUSY /* PlaceInTraction */,
|
|
|
|
BUSY /* PlaceInTraction */,
|
|
|
|
BUSY /* DrainAquarium */,
|
|
|
|
BUSY /* DrainAquarium */,
|
|
|
|
BUSY /* FillAquarium */,
|
|
|
|
BUSY /* FillAquarium */,
|
|
|
|
BUSY /* FillPond */,
|
|
|
|
BUSY /* FillPond */,
|
|
|
|
BUSY /* GiveWater */,
|
|
|
|
BUSY /* GiveWater */,
|
|
|
|
BUSY /* GiveFood */,
|
|
|
|
BUSY /* GiveFood */,
|
|
|
|
BUSY /* GiveWater2 */,
|
|
|
|
BUSY /* GiveWater2 */,
|
|
|
|
BUSY /* GiveFood2 */,
|
|
|
|
BUSY /* GiveFood2 */,
|
|
|
|
BUSY /* RecoverPet */,
|
|
|
|
BUSY /* RecoverPet */,
|
|
|
|
BUSY /* PitLargeAnimal */,
|
|
|
|
BUSY /* PitLargeAnimal */,
|
|
|
|
BUSY /* PitSmallAnimal */,
|
|
|
|
BUSY /* PitSmallAnimal */,
|
|
|
|
BUSY /* SlaughterAnimal */,
|
|
|
|
BUSY /* SlaughterAnimal */,
|
|
|
|
BUSY /* MakeCharcoal */,
|
|
|
|
BUSY /* MakeCharcoal */,
|
|
|
|
BUSY /* MakeAsh */,
|
|
|
|
BUSY /* MakeAsh */,
|
|
|
|
BUSY /* MakeLye */,
|
|
|
|
BUSY /* MakeLye */,
|
|
|
|
BUSY /* MakePotashFromLye */,
|
|
|
|
BUSY /* MakePotashFromLye */,
|
|
|
|
BUSY /* FertilizeField */,
|
|
|
|
BUSY /* FertilizeField */,
|
|
|
|
BUSY /* MakePotashFromAsh */,
|
|
|
|
BUSY /* MakePotashFromAsh */,
|
|
|
|
BUSY /* DyeThread */,
|
|
|
|
BUSY /* DyeThread */,
|
|
|
|
BUSY /* DyeCloth */,
|
|
|
|
BUSY /* DyeCloth */,
|
|
|
|
BUSY /* SewImage */,
|
|
|
|
BUSY /* SewImage */,
|
|
|
|
BUSY /* MakePipeSection */,
|
|
|
|
BUSY /* MakePipeSection */,
|
|
|
|
BUSY /* OperatePump */,
|
|
|
|
BUSY /* OperatePump */,
|
|
|
|
OTHER /* ManageWorkOrders */,
|
|
|
|
OTHER /* ManageWorkOrders */,
|
|
|
|
OTHER /* UpdateStockpileRecords */,
|
|
|
|
OTHER /* UpdateStockpileRecords */,
|
|
|
|
OTHER /* TradeAtDepot */,
|
|
|
|
OTHER /* TradeAtDepot */,
|
|
|
|
BUSY /* ConstructHatchCover */,
|
|
|
|
BUSY /* ConstructHatchCover */,
|
|
|
|
BUSY /* ConstructGrate */,
|
|
|
|
BUSY /* ConstructGrate */,
|
|
|
|
BUSY /* RemoveStairs */,
|
|
|
|
BUSY /* RemoveStairs */,
|
|
|
|
BUSY /* ConstructQuern */,
|
|
|
|
BUSY /* ConstructQuern */,
|
|
|
|
BUSY /* ConstructMillstone */,
|
|
|
|
BUSY /* ConstructMillstone */,
|
|
|
|
BUSY /* ConstructSplint */,
|
|
|
|
BUSY /* ConstructSplint */,
|
|
|
|
BUSY /* ConstructCrutch */,
|
|
|
|
BUSY /* ConstructCrutch */,
|
|
|
|
BUSY /* ConstructTractionBench */,
|
|
|
|
BUSY /* ConstructTractionBench */,
|
|
|
|
BUSY /* CleanSelf */,
|
|
|
|
OTHER /* CleanSelf */,
|
|
|
|
BUSY /* BringCrutch */,
|
|
|
|
BUSY /* BringCrutch */,
|
|
|
|
BUSY /* ApplyCast */,
|
|
|
|
BUSY /* ApplyCast */,
|
|
|
|
BUSY /* CustomReaction */,
|
|
|
|
BUSY /* CustomReaction */,
|
|
|
|
BUSY /* ConstructSlab */,
|
|
|
|
BUSY /* ConstructSlab */,
|
|
|
|
BUSY /* EngraveSlab */,
|
|
|
|
BUSY /* EngraveSlab */,
|
|
|
|
BUSY /* ShearCreature */,
|
|
|
|
BUSY /* ShearCreature */,
|
|
|
|
BUSY /* SpinThread */,
|
|
|
|
BUSY /* SpinThread */,
|
|
|
|
BUSY /* PenLargeAnimal */,
|
|
|
|
BUSY /* PenLargeAnimal */,
|
|
|
|
BUSY /* PenSmallAnimal */,
|
|
|
|
BUSY /* PenSmallAnimal */,
|
|
|
|
BUSY /* MakeTool */,
|
|
|
|
BUSY /* MakeTool */,
|
|
|
|
BUSY /* CollectClay */,
|
|
|
|
BUSY /* CollectClay */,
|
|
|
|
BUSY /* InstallColonyInHive */,
|
|
|
|
BUSY /* InstallColonyInHive */,
|
|
|
|
BUSY /* CollectHiveProducts */,
|
|
|
|
BUSY /* CollectHiveProducts */,
|
|
|
|
OTHER /* CauseTrouble */,
|
|
|
|
OTHER /* CauseTrouble */,
|
|
|
|
OTHER /* DrinkBlood */,
|
|
|
|
OTHER /* DrinkBlood */,
|
|
|
|
OTHER /* ReportCrime */,
|
|
|
|
OTHER /* ReportCrime */,
|
|
|
|
OTHER /* ExecuteCriminal */,
|
|
|
|
OTHER /* ExecuteCriminal */,
|
|
|
|
BUSY /* TrainAnimal */,
|
|
|
|
BUSY /* TrainAnimal */,
|
|
|
|
BUSY /* CarveTrack */,
|
|
|
|
BUSY /* CarveTrack */,
|
|
|
|
BUSY /* PushTrackVehicle */,
|
|
|
|
BUSY /* PushTrackVehicle */,
|
|
|
|
BUSY /* PlaceTrackVehicle */,
|
|
|
|
BUSY /* PlaceTrackVehicle */,
|
|
|
|
BUSY /* StoreItemInVehicle */,
|
|
|
|
BUSY /* StoreItemInVehicle */,
|
|
|
|
BUSY /* GeldAnimal */
|
|
|
|
BUSY /* GeldAnimal */
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Mode assigned to labors. Either it's a hauling job, or it's not.
|
|
|
|
// Mode assigned to labors. Either it's a hauling job, or it's not.
|
|
|
@ -426,6 +430,7 @@ struct labor_info
|
|
|
|
|
|
|
|
|
|
|
|
// Return the labor_mode associated with this labor
|
|
|
|
// Return the labor_mode associated with this labor
|
|
|
|
labor_mode mode() { return (labor_mode) config.ival(0); }
|
|
|
|
labor_mode mode() { return (labor_mode) config.ival(0); }
|
|
|
|
|
|
|
|
|
|
|
|
// Set the labor_mode associated with this labor
|
|
|
|
// Set the labor_mode associated with this labor
|
|
|
|
void set_mode(labor_mode mode) { config.ival(0) = mode; }
|
|
|
|
void set_mode(labor_mode mode) { config.ival(0) = mode; }
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -458,7 +463,7 @@ static const struct labor_default default_labor_infos[] = {
|
|
|
|
/* BONE_SETTING */ {ALLOW, 0},
|
|
|
|
/* BONE_SETTING */ {ALLOW, 0},
|
|
|
|
/* SUTURING */ {ALLOW, 0},
|
|
|
|
/* SUTURING */ {ALLOW, 0},
|
|
|
|
/* DRESSING_WOUNDS */ {ALLOW, 0},
|
|
|
|
/* DRESSING_WOUNDS */ {ALLOW, 0},
|
|
|
|
/* FEED_WATER_CIVILIANS */ {ALLOW, 0},
|
|
|
|
/* FEED_WATER_CIVILIANS */ {HAULERS, 0}, // This could also be ALLOW
|
|
|
|
/* RECOVER_WOUNDED */ {HAULERS, 0},
|
|
|
|
/* RECOVER_WOUNDED */ {HAULERS, 0},
|
|
|
|
/* BUTCHER */ {ALLOW, 0},
|
|
|
|
/* BUTCHER */ {ALLOW, 0},
|
|
|
|
/* TRAPPER */ {ALLOW, 0},
|
|
|
|
/* TRAPPER */ {ALLOW, 0},
|
|
|
@ -534,6 +539,7 @@ struct dwarf_info_t
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Current simplified employment status of dwarf
|
|
|
|
// Current simplified employment status of dwarf
|
|
|
|
dwarf_state state;
|
|
|
|
dwarf_state state;
|
|
|
|
|
|
|
|
|
|
|
|
// Set to true if for whatever reason we are exempting this dwarf
|
|
|
|
// Set to true if for whatever reason we are exempting this dwarf
|
|
|
|
// from hauling
|
|
|
|
// from hauling
|
|
|
|
bool haul_exempt;
|
|
|
|
bool haul_exempt;
|
|
|
@ -704,6 +710,8 @@ DFhackCExport command_result plugin_init ( color_ostream &out, std::vector <Plug
|
|
|
|
" List current status of all labors.\n"
|
|
|
|
" List current status of all labors.\n"
|
|
|
|
" autohauler status\n"
|
|
|
|
" autohauler status\n"
|
|
|
|
" Show basic status information.\n"
|
|
|
|
" Show basic status information.\n"
|
|
|
|
|
|
|
|
" autohauler debug\n"
|
|
|
|
|
|
|
|
" In the next cycle, will output the state of every dwarf.\n"
|
|
|
|
"Function:\n"
|
|
|
|
"Function:\n"
|
|
|
|
" When enabled, autohauler periodically checks your dwarves and assigns\n"
|
|
|
|
" When enabled, autohauler periodically checks your dwarves and assigns\n"
|
|
|
|
" hauling jobs to idle dwarves while removing them from busy dwarves.\n"
|
|
|
|
" hauling jobs to idle dwarves while removing them from busy dwarves.\n"
|
|
|
@ -818,6 +826,9 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
|
|
|
|
/* Before determining how to handle employment status, handle
|
|
|
|
/* Before determining how to handle employment status, handle
|
|
|
|
* hauling exemptions first */
|
|
|
|
* hauling exemptions first */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Default deny condition of on break for later else-if series
|
|
|
|
|
|
|
|
bool is_migrant = false;
|
|
|
|
|
|
|
|
|
|
|
|
// Scan every labor. If a labor that disallows hauling is present
|
|
|
|
// Scan every labor. If a labor that disallows hauling is present
|
|
|
|
// for the dwarf, the dwarf is hauling exempt
|
|
|
|
// for the dwarf, the dwarf is hauling exempt
|
|
|
|
FOR_ENUM_ITEMS(unit_labor, labor)
|
|
|
|
FOR_ENUM_ITEMS(unit_labor, labor)
|
|
|
@ -836,8 +847,8 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
|
|
|
|
// to try to find real jobs first
|
|
|
|
// to try to find real jobs first
|
|
|
|
for (auto p = dwarfs[dwarf]->status.misc_traits.begin(); p < dwarfs[dwarf]->status.misc_traits.end(); p++)
|
|
|
|
for (auto p = dwarfs[dwarf]->status.misc_traits.begin(); p < dwarfs[dwarf]->status.misc_traits.end(); p++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ((*p)->id == misc_trait_type::Migrant || (*p)->id == misc_trait_type::OnBreak)
|
|
|
|
if ((*p)->id == misc_trait_type::Migrant)
|
|
|
|
dwarf_info[dwarf].haul_exempt = true;
|
|
|
|
is_migrant = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Now determine a dwarf's employment status and decide whether
|
|
|
|
/* Now determine a dwarf's employment status and decide whether
|
|
|
@ -852,17 +863,24 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
|
|
|
|
// Account for any hauling exemptions here
|
|
|
|
// Account for any hauling exemptions here
|
|
|
|
else if (dwarf_info[dwarf].haul_exempt)
|
|
|
|
else if (dwarf_info[dwarf].haul_exempt)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
dwarf_info[dwarf].state = OTHER;
|
|
|
|
dwarf_info[dwarf].state = BUSY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Don't give hauling jobs to the military either
|
|
|
|
// Account for the military
|
|
|
|
else if (ENUM_ATTR(profession, military, dwarfs[dwarf]->profession))
|
|
|
|
else if (ENUM_ATTR(profession, military, dwarfs[dwarf]->profession))
|
|
|
|
dwarf_info[dwarf].state = MILITARY;
|
|
|
|
dwarf_info[dwarf].state = MILITARY;
|
|
|
|
|
|
|
|
// Account for dwarves on break or migrants
|
|
|
|
|
|
|
|
// DF leaves the OnBreak trait type on some dwarves while they're not actually on break
|
|
|
|
|
|
|
|
// Since they have no current job, they will default to IDLE
|
|
|
|
|
|
|
|
else if (is_migrant)
|
|
|
|
// Dwarf is unemployed with null job
|
|
|
|
// Dwarf is unemployed with null job
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
dwarf_info[dwarf].state = OTHER;
|
|
|
|
|
|
|
|
}
|
|
|
|
else if (dwarfs[dwarf]->job.current_job == NULL)
|
|
|
|
else if (dwarfs[dwarf]->job.current_job == NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
dwarf_info[dwarf].state = IDLE;
|
|
|
|
dwarf_info[dwarf].state = IDLE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// If it gets to this point the dwarf is employed
|
|
|
|
// If it gets to this point we look at the task and assign either BUSY or OTHER
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int job = dwarfs[dwarf]->job.current_job->job_type;
|
|
|
|
int job = dwarfs[dwarf]->job.current_job->job_type;
|
|
|
@ -870,17 +888,25 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
|
|
|
|
dwarf_info[dwarf].state = dwarf_states[job];
|
|
|
|
dwarf_info[dwarf].state = dwarf_states[job];
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Warn the console that the dwarf has an unregistered labor, default to OTHER
|
|
|
|
// Warn the console that the dwarf has an unregistered labor, default to BUSY
|
|
|
|
out.print("Dwarf %i \"%s\" has unknown job %i\n", dwarf, dwarfs[dwarf]->name.first_name.c_str(), job);
|
|
|
|
out.print("Dwarf %i \"%s\" has unknown job %i\n", dwarf, dwarfs[dwarf]->name.first_name.c_str(), job);
|
|
|
|
dwarf_info[dwarf].state = OTHER;
|
|
|
|
dwarf_info[dwarf].state = BUSY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Debug: Output dwarf job and state data
|
|
|
|
|
|
|
|
if(print_debug)
|
|
|
|
|
|
|
|
out.print("Dwarf %i %s State: %i\n", dwarf, dwarfs[dwarf]->name.first_name.c_str(),
|
|
|
|
|
|
|
|
dwarf_info[dwarf].state);
|
|
|
|
|
|
|
|
|
|
|
|
// Increment corresponding labor in default_labor_infos struct
|
|
|
|
// Increment corresponding labor in default_labor_infos struct
|
|
|
|
state_count[dwarf_info[dwarf].state]++;
|
|
|
|
state_count[dwarf_info[dwarf].state]++;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// At this point the debug if present has been completed
|
|
|
|
|
|
|
|
print_debug = false;
|
|
|
|
|
|
|
|
|
|
|
|
// This is a vector of all the labors
|
|
|
|
// This is a vector of all the labors
|
|
|
|
std::vector<df::unit_labor> labors;
|
|
|
|
std::vector<df::unit_labor> labors;
|
|
|
|
|
|
|
|
|
|
|
@ -902,33 +928,23 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
|
|
|
|
// have "real" jobs filled first, then if nothing is available the dwarf
|
|
|
|
// have "real" jobs filled first, then if nothing is available the dwarf
|
|
|
|
// instead resorts to hauling.
|
|
|
|
// instead resorts to hauling.
|
|
|
|
|
|
|
|
|
|
|
|
// IDLE - Enable hauling
|
|
|
|
// IDLE - Enable hauling
|
|
|
|
// BUSY - Disable hauling
|
|
|
|
// BUSY - Disable hauling
|
|
|
|
// OTHER - Disable hauling
|
|
|
|
// OTHER - Enable hauling
|
|
|
|
|
|
|
|
// MILITARY - Enable hauling
|
|
|
|
// This is a vector of potential hauler IDs
|
|
|
|
|
|
|
|
std::vector<int> hauler_ids;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Pretty much we are only considering non-military, non-child dwarves
|
|
|
|
// There was no reason to put potential haulers in an array. All of them are
|
|
|
|
for (int dwarf = 0; dwarf < n_dwarfs; dwarf++)
|
|
|
|
// covered in the following for loop.
|
|
|
|
{
|
|
|
|
|
|
|
|
if (dwarf_info[dwarf].state == IDLE ||
|
|
|
|
|
|
|
|
dwarf_info[dwarf].state == BUSY ||
|
|
|
|
|
|
|
|
dwarf_info[dwarf].state == OTHER)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
hauler_ids.push_back(dwarf);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Equivalent of Java for(unit_labor : labor)
|
|
|
|
// Equivalent of Java for(unit_labor : labor)
|
|
|
|
// For every labor...
|
|
|
|
// For every labor...
|
|
|
|
FOR_ENUM_ITEMS(unit_labor, labor)
|
|
|
|
FOR_ENUM_ITEMS(unit_labor, labor)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// If this is a non-labor skip this for loop
|
|
|
|
// If this is a non-labor continue to next item
|
|
|
|
if (labor == unit_labor::NONE)
|
|
|
|
if (labor == unit_labor::NONE)
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
// If this is not a hauling labor then skip this for loop
|
|
|
|
// If this is not a hauling labor continue to next item
|
|
|
|
if (labor_infos[labor].mode() != HAULERS)
|
|
|
|
if (labor_infos[labor].mode() != HAULERS)
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
@ -936,15 +952,17 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
|
|
|
|
for(int dwarf = 0; dwarf < dwarfs.size(); dwarf++)
|
|
|
|
for(int dwarf = 0; dwarf < dwarfs.size(); dwarf++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
// If the dwarf is idle, enable the hauling labor
|
|
|
|
// Set hauling labors based on employment states
|
|
|
|
if(dwarf_info[dwarf].state == IDLE)
|
|
|
|
if(dwarf_info[dwarf].state == IDLE) {
|
|
|
|
{
|
|
|
|
|
|
|
|
// And enable the job for the dwarf
|
|
|
|
|
|
|
|
dwarfs[dwarf]->status.labors[labor] = true;
|
|
|
|
dwarfs[dwarf]->status.labors[labor] = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// If the dwarf is busy, disable the hauling labor
|
|
|
|
else if(dwarf_info[dwarf].state == MILITARY) {
|
|
|
|
if(dwarf_info[dwarf].state == BUSY || dwarf_info[dwarf].state == OTHER)
|
|
|
|
dwarfs[dwarf]->status.labors[labor] = true;
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(dwarf_info[dwarf].state == OTHER) {
|
|
|
|
|
|
|
|
dwarfs[dwarf]->status.labors[labor] = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(dwarf_info[dwarf].state == BUSY) {
|
|
|
|
dwarfs[dwarf]->status.labors[labor] = false;
|
|
|
|
dwarfs[dwarf]->status.labors[labor] = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// If at the end of this the dwarf has the hauling labor, increment the
|
|
|
|
// If at the end of this the dwarf has the hauling labor, increment the
|
|
|
@ -954,6 +972,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
|
|
|
|
labor_infos[labor].active_dwarfs++;
|
|
|
|
labor_infos[labor].active_dwarfs++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// CHILD ignored
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Let's play a game of "find the missing bracket!" I hope this is correct.
|
|
|
|
// Let's play a game of "find the missing bracket!" I hope this is correct.
|
|
|
|