minor fix in zone tool: ignore dead units

develop
Robert Heinrich 2012-04-02 16:58:12 +02:00
parent 0f7e380e1b
commit 9cc2040a6b
1 changed files with 12 additions and 1 deletions

@ -111,7 +111,7 @@ DFhackCExport command_result plugin_shutdown ( color_ostream &out )
/////////////// ///////////////
// Various small tool functions // Various small tool functions
// // probably many of these should be moved to Unit.h and Building.h sometime later...
int32_t getCreatureAge(df::unit* unit); int32_t getCreatureAge(df::unit* unit);
bool isTame(df::unit* unit); bool isTame(df::unit* unit);
bool isTrained(df::unit* unit); bool isTrained(df::unit* unit);
@ -147,6 +147,14 @@ int32_t getUnitAge(df::unit* unit)
return yearDifference; return yearDifference;
} }
bool isDead(df::unit* unit)
{
if(unit->flags1.bits.dead)
return true;
else
return false;
}
bool isTame(df::unit* creature) bool isTame(df::unit* creature)
{ {
bool tame = false; bool tame = false;
@ -231,6 +239,9 @@ bool isOwnCiv(df::unit* creature)
// dump some unit info // dump some unit info
void unitInfo(color_ostream & out, df::unit* unit, bool list_refs = false) void unitInfo(color_ostream & out, df::unit* unit, bool list_refs = false)
{ {
if(isDead(unit))
return;
out.print("Unit %d", unit->id); //race %d, civ %d,", creature->race, creature->civ_id out.print("Unit %d", unit->id); //race %d, civ %d,", creature->race, creature->civ_id
if(unit->name.has_name) if(unit->name.has_name)
out << ", name: " << unit->name.first_name << " " << unit->name.nickname; out << ", name: " << unit->name.first_name << " " << unit->name.nickname;