Expose side_name attribute to Lua API and [modify_side]

This commit is contained in:
Celtic Minstrel 2018-02-18 12:53:00 -05:00
parent 4d8035e925
commit 29942eec35
4 changed files with 10 additions and 0 deletions

View File

@ -1,4 +1,6 @@
Version 1.13.11+dev:
* Lua API:
* Add side_name to unit proxy
* User Interface:
* Improved outro screen.
* Fixed a few cases of data not displaying in the MP Join Game screen.
@ -7,6 +9,7 @@ Version 1.13.11+dev:
* WML engine:
* Fixed units shown with [move_units_fake] disappearing between steps
(bug #1516).
* [modify_side] now supports side_name
* Miscellaneous and bug fixes:
* Fixed standing animation toggle not taking immediate effect (bug
#1653).

View File

@ -17,6 +17,9 @@ function wesnoth.wml_actions.modify_side(cfg)
if cfg.user_team_name then
side.user_team_name = cfg.user_team_name
end
if cfg.side_name then
side.side_name = cfg.side_name
end
if cfg.controller then
side.controller = cfg.controller
end

View File

@ -87,6 +87,7 @@ static int impl_side_get(lua_State *L)
return_bool_attrib("share_maps", t.share_maps());
return_bool_attrib("share_view", t.share_view());
return_bool_attrib("chose_random", t.chose_random());
return_tstring_attrib("side_name", t.side_name_tstr());
if (strcmp(m, "recruit") == 0) {
const std::set<std::string>& recruits = t.recruits();
@ -151,6 +152,7 @@ static int impl_side_set(lua_State *L)
modify_bool_attrib("shroud", t.set_shroud(value));
modify_bool_attrib("fog", t.set_fog(value));
modify_string_attrib("flag_icon", t.set_flag_icon(value));
modify_tstring_attrib("side_name", t.set_side_name(value));
modify_string_attrib("share_vision", {
team::SHARE_VISION v;
if(v.parse(value)) {

View File

@ -302,6 +302,8 @@ public:
void set_flag_icon(const std::string& flag_icon) { info_.flag_icon = flag_icon; }
const std::string& side_name() const { return info_.side_name.empty() ? info_.current_player : info_.side_name.str(); }
t_string side_name_tstr() const { return info_.side_name.empty() ? info_.current_player : info_.side_name; }
void set_side_name(const t_string& new_name) {info_.side_name = new_name;}
const std::string& faction() const { return info_.faction; }
const t_string& faction_name() const { return info_.faction_name; }
//Returns true if the hex is shrouded/fogged for this side, or