Add gives_income key to SLF
This commit is contained in:
parent
8beb7b08fb
commit
3226147630
2 changed files with 9 additions and 0 deletions
|
@ -10,6 +10,7 @@
|
|||
### Units
|
||||
### User interface
|
||||
### WML Engine
|
||||
* Standard Location Filters now support gives_income=yes|no to make it simpler to match villages regardless of owner
|
||||
### Miscellaneous and Bug Fixes
|
||||
|
||||
## Version 1.15.10
|
||||
|
|
|
@ -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) {
|
||||
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue