* 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
develop
Kelly Martin 2012-07-11 14:30:47 -05:00
parent 6f4f3039e1
commit 4c7c38df93
3 changed files with 29 additions and 13 deletions

@ -754,7 +754,12 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
df::building_tradedepotst* depot = (df::building_tradedepotst*) build; df::building_tradedepotst* depot = (df::building_tradedepotst*) build;
trader_requested = depot->trade_flags.bits.trader_requested; trader_requested = depot->trade_flags.bits.trader_requested;
if (print_debug) 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; continue;
if (dwarf_info[dwarf].state == MILITARY) if (dwarf_info[dwarf].state == MILITARY)
continue; continue;
if (dwarf_info[dwarf].trader && trader_requested)
continue;
if (labor_infos[labor].is_exclusive && dwarf_info[dwarf].has_exclusive_labor) if (labor_infos[labor].is_exclusive && dwarf_info[dwarf].has_exclusive_labor)
continue; continue;
@ -1142,7 +1149,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
} }
if (print_debug) 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) if (dwarf_info[dwarf].state == IDLE || dwarf_info[dwarf].state == BUSY)
labor_infos[labor].active_dwarfs++; 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++) for (int dwarf = 0; dwarf < n_dwarfs; dwarf++)
{ {
if (dwarf_info[dwarf].trader && trader_requested) 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; continue;
}
if (dwarf_info[dwarf].state == IDLE || dwarf_info[dwarf].state == BUSY) if (dwarf_info[dwarf].state == IDLE || dwarf_info[dwarf].state == BUSY)
hauler_ids.push_back(dwarf); hauler_ids.push_back(dwarf);
} }

@ -77,12 +77,12 @@ DFhackCExport command_result plugin_shutdown ( color_ostream &out )
command_result df_stripcaged(color_ostream &out, vector <string> & parameters) command_result df_stripcaged(color_ostream &out, vector <string> & parameters)
{ {
CoreSuspender suspend; 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; out << "Dumping armor too" << endl;
keeparmor = true; keeparmor = false;
} }
size_t count = 0; size_t count = 0;
@ -97,12 +97,10 @@ command_result df_stripcaged(color_ostream &out, vector <string> & parameters)
if (uii->item) if (uii->item)
{ {
if (keeparmor && (uii->item->isArmorNotClothing() || uii->item->isClothing())) if (keeparmor && (uii->item->isArmorNotClothing() || uii->item->isClothing()))
{
std::string desc;
uii->item->getItemDescription(&desc,0);
out << "Armor item " << desc << " not dumped" << endl;
continue; continue;
} std::string desc;
uii->item->getItemDescription(&desc,0);
out << "Item " << desc << " dumped." << endl;
uii->item->flags.bits.forbid = 0; uii->item->flags.bits.forbid = 0;
uii->item->flags.bits.dump = 1; uii->item->flags.bits.dump = 1;
count++; count++;

@ -420,6 +420,7 @@ bool isTame(df::unit* creature)
{ {
switch (creature->training_level) switch (creature->training_level)
{ {
case df::animal_training_level::SemiWild: //??
case df::animal_training_level::Trained: case df::animal_training_level::Trained:
case df::animal_training_level::WellTrained: case df::animal_training_level::WellTrained:
case df::animal_training_level::SkilfullyTrained: case df::animal_training_level::SkilfullyTrained:
@ -429,7 +430,6 @@ bool isTame(df::unit* creature)
case df::animal_training_level::Domesticated: case df::animal_training_level::Domesticated:
tame=true; tame=true;
break; break;
case df::animal_training_level::SemiWild: //??
case df::animal_training_level::Unk8: //?? case df::animal_training_level::Unk8: //??
case df::animal_training_level::WildUntamed: case df::animal_training_level::WildUntamed:
default: default:
@ -1232,7 +1232,7 @@ bool isFreeEgglayer(df::unit * unit)
{ {
if( !isDead(unit) && !isUndead(unit) if( !isDead(unit) && !isUndead(unit)
&& isFemale(unit) && isFemale(unit)
&& isDomesticated(unit) // better strict than sorry (medium trained wild animals can revert into wild state) && isTame(unit)
&& isOwnCiv(unit) && isOwnCiv(unit)
&& isEggLayer(unit) && isEggLayer(unit)
&& !isAssigned(unit) && !isAssigned(unit)