diff options
| author | Alexander Gavrilov | 2012-05-05 19:26:56 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-05-05 19:26:56 +0400 |
| commit | 1b5ce7b7170223f5f6303cd04ba7e1fb80c4ca70 (patch) | |
| tree | c2cf8a0d14e6335da76b1440d24cc701e4c91deb /plugins/zone.cpp | |
| parent | 7e01b004e9675fec417bee0eead7d3d0702395e6 (diff) | |
| parent | 6903f3877fb7f3b8aa1f1062e342f0bc2b6001ae (diff) | |
| download | dfhack-1b5ce7b7170223f5f6303cd04ba7e1fb80c4ca70.tar.gz dfhack-1b5ce7b7170223f5f6303cd04ba7e1fb80c4ca70.tar.bz2 dfhack-1b5ce7b7170223f5f6303cd04ba7e1fb80c4ca70.tar.xz | |
Merge remote-tracking branch 'ab9rf/master'
Diffstat (limited to 'plugins/zone.cpp')
| -rw-r--r-- | plugins/zone.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/plugins/zone.cpp b/plugins/zone.cpp index 4314aa1e..ce610128 100644 --- a/plugins/zone.cpp +++ b/plugins/zone.cpp @@ -366,6 +366,8 @@ 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 *); +bool isTamable(df::unit *); int32_t getUnitAge(df::unit* unit) { @@ -620,6 +622,20 @@ bool isTrainableHunting(df::unit* unit) return false; } +bool isTamable(df::unit* unit) +{ + df::creature_raw *raw = df::global::world->raws.creatures.all[unit->race]; + size_t sizecas = raw->caste.size(); + for (size_t j = 0; j < sizecas;j++) + { + df::caste_raw *caste = raw->caste[j]; + if(caste->flags.is_set(caste_raw_flags::PET) || + caste->flags.is_set(caste_raw_flags::PET_EXOTIC)) + return true; + } + return false; +} + bool isMale(df::unit* unit) { return unit->sex == 1; @@ -644,6 +660,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 +1770,10 @@ 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_tamable = false; + bool find_not_tamable = false; bool find_agemin = false; bool find_agemax = false; @@ -2126,6 +2152,24 @@ 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 == "tamable" && !invert_filter) + { + find_tamable = true; + } + else if(p == "tamable" && invert_filter) + { + find_not_tamable = true; + invert_filter=false; + } else if(p == "grazer" && !invert_filter) { find_grazer = true; @@ -2393,6 +2437,10 @@ 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_tamable && !isTamable(unit)) + || (find_not_tamable && isTamable(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))) |
