summaryrefslogtreecommitdiff
path: root/plugins/autolabor.cpp
diff options
context:
space:
mode:
authorPetr Mrázek2012-03-24 01:33:29 +0100
committerPetr Mrázek2012-03-24 01:33:29 +0100
commit7fe5fc9a906710bc603bf93b3e282872990a3361 (patch)
tree8bc7724414f9fd2135ddbb983435cc7426ea049a /plugins/autolabor.cpp
parente90da2bff1e8e93864557388e44e45729e464a43 (diff)
downloaddfhack-7fe5fc9a906710bc603bf93b3e282872990a3361.tar.gz
dfhack-7fe5fc9a906710bc603bf93b3e282872990a3361.tar.bz2
dfhack-7fe5fc9a906710bc603bf93b3e282872990a3361.tar.xz
autolabor fixage
Diffstat (limited to 'plugins/autolabor.cpp')
-rw-r--r--plugins/autolabor.cpp27
1 files changed, 12 insertions, 15 deletions
diff --git a/plugins/autolabor.cpp b/plugins/autolabor.cpp
index 262e5961..3ef0f9e5 100644
--- a/plugins/autolabor.cpp
+++ b/plugins/autolabor.cpp
@@ -27,9 +27,6 @@ using namespace df::enums;
using df::global::ui;
using df::global::world;
-// our own, empty header.
-#include "autolabor.h"
-
#define ARRAY_COUNT(array) (sizeof(array)/sizeof((array)[0]))
static int enable_autolabor;
@@ -472,9 +469,9 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
std::vector<dwarf_info> dwarf_info(n_dwarfs);
- std::vector<int> best_noble(_countof(noble_skills));
- std::vector<int> highest_noble_skill(_countof(noble_skills));
- std::vector<int> highest_noble_experience(_countof(noble_skills));
+ std::vector<int> best_noble(ARRAY_COUNT(noble_skills));
+ std::vector<int> highest_noble_skill(ARRAY_COUNT(noble_skills));
+ std::vector<int> highest_noble_experience(ARRAY_COUNT(noble_skills));
// Find total skill and highest skill for each dwarf. More skilled dwarves shouldn't be used for minor tasks.
@@ -495,7 +492,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
// They are likely to have appointed noble positions, so should be kept free where possible.
int noble_skill_id = -1;
- for (int i = 0; i < _countof(noble_skills); i++)
+ for (int i = 0; i < ARRAY_COUNT(noble_skills); i++)
{
if (skill == noble_skills[i])
noble_skill_id = i;
@@ -503,7 +500,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
if (noble_skill_id >= 0)
{
- assert(noble_skill_id < _countof(noble_skills));
+ assert(noble_skill_id < ARRAY_COUNT(noble_skills));
if (highest_noble_skill[noble_skill_id] < skill_level ||
(highest_noble_skill[noble_skill_id] == skill_level &&
@@ -528,7 +525,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
// Mark the best nobles, so we try to keep them non-busy. (It would be better to find the actual assigned nobles.)
- for (int i = 0; i < _countof(noble_skills); i++)
+ for (int i = 0; i < ARRAY_COUNT(noble_skills); i++)
{
assert(best_noble[i] >= 0);
assert(best_noble[i] < n_dwarfs);
@@ -551,7 +548,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
continue;
assert(labor >= 0);
- assert(labor < _countof(labor_infos));
+ assert(labor < ARRAY_COUNT(labor_infos));
if (labor_infos[labor].is_exclusive && dwarfs[dwarf]->status.labors[labor])
dwarf_info[dwarf].mastery_penalty -= 100;
@@ -597,7 +594,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
int job = dwarfs[dwarf]->job.current_job->job_type;
assert(job >= 0);
- assert(job < _countof(dwarf_states));
+ assert(job < ARRAY_COUNT(dwarf_states));
dwarf_info[dwarf].state = dwarf_states[job];
}
@@ -617,7 +614,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
if (labor != df::enums::unit_labor::NONE)
{
assert(labor >= 0);
- assert(labor < _countof(labor_to_skill));
+ assert(labor < ARRAY_COUNT(labor_to_skill));
labor_to_skill[labor] = skill;
}
@@ -631,7 +628,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
continue;
assert(labor >= 0);
- assert(labor < _countof(labor_infos));
+ assert(labor < ARRAY_COUNT(labor_infos));
labors.push_back(labor);
}
@@ -645,7 +642,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
auto labor = *lp;
assert(labor >= 0);
- assert(labor < _countof(labor_infos));
+ assert(labor < ARRAY_COUNT(labor_infos));
df::job_skill skill = labor_to_skill[labor];
@@ -821,7 +818,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
continue;
assert(labor >= 0);
- assert(labor < _countof(labor_infos));
+ assert(labor < ARRAY_COUNT(labor_infos));
if (labor_infos[labor].mode != HAULERS)
continue;