zone tool: added new filter 'nograzer'

develop
Robert Heinrich 2012-04-10 04:10:07 +02:00
parent 674337e3ae
commit b2d976b06b
2 changed files with 24 additions and 2 deletions

@ -835,6 +835,7 @@ Filters:
:female: Creature is female.
:egglayer: Race lays eggs.
:grazer: Race is a grazer.
:nograzer: Race is not a grazer.
:milkable: Race is milkable.
:minage: Minimum age. Must be followed by number.
:maxage: Maximum age. Must be followed by number.

@ -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))