From 4c7c38df93a6600517157be50f1c964d4ba8805f Mon Sep 17 00:00:00 2001 From: Kelly Martin Date: Wed, 11 Jul 2012 14:30:47 -0500 Subject: [PATCH] * Autolabor: really exclude the broker from all labors when trader requested * Autolabor: add 'haulpct' config option to control percentage of non-idle dwarfs assigned to hauling labors (default is 33) * Zones: allow nontamed birds to be nestboxes. warning: does not check for 'hostile to civilization' birds, so if you try to tame a hostile elk bird, !!fun!! will happen * Stripcaged: changed default behavior to keep armor, reduced noisiness --- plugins/autolabor.cpp | 22 ++++++++++++++++++++-- plugins/devel/stripcaged.cpp | 16 +++++++--------- plugins/zone.cpp | 4 ++-- 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/plugins/autolabor.cpp b/plugins/autolabor.cpp index cf460e1cc..2dffaafe2 100644 --- a/plugins/autolabor.cpp +++ b/plugins/autolabor.cpp @@ -754,7 +754,12 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out ) df::building_tradedepotst* depot = (df::building_tradedepotst*) build; trader_requested = depot->trade_flags.bits.trader_requested; if (print_debug) - out.print("Trade depot found and trader requested, trader will be excluded from all labors.\n"); + { + if (trader_requested) + out.print("Trade depot found and trader requested, trader will be excluded from all labors.\n"); + else + out.print("Trade depot found but trader is not requested.\n"); + } } } @@ -1016,6 +1021,8 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out ) continue; if (dwarf_info[dwarf].state == MILITARY) continue; + if (dwarf_info[dwarf].trader && trader_requested) + continue; if (labor_infos[labor].is_exclusive && dwarf_info[dwarf].has_exclusive_labor) continue; @@ -1142,7 +1149,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out ) } if (print_debug) - out.print("Dwarf %i \"%s\" assigned %s: value %i\n %s", dwarf, dwarfs[dwarf]->name.first_name.c_str(), ENUM_KEY_STR(unit_labor, labor).c_str(), values[dwarf], dwarf_info[dwarf].trader ? "(trader)" : ""); + out.print("Dwarf %i \"%s\" assigned %s: value %i %s\n", dwarf, dwarfs[dwarf]->name.first_name.c_str(), ENUM_KEY_STR(unit_labor, labor).c_str(), values[dwarf], dwarf_info[dwarf].trader ? "(trader)" : ""); if (dwarf_info[dwarf].state == IDLE || dwarf_info[dwarf].state == BUSY) labor_infos[labor].active_dwarfs++; @@ -1164,7 +1171,18 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out ) for (int dwarf = 0; dwarf < n_dwarfs; dwarf++) { if (dwarf_info[dwarf].trader && trader_requested) + { + FOR_ENUM_ITEMS(unit_labor, labor) + { + if (labor == df::enums::unit_labor::NONE) + continue; + if (labor_infos[labor].mode() != HAULERS) + continue; + dwarfs[dwarf]->status.labors[labor] = false; + } continue; + } + if (dwarf_info[dwarf].state == IDLE || dwarf_info[dwarf].state == BUSY) hauler_ids.push_back(dwarf); } diff --git a/plugins/devel/stripcaged.cpp b/plugins/devel/stripcaged.cpp index 922f220b9..e3d2a82fc 100644 --- a/plugins/devel/stripcaged.cpp +++ b/plugins/devel/stripcaged.cpp @@ -77,12 +77,12 @@ DFhackCExport command_result plugin_shutdown ( color_ostream &out ) command_result df_stripcaged(color_ostream &out, vector & parameters) { CoreSuspender suspend; - bool keeparmor = false; + bool keeparmor = true; - if (parameters.size() == 1 && parameters[0] == "keeparmor") + if (parameters.size() == 1 && parameters[0] == "dumparmor") { - out << "Not dumping armor" << endl; - keeparmor = true; + out << "Dumping armor too" << endl; + keeparmor = false; } size_t count = 0; @@ -97,12 +97,10 @@ command_result df_stripcaged(color_ostream &out, vector & parameters) if (uii->item) { if (keeparmor && (uii->item->isArmorNotClothing() || uii->item->isClothing())) - { - std::string desc; - uii->item->getItemDescription(&desc,0); - out << "Armor item " << desc << " not dumped" << endl; continue; - } + std::string desc; + uii->item->getItemDescription(&desc,0); + out << "Item " << desc << " dumped." << endl; uii->item->flags.bits.forbid = 0; uii->item->flags.bits.dump = 1; count++; diff --git a/plugins/zone.cpp b/plugins/zone.cpp index ce610128b..52ea5c07b 100644 --- a/plugins/zone.cpp +++ b/plugins/zone.cpp @@ -420,6 +420,7 @@ bool isTame(df::unit* creature) { switch (creature->training_level) { + case df::animal_training_level::SemiWild: //?? case df::animal_training_level::Trained: case df::animal_training_level::WellTrained: case df::animal_training_level::SkilfullyTrained: @@ -429,7 +430,6 @@ bool isTame(df::unit* creature) case df::animal_training_level::Domesticated: tame=true; break; - case df::animal_training_level::SemiWild: //?? case df::animal_training_level::Unk8: //?? case df::animal_training_level::WildUntamed: default: @@ -1232,7 +1232,7 @@ bool isFreeEgglayer(df::unit * unit) { if( !isDead(unit) && !isUndead(unit) && isFemale(unit) - && isDomesticated(unit) // better strict than sorry (medium trained wild animals can revert into wild state) + && isTame(unit) && isOwnCiv(unit) && isEggLayer(unit) && !isAssigned(unit)