From 9cc2040a6bcd001bb028f74b25a146fa40ed914d Mon Sep 17 00:00:00 2001 From: Robert Heinrich Date: Mon, 2 Apr 2012 16:58:12 +0200 Subject: [PATCH] minor fix in zone tool: ignore dead units --- plugins/zone.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/plugins/zone.cpp b/plugins/zone.cpp index eb9a1e807..03c38b101 100644 --- a/plugins/zone.cpp +++ b/plugins/zone.cpp @@ -111,7 +111,7 @@ DFhackCExport command_result plugin_shutdown ( color_ostream &out ) /////////////// // 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); bool isTame(df::unit* unit); bool isTrained(df::unit* unit); @@ -147,6 +147,14 @@ int32_t getUnitAge(df::unit* unit) return yearDifference; } +bool isDead(df::unit* unit) +{ + if(unit->flags1.bits.dead) + return true; + else + return false; +} + bool isTame(df::unit* creature) { bool tame = false; @@ -231,6 +239,9 @@ bool isOwnCiv(df::unit* creature) // dump some unit info 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 if(unit->name.has_name) out << ", name: " << unit->name.first_name << " " << unit->name.nickname;