diff --git a/changelog b/changelog index 464c67c94a8..021d0aab00e 100644 --- a/changelog +++ b/changelog @@ -42,11 +42,13 @@ Version 1.9.4+svn: opposed to mixing the leader's attributes with the side attributes. * New wml action tag [transform_unit], like the {TRANSFORM_UNIT..} macro. * [unstore_unit] now accepts a fire_event= key to control firing of - (post) advance events and an ignore_passability= (default no, previously it was - always yes/non-existant) key controlling whether to check for suitable terrain + (post) advance events and a check_passability= (default yes, previously it was + always no/non-existant) key controlling whether to check for suitable terrain when placing units - * Introduced [move_unit]ignore_passability= (default no, previously it was - always no/non-existant) key to allow disabling the check for suitable terrain. + * Renamed [teleport]ignore_passability= to check_passability= to get rid of + a confusing negation. + * Introduced [move_unit]check_passability= (default yes, previously it was + always yes/non-existant) key to allow disabling the check for suitable terrain. * Miscellaneous and bugfixes: * Fixed: g++ compiler warnings. * Added: cmake target to build the gui design pdf. diff --git a/data/lua/wml-tags.lua b/data/lua/wml-tags.lua index a6fb0940bbb..21a26c72b12 100644 --- a/data/lua/wml-tags.lua +++ b/data/lua/wml-tags.lua @@ -546,6 +546,7 @@ function wml_actions.move_unit(cfg) local to_x = tostring(cfg.to_x) or helper.wml_error(coordinate_error) local to_y = tostring(cfg.to_y) or helper.wml_error(coordinate_error) local fire_event = cfg.fire_event + local check_passability = cfg.check_passability; if check_passability == nil then check_passability = true end cfg = helper.literal(cfg) cfg.to_x, cfg.to_y, cfg.fire_event = nil, nil, nil local units = wesnoth.get_units(cfg) @@ -556,8 +557,8 @@ function wml_actions.move_unit(cfg) local xs, ys = string.gmatch(to_x, pattern), string.gmatch(to_y, pattern) local move_string_x = current_unit.x local move_string_y = current_unit.y - local pass_check = current_unit - if cfg.ignore_passability then pass_check = nil end + local pass_check = nil + if check_passability then pass_check = current_unit end local x, y = xs(), ys() while true do diff --git a/src/game_events.cpp b/src/game_events.cpp index 0baa809b57f..5d38f1792e3 100644 --- a/src/game_events.cpp +++ b/src/game_events.cpp @@ -623,9 +623,9 @@ WML_HANDLER_FUNCTION(teleport, event_info, cfg) const map_location dst = cfg_to_loc(cfg); if (dst == u->get_location() || !resources::game_map->on_board(dst)) return; - const unit *pass_check = &*u; - if (cfg["ignore_passability"].to_bool()) - pass_check = NULL; + const unit* pass_check = NULL; + if (cfg["check_passability"].to_bool(true)) + pass_check = &*u; const map_location vacant_dst = find_vacant_tile(*resources::game_map, *resources::units, dst, pathfind::VACANT_ANY, pass_check); if (!resources::game_map->on_board(vacant_dst)) return; @@ -2026,8 +2026,8 @@ WML_HANDLER_FUNCTION(unstore_unit, /*event_info*/, cfg) (cfg.has_attribute("x") && cfg.has_attribute("y")) ? cfg : vconfig(var)); if(loc.valid()) { if (cfg["find_vacant"].to_bool()) { - const unit* pass_check = &u; - if (cfg["ignore_passability"].to_bool(false)) pass_check = 0; + const unit* pass_check = NULL; + if (cfg["check_passability"].to_bool(true)) pass_check = &u; loc = pathfind::find_vacant_tile( *resources::game_map, *resources::units,