diff options
| author | Kelly Martin | 2012-03-28 23:22:28 -0500 |
|---|---|---|
| committer | Kelly Martin | 2012-03-28 23:22:28 -0500 |
| commit | 453141920fa112b5f412e2f3ef93553d56368976 (patch) | |
| tree | 6aca53ecb3e81d84bc530abaa27427dcbb70a70c /plugins/autolabor.cpp | |
| parent | fea34bfdde2d5f5ab6e829e8f1706159fd9be02c (diff) | |
| parent | d82120a3db65e82cb54b558fa3da6e28dbe767f2 (diff) | |
| download | dfhack-453141920fa112b5f412e2f3ef93553d56368976.tar.gz dfhack-453141920fa112b5f412e2f3ef93553d56368976.tar.bz2 dfhack-453141920fa112b5f412e2f3ef93553d56368976.tar.xz | |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'plugins/autolabor.cpp')
| -rw-r--r-- | plugins/autolabor.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/plugins/autolabor.cpp b/plugins/autolabor.cpp index b453da0c..26c4cb8b 100644 --- a/plugins/autolabor.cpp +++ b/plugins/autolabor.cpp @@ -397,17 +397,14 @@ struct dwarf_info DFhackCExport command_result plugin_init ( color_ostream &out, std::vector <PluginCommand> &commands) { - // initialize labor infos table from default table - - labor_infos = new struct labor_info[ARRAY_COUNT(default_labor_infos)]; - for (int i = 0; i < ARRAY_COUNT(default_labor_infos); i++) { - labor_infos[i] = default_labor_infos[i]; - } - - assert(ARRAY_COUNT(labor_infos) > ENUM_LAST_ITEM(unit_labor)); - - // Fill the command list with your commands. - commands.clear(); + // initialize labor infos table from default table + if(ARRAY_COUNT(default_labor_infos) != ENUM_LAST_ITEM(unit_labor) + 1) + return CR_FAILURE; + labor_infos = new struct labor_info[ARRAY_COUNT(default_labor_infos)]; + for (int i = 0; i < ARRAY_COUNT(default_labor_infos); i++) { + labor_infos[i] = default_labor_infos[i]; + } + // Fill the command list with your commands. commands.push_back(PluginCommand( "autolabor", "Automatically manage dwarf labors.", autolabor, false, /* true means that the command can't be used from non-interactive user interface */ |
