[tunnel] tag: add new optional parameter pass_allied_units=yes/no

If set to yes, units can now pass through own or allied units on the
tunnel exit. It defaults to no, which is the previous behavior.
This commit is contained in:
mattsc 2016-09-15 13:54:49 -07:00
parent 0452848966
commit 692109f3bb
2 changed files with 10 additions and 1 deletions

View file

@ -146,6 +146,10 @@ bool teleport_group::always_visible() const {
return cfg_["always_visible"].to_bool(false);
}
bool teleport_group::pass_allied_units() const {
return cfg_["pass_allied_units"].to_bool(false);
}
config teleport_group::to_config() const {
config retval = cfg_;
retval["saved"] = "yes";
@ -183,7 +187,7 @@ teleport_map::teleport_map(
locations.second.swap(filter_locs.second);
}
if (!ignore_units) {
if (!group.pass_allied_units() && !ignore_units) {
std::set<map_location>::iterator loc = locations.second.begin();
while(loc != locations.second.end()) {
const unit *v = resources::gameboard->get_visible_unit(*loc, viewing_team, see_all);

View file

@ -70,6 +70,11 @@ public:
*/
bool always_visible() const;
/*
* Returns whether allied units on the exit hex can be passed.
*/
bool pass_allied_units() const;
/** Inherited from savegame_config. */
config to_config() const;