|
|
@ -1317,48 +1317,47 @@ df::building* getAssignableBuildingAtCursor(color_ostream& out)
|
|
|
|
// ZONE FILTERS (as in, filters used by 'zone')
|
|
|
|
// ZONE FILTERS (as in, filters used by 'zone')
|
|
|
|
|
|
|
|
|
|
|
|
// Maps parameter names to filters.
|
|
|
|
// Maps parameter names to filters.
|
|
|
|
unordered_map<string, function<bool(df::unit*)>> zone_filters = {
|
|
|
|
unordered_map<string, function<bool(df::unit*)>> zone_filters;
|
|
|
|
{ "caged", isContainedInItem },
|
|
|
|
static struct zone_filters_init { zone_filters_init() {
|
|
|
|
{ "egglayer", isEggLayer },
|
|
|
|
zone_filters["caged"] = isContainedInItem;
|
|
|
|
{ "female", isFemale },
|
|
|
|
zone_filters["egglayer"] = isEggLayer;
|
|
|
|
{ "grazer", isGrazer },
|
|
|
|
zone_filters["female"] = isFemale;
|
|
|
|
{ "hunting", isHunter },
|
|
|
|
zone_filters["grazer"] = isGrazer;
|
|
|
|
{ "male", isMale },
|
|
|
|
zone_filters["hunting"] = isHunter;
|
|
|
|
{ "milkable", isMilkable },
|
|
|
|
zone_filters["male"] = isMale;
|
|
|
|
{ "naked", isNaked },
|
|
|
|
zone_filters["milkable"] = isMilkable;
|
|
|
|
{ "own", isOwnCiv },
|
|
|
|
zone_filters["naked"] = isNaked;
|
|
|
|
{ "tamable", isTamable },
|
|
|
|
zone_filters["own"] = isOwnCiv;
|
|
|
|
{ "tame", isTame },
|
|
|
|
zone_filters["tamable"] = isTamable;
|
|
|
|
{ "trainablewar", [](df::unit *unit) -> bool
|
|
|
|
zone_filters["tame"] = isTame;
|
|
|
|
{
|
|
|
|
zone_filters["trainablewar"] = [](df::unit *unit) -> bool
|
|
|
|
return !isWar(unit) && !isHunter(unit) && isTrainableWar(unit);
|
|
|
|
{
|
|
|
|
}
|
|
|
|
return !isWar(unit) && !isHunter(unit) && isTrainableWar(unit);
|
|
|
|
},
|
|
|
|
};
|
|
|
|
{ "trainablehunt", [](df::unit *unit) -> bool
|
|
|
|
zone_filters["trainablehunt"] = [](df::unit *unit) -> bool
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return !isWar(unit) && !isHunter(unit) && isTrainableHunting(unit);
|
|
|
|
return !isWar(unit) && !isHunter(unit) && isTrainableHunting(unit);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
zone_filters["trained"] = isTrained;
|
|
|
|
{ "trained", isTrained },
|
|
|
|
|
|
|
|
// backwards compatibility
|
|
|
|
// backwards compatibility
|
|
|
|
{ "unassigned", [](df::unit *unit) -> bool
|
|
|
|
zone_filters["unassigned"] = [](df::unit *unit) -> bool
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return !isAssigned(unit);
|
|
|
|
return !isAssigned(unit);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
zone_filters["war"] = isWar;
|
|
|
|
{ "war", isWar },
|
|
|
|
}} zone_filters_init_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Extra annotations / descriptions for parameter names.
|
|
|
|
// Extra annotations / descriptions for parameter names.
|
|
|
|
unordered_map<string, string> zone_filter_notes = {
|
|
|
|
unordered_map<string, string> zone_filter_notes;
|
|
|
|
{ "caged", "caged (ignores built cages)" },
|
|
|
|
static struct zone_filter_notes_init { zone_filter_notes_init() {
|
|
|
|
{ "hunting", "trained hunting creature" },
|
|
|
|
zone_filter_notes["caged"] = "caged (ignores built cages)";
|
|
|
|
{ "named", "has name or nickname" },
|
|
|
|
zone_filter_notes["hunting"] = "trained hunting creature";
|
|
|
|
{ "own", "own civilization" },
|
|
|
|
zone_filter_notes["named"] = "has name or nickname";
|
|
|
|
{ "trainablehunt", "trainable for hunting" },
|
|
|
|
zone_filter_notes["own"] = "own civilization";
|
|
|
|
{ "trainablewar", "trainable for war" },
|
|
|
|
zone_filter_notes["trainablehunt"] = "trainable for hunting";
|
|
|
|
{ "war", "trained war creature" },
|
|
|
|
zone_filter_notes["trainablewar"] = "trainable for war";
|
|
|
|
};
|
|
|
|
zone_filter_notes["war"] = "trained war creature";
|
|
|
|
|
|
|
|
}} zone_filter_notes_init_;
|
|
|
|
|
|
|
|
|
|
|
|
pair<string, function<bool(df::unit*)>> createRaceFilter(vector<string> &filter_args)
|
|
|
|
pair<string, function<bool(df::unit*)>> createRaceFilter(vector<string> &filter_args)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1463,12 +1462,13 @@ pair<string, function<bool(df::unit*)>> createMaxAgeFilter(vector<string> &filte
|
|
|
|
// Result filter functions are not permitted to throw std::exceptions.
|
|
|
|
// Result filter functions are not permitted to throw std::exceptions.
|
|
|
|
// Result filter functions should not store references
|
|
|
|
// Result filter functions should not store references
|
|
|
|
unordered_map<string, pair<int,
|
|
|
|
unordered_map<string, pair<int,
|
|
|
|
function<pair<string, function<bool(df::unit*)>>(vector<string>&)>>> zone_param_filters = {
|
|
|
|
function<pair<string, function<bool(df::unit*)>>(vector<string>&)>>> zone_param_filters;
|
|
|
|
{ "race", { 1, createRaceFilter } },
|
|
|
|
static struct zone_param_filters_init { zone_param_filters_init() {
|
|
|
|
{ "age", { 1, createAgeFilter } },
|
|
|
|
zone_param_filters["race"] = { 1, createRaceFilter };
|
|
|
|
{ "minage", { 1, createMinAgeFilter } },
|
|
|
|
zone_param_filters["age"] = { 1, createAgeFilter };
|
|
|
|
{ "maxage", { 1, createMaxAgeFilter } },
|
|
|
|
zone_param_filters["minage"] = { 1, createMinAgeFilter };
|
|
|
|
};
|
|
|
|
zone_param_filters["maxage"] = { 1, createMaxAgeFilter };
|
|
|
|
|
|
|
|
}} zone_param_filters_init_;
|
|
|
|
|
|
|
|
|
|
|
|
command_result df_zone (color_ostream &out, vector <string> & parameters)
|
|
|
|
command_result df_zone (color_ostream &out, vector <string> & parameters)
|
|
|
|
{
|
|
|
|
{
|
|
|
|