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:
Anonymissimus 2011-02-27 17:56:05 +00:00
parent 921aa060d0
commit 461c44efbc
3 changed files with 14 additions and 11 deletions

View file

@ -42,11 +42,13 @@ Version 1.9.4+svn:
opposed to mixing the leader's attributes with the side attributes. opposed to mixing the leader's attributes with the side attributes.
* New wml action tag [transform_unit], like the {TRANSFORM_UNIT..} macro. * New wml action tag [transform_unit], like the {TRANSFORM_UNIT..} macro.
* [unstore_unit] now accepts a fire_event= key to control firing of * [unstore_unit] now accepts a fire_event= key to control firing of
(post) advance events and an ignore_passability= (default no, previously it was (post) advance events and a check_passability= (default yes, previously it was
always yes/non-existant) key controlling whether to check for suitable terrain always no/non-existant) key controlling whether to check for suitable terrain
when placing units when placing units
* Introduced [move_unit]ignore_passability= (default no, previously it was * Renamed [teleport]ignore_passability= to check_passability= to get rid of
always no/non-existant) key to allow disabling the check for suitable terrain. 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: * Miscellaneous and bugfixes:
* Fixed: g++ compiler warnings. * Fixed: g++ compiler warnings.
* Added: cmake target to build the gui design pdf. * Added: cmake target to build the gui design pdf.

View file

@ -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_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 to_y = tostring(cfg.to_y) or helper.wml_error(coordinate_error)
local fire_event = cfg.fire_event 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 = helper.literal(cfg)
cfg.to_x, cfg.to_y, cfg.fire_event = nil, nil, nil cfg.to_x, cfg.to_y, cfg.fire_event = nil, nil, nil
local units = wesnoth.get_units(cfg) 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 xs, ys = string.gmatch(to_x, pattern), string.gmatch(to_y, pattern)
local move_string_x = current_unit.x local move_string_x = current_unit.x
local move_string_y = current_unit.y local move_string_y = current_unit.y
local pass_check = current_unit local pass_check = nil
if cfg.ignore_passability then pass_check = nil end if check_passability then pass_check = current_unit end
local x, y = xs(), ys() local x, y = xs(), ys()
while true do while true do

View file

@ -623,9 +623,9 @@ WML_HANDLER_FUNCTION(teleport, event_info, cfg)
const map_location dst = cfg_to_loc(cfg); const map_location dst = cfg_to_loc(cfg);
if (dst == u->get_location() || !resources::game_map->on_board(dst)) return; if (dst == u->get_location() || !resources::game_map->on_board(dst)) return;
const unit *pass_check = &*u; const unit* pass_check = NULL;
if (cfg["ignore_passability"].to_bool()) if (cfg["check_passability"].to_bool(true))
pass_check = NULL; pass_check = &*u;
const map_location vacant_dst = find_vacant_tile(*resources::game_map, *resources::units, dst, pathfind::VACANT_ANY, pass_check); 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; 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)); (cfg.has_attribute("x") && cfg.has_attribute("y")) ? cfg : vconfig(var));
if(loc.valid()) { if(loc.valid()) {
if (cfg["find_vacant"].to_bool()) { if (cfg["find_vacant"].to_bool()) {
const unit* pass_check = &u; const unit* pass_check = NULL;
if (cfg["ignore_passability"].to_bool(false)) pass_check = 0; if (cfg["check_passability"].to_bool(true)) pass_check = &u;
loc = pathfind::find_vacant_tile( loc = pathfind::find_vacant_tile(
*resources::game_map, *resources::game_map,
*resources::units, *resources::units,