Follow the change in the base-type of job_skill.

develop
Alexander Gavrilov 2012-10-26 20:29:21 +04:00
parent e23052a570
commit b976e01b8c
4 changed files with 8 additions and 9 deletions

@ -889,8 +889,7 @@ int Units::getNominalSkill(df::unit *unit, df::job_skill skill_id, bool use_rust
// Retrieve skill from unit soul: // Retrieve skill from unit soul:
df::enum_field<df::job_skill,int16_t> key(skill_id); auto skill = binsearch_in_vector(unit->status.current_soul->skills, &df::unit_skill::id, skill_id);
auto skill = binsearch_in_vector(unit->status.current_soul->skills, &df::unit_skill::id, key);
if (skill) if (skill)
{ {

@ -1 +1 @@
Subproject commit b9b2e8c6d2141f13966ed965b3f3ffe924e527db Subproject commit ee38c5446e527edcdc9d8c3e23a4ae138d213546

@ -246,7 +246,7 @@ struct product_hook : improvement_product {
(df::unit *unit, std::vector<df::item*> *out_items, (df::unit *unit, std::vector<df::item*> *out_items,
std::vector<df::reaction_reagent*> *in_reag, std::vector<df::reaction_reagent*> *in_reag,
std::vector<df::item*> *in_items, std::vector<df::item*> *in_items,
int32_t quantity, int16_t skill, int32_t quantity, df::job_skill skill,
df::historical_entity *entity, df::world_site *site) df::historical_entity *entity, df::world_site *site)
) { ) {
if (auto product = products[this]) if (auto product = products[this])
@ -279,7 +279,7 @@ struct product_hook : improvement_product {
break; break;
} }
int rating = unit ? Units::getEffectiveSkill(unit, df::job_skill(skill)) : 0; int rating = unit ? Units::getEffectiveSkill(unit, skill) : 0;
int size = int(probability*(1.0f + 0.06f*rating)); // +90% at legendary int size = int(probability*(1.0f + 0.06f*rating)); // +90% at legendary
object->addContaminant( object->addContaminant(

@ -298,8 +298,8 @@ bool sortBySkill (const UnitInfo *d1, const UnitInfo *d2)
{ {
if (sort_skill != job_skill::NONE) if (sort_skill != job_skill::NONE)
{ {
df::unit_skill *s1 = binsearch_in_vector<df::unit_skill,df::enum_field<df::job_skill,int16_t>>(d1->unit->status.current_soul->skills, &df::unit_skill::id, sort_skill); df::unit_skill *s1 = binsearch_in_vector<df::unit_skill,df::job_skill>(d1->unit->status.current_soul->skills, &df::unit_skill::id, sort_skill);
df::unit_skill *s2 = binsearch_in_vector<df::unit_skill,df::enum_field<df::job_skill,int16_t>>(d2->unit->status.current_soul->skills, &df::unit_skill::id, sort_skill); df::unit_skill *s2 = binsearch_in_vector<df::unit_skill,df::job_skill>(d2->unit->status.current_soul->skills, &df::unit_skill::id, sort_skill);
int l1 = s1 ? s1->rating : 0; int l1 = s1 ? s1->rating : 0;
int l2 = s2 ? s2->rating : 0; int l2 = s2 ? s2->rating : 0;
int e1 = s1 ? s1->experience : 0; int e1 = s1 ? s1->experience : 0;
@ -1030,7 +1030,7 @@ void viewscreen_unitlaborsst::render()
fg = 9; fg = 9;
if (columns[col_offset].skill != job_skill::NONE) if (columns[col_offset].skill != job_skill::NONE)
{ {
df::unit_skill *skill = binsearch_in_vector<df::unit_skill,df::enum_field<df::job_skill,int16_t>>(unit->status.current_soul->skills, &df::unit_skill::id, columns[col_offset].skill); df::unit_skill *skill = binsearch_in_vector<df::unit_skill,df::job_skill>(unit->status.current_soul->skills, &df::unit_skill::id, columns[col_offset].skill);
if ((skill != NULL) && (skill->rating || skill->experience)) if ((skill != NULL) && (skill->rating || skill->experience))
{ {
int level = skill->rating; int level = skill->rating;
@ -1086,7 +1086,7 @@ void viewscreen_unitlaborsst::render()
} }
else else
{ {
df::unit_skill *skill = binsearch_in_vector<df::unit_skill,df::enum_field<df::job_skill,int16_t>>(unit->status.current_soul->skills, &df::unit_skill::id, columns[sel_column].skill); df::unit_skill *skill = binsearch_in_vector<df::unit_skill,df::job_skill>(unit->status.current_soul->skills, &df::unit_skill::id, columns[sel_column].skill);
if (skill) if (skill)
{ {
int level = skill->rating; int level = skill->rating;