Skip to content

Commit

Permalink
Support location_id in [recall] and [unstore_unit]
Browse files Browse the repository at this point in the history
(cherry-picked from commit ecc8785)
  • Loading branch information
CelticMinstrel committed Oct 7, 2018
1 parent b3b3a3c commit 4812346
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion changelog.md
Expand Up @@ -50,8 +50,8 @@
### WML engine
* Support formula= key in [variable] ConditionalWML
* Support to_location in [move_unit], taking a location ID
* Support location_id in [teleport] for the target location
* Suppor dir in [move_unit] to perform relative movements
* Support location_id in [teleport], [recall], [unstore_unit] for the target location
* Support [filter_weapon] in leadership and resistance abilities,
which activates the ability only when the affected unit is using
a matching weapon.
Expand Down
3 changes: 3 additions & 0 deletions data/lua/wml-tags.lua
Expand Up @@ -831,6 +831,9 @@ wml_actions.unstore_unit = function(cfg)
local check_passability = cfg.check_passability ~= false or nil
local x = cfg.x or unit.x or -1
local y = cfg.y or unit.y or -1
if cfg.location_id then
x, y = wesnoth.special_locations[cfg.location_id]
end
wesnoth.add_known_unit(unit.type)
if on_board(x, y) then
if cfg.find_vacant then
Expand Down
5 changes: 4 additions & 1 deletion src/game_events/action_wml.cpp
Expand Up @@ -468,6 +468,7 @@ WML_HANDLER_FUNCTION(recall,, cfg)
*/
temp_config["x"] = "recall";
temp_config["y"] = "recall";
temp_config.remove_attribute("location_id");
vconfig unit_filter_cfg(temp_config);
const vconfig & leader_filter = cfg.child("secondary_unit");

Expand All @@ -494,7 +495,9 @@ WML_HANDLER_FUNCTION(recall,, cfg)
const unit_ptr to_recruit = *u;
const unit* pass_check = to_recruit.get();
if(!cfg["check_passability"].to_bool(true)) pass_check = nullptr;
const map_location cfg_loc = cfg_to_loc(cfg);
const map_location cfg_loc = cfg.has_attribute("location_id")
? resources::gameboard->map().special_locations().left[cfg["location_id"]]
: cfg_to_loc(cfg);

/// @todo fendrin: comment this monster
for (unit_map::const_unit_iterator leader : leaders) {
Expand Down

0 comments on commit 4812346

Please sign in to comment.