adapted to updated structures, remote Using units for age

develop
PatrikLundell 2020-04-08 08:45:40 +02:00
parent 5ce84a76f9
commit 55988e3fc4
2 changed files with 2 additions and 15 deletions

@ -210,7 +210,7 @@ void Units::setNickname(df::unit *unit, std::string nick)
break; // We want the nickname to end up in the identity break; // We want the nickname to end up in the identity
case df::identity_type::Unk_1: // Guess, but that's how it worked in the past case df::identity_type::Unk_1: // Guess, but that's how it worked in the past
case df::identity_type::Demon_Alias: case df::identity_type::True_Name:
case df::identity_type::Unk_4: // Pure guess, as this is a new case, still unseen case df::identity_type::Unk_4: // Pure guess, as this is a new case, still unseen
id_hfig = df::historical_figure::find(identity->histfig_nemesis_id); id_hfig = df::historical_figure::find(identity->histfig_nemesis_id);
break; break;

@ -1693,20 +1693,7 @@ static command_result GetUnitListInside(color_ostream &stream, const BlockReques
using df::global::cur_year; using df::global::cur_year;
using df::global::cur_year_tick; using df::global::cur_year_tick;
int year_ticks = 403200; send_unit->set_age(Units::getAge(unit, false));
int birth_time = unit->birth_year * year_ticks + unit->birth_time;
int cur_time = *cur_year * year_ticks + *cur_year_tick;
if (unit->curse_year >= 0)
{
if (auto identity = Units::getIdentity(unit))
{
if (identity->histfig_nemesis_id < 0)
birth_time = identity->birth_year * year_ticks + identity->birth_second;
}
}
send_unit->set_age(cur_time - birth_time);
ConvertDfColor(Units::getProfessionColor(unit), send_unit->mutable_profession_color()); ConvertDfColor(Units::getProfessionColor(unit), send_unit->mutable_profession_color());
send_unit->set_flags1(unit->flags1.whole); send_unit->set_flags1(unit->flags1.whole);