[find_path]: fixed this_unit not being restored in certain situations
This commit is contained in:
parent
283653b31b
commit
a129e14874
2 changed files with 7 additions and 0 deletions
|
@ -241,6 +241,7 @@ Version 1.11.0-svn:
|
|||
* Change [object]duration=level to [object]duration=scenario
|
||||
* The race attribute in SUFs can now take a comma-separated list
|
||||
* New image path function: ~ROTATE()
|
||||
* Fixed some cases where [find_path] did not restore $this_unit
|
||||
* Miscellaneous and bug fixes:
|
||||
* Fix wrong preferences path suffix (1.1 instead of 1.10) on Linux and other
|
||||
platforms using XDG layout (no compiled-in preferences path override,
|
||||
|
|
|
@ -1078,10 +1078,16 @@ function wml_actions.find_path(cfg)
|
|||
|
||||
if cost >= 42424242 then -- it's the high value returned for unwalkable or busy terrains
|
||||
wesnoth.set_variable ( string.format("%s", variable), { hexes = 0 } ) -- set only length, nil all other values
|
||||
-- support for $this_unit
|
||||
wesnoth.set_variable ( "this_unit" ) -- clearing this_unit
|
||||
end_var_scope("this_unit", this_unit)
|
||||
return end
|
||||
|
||||
if not allow_multiple_turns and turns > 1 then -- location cannot be reached in one turn
|
||||
wesnoth.set_variable ( string.format("%s", variable), { hexes = 0 } )
|
||||
-- support for $this_unit
|
||||
wesnoth.set_variable ( "this_unit" ) -- clearing this_unit
|
||||
end_var_scope("this_unit", this_unit)
|
||||
return end -- skip the cycles below
|
||||
|
||||
wesnoth.set_variable ( string.format( "%s", variable ), { hexes = current_distance, from_x = unit.x, from_y = unit.y, to_x = current_location[1], to_y = current_location[2], movement_cost = cost, required_turns = turns } )
|
||||
|
|
Loading…
Add table
Reference in a new issue