Fix [modify_unit] optimized path producing an error on a recall list unit

Addresses #4556
This commit is contained in:
Celtic Minstrel 2019-11-14 22:04:30 -05:00
parent 9a34cbb329
commit 3772e633fa
2 changed files with 2 additions and 2 deletions

View file

@ -182,7 +182,8 @@ local function simple_modify_unit(cfg)
-- by default always do an advancement here (not only when experience/max_experience/type was modified)
-- for compatibility with old code.
if cfg.experience or cfg.max_experience or cfg.rebuild ~= false then
-- Skip for recall list units
if u.valid == 'map' and (cfg.experience or cfg.max_experience or cfg.rebuild ~= false) then
u:advance()
end
end

View file

@ -3276,7 +3276,6 @@ static int intf_remove_modifications(lua_State *L)
static int intf_advance_unit(lua_State *L)
{
events::command_disabler command_disabler;
//TODO: check whether the unit is on the map.
unit& u = luaW_checkunit(L, 1, true);
advance_unit_params par(u.get_location());
if(lua_isboolean(L, 2)) {