summaryrefslogtreecommitdiff
path: root/plugins/zone.cpp
diff options
context:
space:
mode:
authorRobert Heinrich2012-04-10 04:10:07 +0200
committerRobert Heinrich2012-04-10 04:10:07 +0200
commitb2d976b06b0ecc195e64a523557ad2a07abf6aac (patch)
treee160a4cf82da2be20eb0d38113771e11ab02d98e /plugins/zone.cpp
parent674337e3aea18203d69820c8f6f429d8af439738 (diff)
downloaddfhack-b2d976b06b0ecc195e64a523557ad2a07abf6aac.tar.gz
dfhack-b2d976b06b0ecc195e64a523557ad2a07abf6aac.tar.bz2
dfhack-b2d976b06b0ecc195e64a523557ad2a07abf6aac.tar.xz
zone tool: added new filter 'nograzer'
Diffstat (limited to 'plugins/zone.cpp')
-rw-r--r--plugins/zone.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/plugins/zone.cpp b/plugins/zone.cpp
index 8affd2a6..d16578a6 100644
--- a/plugins/zone.cpp
+++ b/plugins/zone.cpp
@@ -117,7 +117,8 @@ const string zone_help_filters =
" male - obvious\n"
" female - obvious\n"
" egglayer - race lays eggs (use together with 'female')\n"
- " grazer - obvious\n"
+ " grazer - is a grazer\n"
+ " nograzer - not a grazer\n"
" milkable - race is milkable (use together with 'female')\n"
" minage - minimum age. must be followed by number\n"
" maxage - maximum age. must be followed by number\n";
@@ -469,7 +470,6 @@ bool isHunter(df::unit* creature)
return false;
}
-
// check if creature belongs to the player's civilization
// (don't try to pasture/slaughter random untame animals)
bool isOwnCiv(df::unit* creature)
@@ -1321,6 +1321,7 @@ command_result df_zone (color_ostream &out, vector <string> & parameters)
bool find_female = false;
bool find_egglayer = false;
bool find_grazer = false;
+ bool find_nograzer = false;
bool find_milkable = false;
bool find_named = false;
@@ -1556,6 +1557,10 @@ command_result df_zone (color_ostream &out, vector <string> & parameters)
{
find_grazer = true;
}
+ else if(p == "nograzer")
+ {
+ find_nograzer = true;
+ }
else if(p == "merchant")
{
find_merchant = true;
@@ -1602,6 +1607,21 @@ command_result df_zone (color_ostream &out, vector <string> & parameters)
find_female=false;
}
+ // search for trained and untrained is exclusive, so drop the flags if both are specified
+ // (there is no trained filter, since it doesn't make much sense to throw war and hunting pets together)
+ //if(find_trained && find_untrained)
+ //{
+ // find_trained=false;
+ // find_female=false;
+ //}
+
+ // search for grazer and nograzer is exclusive, so drop the flags if both are specified
+ if(find_grazer && find_nograzer)
+ {
+ find_grazer=false;
+ find_nograzer=false;
+ }
+
// try to cope with user dumbness
if(target_agemin > target_agemax)
{
@@ -1704,6 +1724,7 @@ command_result df_zone (color_ostream &out, vector <string> & parameters)
|| (find_agemin && getUnitAge(unit)<target_agemin)
|| (find_agemax && getUnitAge(unit)>target_agemax)
|| (find_grazer && !isGrazer(unit))
+ || (find_nograzer && isGrazer(unit))
|| (find_egglayer && !isEggLayer(unit))
|| (find_milkable && !isMilkable(unit))
|| (find_male && !isMale(unit))