summaryrefslogtreecommitdiff
path: root/plugins/autolabor.cpp
diff options
context:
space:
mode:
authorKelly Martin2012-07-11 14:30:47 -0500
committerKelly Martin2012-07-11 14:30:47 -0500
commit4c7c38df93a6600517157be50f1c964d4ba8805f (patch)
treea995a9319c5eb46d9aa7845cd06ed3e0cf0a434c /plugins/autolabor.cpp
parent6f4f3039e1bf0ac52be4da2b5c214eaf76f49ace (diff)
downloaddfhack-4c7c38df93a6600517157be50f1c964d4ba8805f.tar.gz
dfhack-4c7c38df93a6600517157be50f1c964d4ba8805f.tar.bz2
dfhack-4c7c38df93a6600517157be50f1c964d4ba8805f.tar.xz
* 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
Diffstat (limited to 'plugins/autolabor.cpp')
-rw-r--r--plugins/autolabor.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/plugins/autolabor.cpp b/plugins/autolabor.cpp
index cf460e1c..2dffaafe 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);
}