Merge remote-tracking branch 'PatrikLundell/dead_plugins' into develop

develop
lethosor 2018-06-20 16:18:07 -04:00
commit b2fd0b062b
9 changed files with 15 additions and 14 deletions

@ -482,9 +482,9 @@ static void printCompanionHeader(color_ostream &out, size_t i, df::unit *unit)
out << i;
out << ": " << getUnitNameProfession(unit);
if (unit->flags1.bits.dead)
if (Units::isDead(unit))
out << " (DEAD)";
if (unit->flags3.bits.ghostly)
if (Units::isGhost(unit))
out << " (GHOST)";
out << endl;

@ -160,8 +160,9 @@ command_result cursecheck (color_ostream &out, vector <string> & parameters)
{
df::unit * unit = world->units.all[i];
// filter out all "living" units that are currently removed from play
// don't spam all completely dead creatures if not explicitly wanted
if(unit->flags1.bits.dead && ignoreDead)
if((!Units::isActive(unit) && !Units::isKilled(unit)) || (Units::isKilled(unit) && ignoreDead))
{
continue;
}
@ -217,7 +218,7 @@ command_result cursecheck (color_ostream &out, vector <string> & parameters)
cursetype.c_str(),
// technically most cursed creatures are undead,
// therefore output 'active' if they are not completely dead
unit->flags1.bits.dead ? "deceased" : "active",
unit->flags2.bits.killed ? "deceased" : "active",
unit->flags3.bits.ghostly ? "-ghostly" : "",
missing ? "-missing" : ""
);

@ -390,7 +390,7 @@ void findAndAssignInvasionJob(color_ostream& out, void* tickTime) {
//find all locals and invaders
for ( size_t a = 0; a < world->units.all.size(); a++ ) {
df::unit* unit = world->units.all[a];
if ( unit->flags1.bits.dead )
if ( !Units::isActive(unit) )
continue;
if ( Units::isCitizen(unit) ) {
if ( localPts.find(unit->pos) != localPts.end() )

@ -383,7 +383,7 @@ void AnimalHospital::processPatients(color_ostream &out) {
}
// Check to make sure the unit hasn't expired before assigning a job, or if they've been healed
if (!real_unit || real_unit->flags1.bits.dead || !real_unit->health->flags.bits.needs_healthcare) {
if (!real_unit || !Units::isActive(real_unit) || !real_unit->health->flags.bits.needs_healthcare) {
// discharge the patient from the hospital
this->dischargePatient(*patient, out);
return;
@ -624,7 +624,7 @@ processUnits:
df::unit* unit = units[a];
/* As hilarious as it would be, lets not treat FB :) */
if ( unit->flags1.bits.dead || unit->flags1.bits.active_invader || unit->flags2.bits.underworld || unit->flags2.bits.visitor_uninvited || unit->flags2.bits.visitor ) {
if ( !Units::isActive(unit) || unit->flags1.bits.active_invader || unit->flags2.bits.underworld || unit->flags2.bits.visitor_uninvited || unit->flags2.bits.visitor ) {
continue;
}

@ -1224,7 +1224,7 @@ private:
if (p1 || p2)
{
df::unit* other = p1 ? act->unit_noble : act->unit_actor;
if (other && !(other->flags1.bits.dead ||
if (other && !(!Units::isActive(other) ||
(other->job.current_job &&
(other->job.current_job->job_type == df::job_type::Sleep ||
other->job.current_job->job_type == df::job_type::Rest)) ||
@ -1247,7 +1247,7 @@ private:
for (auto u2 = world->units.active.begin(); u2 != world->units.active.end(); ++u2)
{
if ((*u2)->relationship_ids[df::unit_relationship_type::Mother] == dwarf->dwarf->id &&
!(*u2)->flags1.bits.dead &&
Units::isActive(*u2) &&
((*u2)->profession == df::profession::CHILD || (*u2)->profession == df::profession::BABY))
{
dwarf->has_children = true;

@ -1157,7 +1157,7 @@ viewscreen_unitlaborsst::viewscreen_unitlaborsst(vector<df::unit*> &src, int cur
if (!Units::isOwnGroup(unit))
cur->allowEdit = false;
if (unit->flags1.bits.dead)
if (!Units::isActive(unit))
cur->allowEdit = false;
if (unit->flags2.bits.visitor)

@ -64,7 +64,7 @@ void impregnateMany() {
auto units = world->units.all;
for ( size_t a = 0; a < units.size(); a++ ) {
df::unit* unit = units[a];
if ( unit->flags1.bits.dead || unit->flags1.bits.active_invader || unit->flags2.bits.underworld || unit->flags2.bits.visitor_uninvited || unit->flags2.bits.visitor )
if ( !Units::isActive(unit) || unit->flags1.bits.active_invader || unit->flags2.bits.underworld || unit->flags2.bits.visitor_uninvited || unit->flags2.bits.visitor )
continue;
popcount[unit->race]++;
if ( unit->pregnancy_genes ) {

@ -798,7 +798,7 @@ void lightingEngineViewscreen::doOcupancyAndLights()
if (DFHack::Units::isCitizen(u) && !u->counters.unconscious)
addLight(getIndex(pos.x,pos.y),matCitizen.makeSource());
creatureLightDef *def=getCreatureDef(u);
if(def && !u->flags1.bits.dead)
if(def && Units::isActive(u))
{
addLight(getIndex(pos.x,pos.y),def->light.makeSource());
}

@ -1343,12 +1343,12 @@ static bool canTargetUnit(df::unit *unit)
{
CHECK_NULL_POINTER(unit);
if (unit->flags1.bits.dead ||
if (!Units::isActive(unit) ||
unit->flags1.bits.caged ||
unit->flags1.bits.left ||
unit->flags1.bits.incoming ||
unit->flags1.bits.hidden_in_ambush ||
unit->flags3.bits.ghostly)
Units::isGhost(unit))
return false;
return true;