Renamed ignore_passability=...
...in [teleport], [move_unit] and [unstore_unit] to check_passability= to get rid of the confusing negation as long as they're not used yet. Adjusted default values accordingly. Breaks backwards compatibility in case of [teleport], there are however no usages of the key in mainline wml.
This commit is contained in:
parent
921aa060d0
commit
461c44efbc
3 changed files with 14 additions and 11 deletions
10
changelog
10
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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue