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).
develop
Kelly Martin 2012-05-14 21:54:11 -05:00
parent d4f9806568
commit 27cc2dc92c
1 changed files with 13 additions and 3 deletions

@ -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]++;