Weight CUTWOOD jobs by KILL_PLANT ethic; fix #1115

develop
Kelly Kinkade 2017-07-29 18:46:45 -05:00
parent c5c80d5dc0
commit d98fd02048
1 changed files with 14 additions and 0 deletions

@ -67,6 +67,8 @@
#include <df/ui.h> #include <df/ui.h>
#include <df/training_assignment.h> #include <df/training_assignment.h>
#include <df/general_ref_contains_itemst.h> #include <df/general_ref_contains_itemst.h>
#include <df/cultural_identity.h>
#include <df/ethic_type.h>
#include "labormanager.h" #include "labormanager.h"
#include "joblabormapper.h" #include "joblabormapper.h"
@ -1465,6 +1467,7 @@ private:
for (int ma = 0; ma < 13; ma++) for (int ma = 0; ma < 13; ma++)
attr_weight += (skill_attr_weights[skill].mental_attr_weights[ma]) * (d->dwarf->status.current_soul->mental_attrs[ma].value - 1000); attr_weight += (skill_attr_weights[skill].mental_attr_weights[ma]) * (d->dwarf->status.current_soul->mental_attrs[ma].value - 1000);
} }
} }
int score = skill_level * 1000 - (d->high_skill - skill_level) * 2000 + (xp / (skill_level + 5) * 10) + attr_weight; int score = skill_level * 1000 - (d->high_skill - skill_level) * 2000 + (xp / (skill_level + 5) * 10) + attr_weight;
@ -1485,6 +1488,17 @@ private:
score += 5000; score += 5000;
} }
// This should reweight assigning CUTWOOD jobs based on a citizen's ethic toward killing plants
if (labor == df::unit_labor::CUTWOOD)
{
auto c_id = d->dwarf->cultural_identity;
auto culture = world->cultural_identities.all[c_id];
auto ethics = culture->ethic[df::ethic_type::KILL_PLANT];
if (ethics != df::ethic_response::NOT_APPLICABLE && ethics != df::ethic_response::REQUIRED)
score += 10000 * (df::ethic_response::ACCEPTABLE - ethics);
}
score -= Units::computeMovementSpeed(d->dwarf); score -= Units::computeMovementSpeed(d->dwarf);
return score; return score;