summaryrefslogtreecommitdiff
path: root/plugins/zone.cpp
diff options
context:
space:
mode:
authorKelly Martin2012-04-20 14:22:20 -0500
committerKelly Martin2012-04-20 14:22:20 -0500
commite0bb5bf53b7466542413328c36f82cfef709d0fe (patch)
tree93bbc11e795fcabb3be3beea86c85b6d7103d29a /plugins/zone.cpp
parentb7b27ebb9e9bf2575449312bfbc54030cd622a12 (diff)
downloaddfhack-e0bb5bf53b7466542413328c36f82cfef709d0fe.tar.gz
dfhack-e0bb5bf53b7466542413328c36f82cfef709d0fe.tar.bz2
dfhack-e0bb5bf53b7466542413328c36f82cfef709d0fe.tar.xz
Add "naked" (has no inventory) predicate to zone (useful for mass pitting)
Diffstat (limited to 'plugins/zone.cpp')
-rw-r--r--plugins/zone.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/plugins/zone.cpp b/plugins/zone.cpp
index ee6abf32..fe8a4f75 100644
--- a/plugins/zone.cpp
+++ b/plugins/zone.cpp
@@ -366,6 +366,7 @@ void cageInfo(color_ostream & out, df::building* building, bool verbose);
void chainInfo(color_ostream & out, df::building* building, bool verbose);
bool isBuiltCageAtPos(df::coord pos);
bool isInBuiltCageRoom(df::unit*);
+bool isNaked(df::unit *);
int32_t getUnitAge(df::unit* unit)
{
@@ -644,6 +645,12 @@ bool hasValidMapPos(df::unit* unit)
return false;
}
+bool isNaked(df::unit* unit)
+{
+ return (unit->inventory.empty());
+}
+
+
int getUnitIndexFromId(df::unit* unit_)
{
for (size_t i=0; i < world->units.all.size(); i++)
@@ -1748,6 +1755,8 @@ command_result df_zone (color_ostream &out, vector <string> & parameters)
bool find_not_milkable = false;
bool find_named = false;
bool find_not_named = false;
+ bool find_naked = false;
+ bool find_not_naked = false;
bool find_agemin = false;
bool find_agemax = false;
@@ -2126,6 +2135,15 @@ command_result df_zone (color_ostream &out, vector <string> & parameters)
find_not_egglayer = true;
invert_filter=false;
}
+ else if(p == "naked" && !invert_filter)
+ {
+ find_naked = true;
+ }
+ else if(p == "naked" && invert_filter)
+ {
+ find_not_naked = true;
+ invert_filter=false;
+ }
else if(p == "grazer" && !invert_filter)
{
find_grazer = true;
@@ -2393,6 +2411,8 @@ command_result df_zone (color_ostream &out, vector <string> & parameters)
|| (find_not_female && isFemale(unit))
|| (find_named && !unit->name.has_name)
|| (find_not_named && unit->name.has_name)
+ || (find_naked && !isNaked(unit))
+ || (find_not_naked && isNaked(unit))
|| (find_trainable_war && (isWar(unit) || isHunter(unit) || !isTrainableWar(unit)))
|| (find_not_trainable_war && isTrainableWar(unit)) // hm, is this check enough?
|| (find_trainable_hunting && (isWar(unit) || isHunter(unit) || !isTrainableHunting(unit)))