diff options
| author | Kelly Martin | 2012-04-20 14:38:50 -0500 |
|---|---|---|
| committer | Kelly Martin | 2012-04-20 14:38:50 -0500 |
| commit | ad73b8c737190d98797e88be4a121deb3bae3a5f (patch) | |
| tree | fee0cbef52861ae82fbc4a533a2a5c5070be6ebc /plugins/zone.cpp | |
| parent | e0bb5bf53b7466542413328c36f82cfef709d0fe (diff) | |
| download | dfhack-ad73b8c737190d98797e88be4a121deb3bae3a5f.tar.gz dfhack-ad73b8c737190d98797e88be4a121deb3bae3a5f.tar.bz2 dfhack-ad73b8c737190d98797e88be4a121deb3bae3a5f.tar.xz | |
Add "tamable" for animals that can be tamed (PET or PET_EXOTIC in raws)
Diffstat (limited to 'plugins/zone.cpp')
| -rw-r--r-- | plugins/zone.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/plugins/zone.cpp b/plugins/zone.cpp index fe8a4f75..4fbf9b69 100644 --- a/plugins/zone.cpp +++ b/plugins/zone.cpp @@ -367,6 +367,7 @@ 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) { @@ -621,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; @@ -1757,6 +1772,8 @@ command_result df_zone (color_ostream &out, vector <string> & parameters) 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; @@ -2144,6 +2161,15 @@ command_result df_zone (color_ostream &out, vector <string> & parameters) 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; @@ -2413,6 +2439,8 @@ command_result df_zone (color_ostream &out, vector <string> & parameters) || (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))) |
