Skip to content

Commit

Permalink
Add gives_income key to SLF
Browse files Browse the repository at this point in the history
  • Loading branch information
CelticMinstrel committed Feb 16, 2021
1 parent 33a9b70 commit 6c563d4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/terrain/filter.cpp
Expand Up @@ -107,6 +107,10 @@ bool terrain_filter::match_internal(const map_location& loc, const unit* ref_uni
if (cfg_.has_attribute("area") &&
fc_->get_tod_man().get_area_by_id(cfg_["area"]).count(loc) == 0)
return false;

if(cfg_.has_attribute("gives_income") &&
cfg_["gives_income"].to_bool() != fc_->get_disp_context().map().is_village(loc))
return false;

if(cfg_.has_attribute("terrain")) {
if(cache_.parsed_terrain == nullptr) {
Expand Down Expand Up @@ -548,6 +552,10 @@ void terrain_filter::get_locs_impl(std::set<map_location>& locs, const unit* ref
}
}
}
else if (cfg_["gives_income"].to_bool()) {
auto ar = fc_->get_disp_context().map().villages();
terrain_filterimpl::filter_xy(ar, match_set, *this, with_border);
}
else {
//consider all locations on the map
int bs = fc_->get_disp_context().map().border_size();
Expand Down

0 comments on commit 6c563d4

Please sign in to comment.