Remove and replace checks for OnBreak

develop
lethosor 2018-11-24 14:52:26 -05:00
parent 34b8a41ad9
commit 368f8d0504
8 changed files with 14 additions and 26 deletions

@ -1 +1 @@
Subproject commit de83a453d7e55aa48ffc92c8f4c147b1a1acd525
Subproject commit c588b17edba27d4cada78bedf36ec45f427461a5

@ -879,11 +879,8 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
// Account for the military
else if (ENUM_ATTR(profession, military, dwarfs[dwarf]->profession))
dwarf_info[dwarf].state = MILITARY;
// Account for dwarves on break or migrants
// DF leaves the OnBreak trait type on some dwarves while they're not actually on break
// Since they have no current job, they will default to IDLE
// Account for incoming migrants
else if (is_migrant)
// Dwarf is unemployed with null job
{
dwarf_info[dwarf].state = OTHER;
}

@ -1202,14 +1202,6 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
for (int dwarf = 0; dwarf < n_dwarfs; dwarf++)
{
bool is_on_break = false;
for (auto p = dwarfs[dwarf]->status.misc_traits.begin(); p < dwarfs[dwarf]->status.misc_traits.end(); p++)
{
if ((*p)->id == misc_trait_type::Migrant || (*p)->id == misc_trait_type::OnBreak)
is_on_break = true;
}
if (Units::isBaby(dwarfs[dwarf]) ||
Units::isChild(dwarfs[dwarf]) ||
dwarfs[dwarf]->profession == profession::DRUNK)
@ -1220,7 +1212,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
dwarf_info[dwarf].state = MILITARY;
else if (dwarfs[dwarf]->job.current_job == NULL)
{
if (is_on_break)
if (Units::getMiscTrait(dwarfs[dwarf], misc_trait_type::Migrant))
dwarf_info[dwarf].state = OTHER;
else if (dwarfs[dwarf]->specific_refs.size() > 0)
dwarf_info[dwarf].state = OTHER;

@ -1742,11 +1742,11 @@ static void add_work_history(df::unit *unit, activity_type type)
static bool is_at_leisure(df::unit *unit)
{
for (auto p = unit->status.misc_traits.begin(); p < unit->status.misc_traits.end(); p++)
{
if ((*p)->id == misc_trait_type::Migrant || (*p)->id == misc_trait_type::OnBreak)
if (Units::getMiscTrait(unit, misc_trait_type::Migrant))
return true;
if (!unit->job.current_job && Units::getMainSocialActivity(unit))
return true;
}
return false;
}

@ -252,8 +252,8 @@ module DFHack
not u.specific_refs.find { |s| s.type == :ACTIVITY } and
# filter soldiers (TODO check schedule)
u.military.squad_id == -1 and
# filter 'on break'
not u.status.misc_traits.find { |t| t.id == :OnBreak }
# filter incoming migrants
not u.status.misc_traits.find { |t| t.id == :Migrant }
end
def unit_entitypositions(unit)

@ -1122,10 +1122,9 @@ private:
return "";
for (auto p = unit->status.misc_traits.begin(); p < unit->status.misc_traits.end(); p++)
{
if ((*p)->id == misc_trait_type::Migrant || (*p)->id == misc_trait_type::OnBreak)
if ((*p)->id == misc_trait_type::Migrant)
{
int i = (*p)->value;
return ".on break";
return ".new arrival.migrant";
}
}

@ -1492,7 +1492,7 @@ static void releaseTiredWorker(EngineInfo *engine, df::job *job, df::unit *worke
if (unit == worker ||
unit->job.current_job || !unit->status.labors[unit_labor::SIEGEOPERATE] ||
!Units::isCitizen(unit) || Units::getMiscTrait(unit, misc_trait_type::OnBreak) ||
!Units::isCitizen(unit) || Units::getMiscTrait(unit, misc_trait_type::Migrant) ||
isTired(unit) || !Maps::canWalkBetween(job->pos, unit->pos))
continue;

@ -1 +1 @@
Subproject commit 87cc0fcad57a3a8ff7b558be9f3523101ac2f69d
Subproject commit 7deb13c681b011d9a87782b9cdf9eec6e6acf7c1