Skip to content

Commit

Permalink
Lua/Unit: allow modifying of id field for Lua-only units (fixes #2433)
Browse files Browse the repository at this point in the history
Celticminstrel recommends restricting this to off-map units until we can be sure
changing the ID is safe in all contexts. I don't see why not, though... but this
should be enough for the situation described in the bug (a unit made with copy_unit).
  • Loading branch information
Vultraz committed Feb 3, 2018
1 parent 64b1ff2 commit a012e7f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog
Expand Up @@ -35,6 +35,7 @@ Version 1.13.10+dev:
* Lua API:
* New wesnoth.unit_types[].advances_to getter.
* New wesnoth.unit_types[].advances_from getter.
* unit.id is now a modifiable field for off-map (Lua-only) units.
* Multiplayer:
* Dark Forecast: Fixed broken faction and leader selection.
* Rename the Khalifate to Dunefolk.
Expand Down
1 change: 1 addition & 0 deletions src/scripting/lua_unit.cpp
Expand Up @@ -431,6 +431,7 @@ static int impl_unit_set(lua_State *L)
map_location loc = u.get_location();
modify_int_attrib("x", loc.set_wml_x(value); u.set_location(loc));
modify_int_attrib("y", loc.set_wml_y(value); u.set_location(loc));
modify_string_attrib("id", u.set_id(value));
}

std::string err_msg = "unknown modifiable property of unit: ";
Expand Down

0 comments on commit a012e7f

Please sign in to comment.