summaryrefslogtreecommitdiff
path: root/plugins/autolabor.cpp
diff options
context:
space:
mode:
authorKelly Martin2012-05-14 21:54:11 -0500
committerKelly Martin2012-05-14 21:54:11 -0500
commit27cc2dc92cc7c2c5221a3e3234e8aadca343555e (patch)
tree6e776fc4747aa5c4e93853ac283a72ada62bbb82 /plugins/autolabor.cpp
parentd4f98065683dfc9521ac0d86c27b8491027a980e (diff)
downloaddfhack-27cc2dc92cc7c2c5221a3e3234e8aadca343555e.tar.gz
dfhack-27cc2dc92cc7c2c5221a3e3234e8aadca343555e.tar.bz2
dfhack-27cc2dc92cc7c2c5221a3e3234e8aadca343555e.tar.xz
Add dwarf state table entries for the new jobs from .34.7 and .34.8. Also add a warning message for a dwarf who is doing an unknown job (instead of just reading random nonsense from off the end of the dwarf_states array).
This code is backward-compatible (the extra job entries will simply be unused in pre-.8).
Diffstat (limited to 'plugins/autolabor.cpp')
-rw-r--r--plugins/autolabor.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/plugins/autolabor.cpp b/plugins/autolabor.cpp
index cd3232e6..5a588cdd 100644
--- a/plugins/autolabor.cpp
+++ b/plugins/autolabor.cpp
@@ -348,7 +348,12 @@ static const dwarf_state dwarf_states[] = {
OTHER /* CauseTrouble */,
OTHER /* DrinkBlood */,
OTHER /* ReportCrime */,
- OTHER /* ExecuteCriminal */
+ OTHER /* ExecuteCriminal */,
+ BUSY /* TrainAnimal */,
+ BUSY /* CarveTrack */,
+ BUSY /* PushTrackVehicle */,
+ BUSY /* PlaceTrackVehicle */,
+ BUSY /* StoreItemInVehicle */
};
struct labor_info
@@ -886,8 +891,13 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
assert(job >= 0);
assert(job < ARRAY_COUNT(dwarf_states));
*/
-
- dwarf_info[dwarf].state = dwarf_states[job];
+ if (job >= 0 && job < ARRAY_COUNT(dwarf_states))
+ dwarf_info[dwarf].state = dwarf_states[job];
+ else
+ {
+ out.print("Dwarf %i \"%s\" has unknown job %i\n", dwarf, dwarfs[dwarf]->name.first_name.c_str(), job);
+ dwarf_info[dwarf].state = OTHER;
+ }
}
state_count[dwarf_info[dwarf].state]++;