summaryrefslogtreecommitdiff
path: root/plugins/zone.cpp
diff options
context:
space:
mode:
authorRobert Heinrich2012-04-10 00:22:38 +0200
committerRobert Heinrich2012-04-10 00:22:38 +0200
commit674337e3aea18203d69820c8f6f429d8af439738 (patch)
tree47fa67eaa0045df431428315eb726fafe5af0992 /plugins/zone.cpp
parente26fbd4e4cadd260b5467274006a601f897e8fbd (diff)
downloaddfhack-674337e3aea18203d69820c8f6f429d8af439738.tar.gz
dfhack-674337e3aea18203d69820c8f6f429d8af439738.tar.bz2
dfhack-674337e3aea18203d69820c8f6f429d8af439738.tar.xz
added tweak clear-resident which fixes bugged migrants and makes them proper members of the fortress. added tweak clear-merchant which assimilates merchants who linger at the map edge into the fortress. updated readme.rst
Diffstat (limited to 'plugins/zone.cpp')
-rw-r--r--plugins/zone.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/plugins/zone.cpp b/plugins/zone.cpp
index 0038a707..8affd2a6 100644
--- a/plugins/zone.cpp
+++ b/plugins/zone.cpp
@@ -584,6 +584,17 @@ bool hasValidMapPos(df::unit* unit)
return false;
}
+int getUnitIndexFromId(df::unit* unit_)
+{
+ for (size_t i=0; i < world->units.all.size(); i++)
+ {
+ df::unit* unit = world->units.all[i];
+ if(unit->id == unit_->id)
+ return i;
+ }
+ return -1;
+}
+
// dump some unit info
void unitInfo(color_ostream & out, df::unit* unit, bool verbose = false)
{
@@ -652,7 +663,8 @@ void unitInfo(color_ostream & out, df::unit* unit, bool verbose = false)
if(verbose)
{
- out << ". Pos: ("<<unit->pos.x << "/"<< unit->pos.y << "/" << unit->pos.z << ")" << endl;
+ out << ". Pos: ("<<unit->pos.x << "/"<< unit->pos.y << "/" << unit->pos.z << ") " << endl;
+ out << "index in units vector: " << getUnitIndexFromId(unit) << endl;
}
out << endl;