move WML [label] impl to lua
This commit is contained in:
parent
29da15e1c0
commit
0e365efc1a
4 changed files with 21 additions and 10 deletions
|
@ -1363,6 +1363,10 @@ function wml_actions.end_turn(cfg)
|
|||
wesnoth.end_turn()
|
||||
end
|
||||
|
||||
function wml_actions.label(cfg)
|
||||
wesnoth.label(cfg)
|
||||
end
|
||||
|
||||
function wml_actions.redraw(cfg)
|
||||
local clear_shroud = cfg.clear_shroud
|
||||
|
||||
|
|
|
@ -883,16 +883,6 @@ WML_HANDLER_FUNCTION(kill, event_info, cfg)
|
|||
}
|
||||
}
|
||||
|
||||
WML_HANDLER_FUNCTION(label, /*event_info*/, cfg)
|
||||
{
|
||||
game_display &screen = *resources::screen;
|
||||
|
||||
terrain_label label(screen.labels(), cfg.get_config());
|
||||
|
||||
screen.labels().set_label(label.location(), label.text(), label.team_name(), label.color(),
|
||||
label.visible_in_fog(), label.visible_in_shroud(), label.immutable(), label.tooltip());
|
||||
}
|
||||
|
||||
WML_HANDLER_FUNCTION(lift_fog, /*event_info*/, cfg)
|
||||
{
|
||||
toggle_fog(true, cfg, !cfg["multiturn"].to_bool(false));
|
||||
|
|
|
@ -2757,6 +2757,21 @@ int game_lua_kernel::intf_delay(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int game_lua_kernel::intf_label(lua_State *L)
|
||||
{
|
||||
if (game_display_) {
|
||||
vconfig cfg(luaW_checkvconfig(L, 1));
|
||||
|
||||
game_display &screen = *game_display_;
|
||||
|
||||
terrain_label label(screen.labels(), cfg.get_config());
|
||||
|
||||
screen.labels().set_label(label.location(), label.text(), label.team_name(), label.color(),
|
||||
label.visible_in_fog(), label.visible_in_shroud(), label.immutable(), label.tooltip());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int game_lua_kernel::intf_redraw(lua_State *L)
|
||||
{
|
||||
if (game_display_) {
|
||||
|
@ -3238,6 +3253,7 @@ game_lua_kernel::game_lua_kernel(const config &cfg, CVideo * video, game_state &
|
|||
{ "get_displayed_unit", boost::bind(&game_lua_kernel::intf_get_displayed_unit, this, _1) },
|
||||
{ "highlight_hex", boost::bind(&game_lua_kernel::intf_highlight_hex, this, _1) },
|
||||
{ "is_enemy", boost::bind(&game_lua_kernel::intf_is_enemy, this, _1) },
|
||||
{ "label", boost::bind(&game_lua_kernel::intf_label, this, _1) },
|
||||
{ "lock_view", boost::bind(&game_lua_kernel::intf_lock_view, this, _1) },
|
||||
{ "match_location", boost::bind(&game_lua_kernel::intf_match_location, this, _1) },
|
||||
{ "match_side", boost::bind(&game_lua_kernel::intf_match_side, this, _1) },
|
||||
|
|
|
@ -126,6 +126,7 @@ class game_lua_kernel : public lua_kernel_base
|
|||
int intf_remove_tile_overlay(lua_State *L);
|
||||
int intf_color_adjust(lua_State *L);
|
||||
int intf_delay(lua_State *L);
|
||||
int intf_label(lua_State *L);
|
||||
int intf_redraw(lua_State *L);
|
||||
int intf_replace_schedule(lua_State *l);
|
||||
int intf_scroll(lua_State *L);
|
||||
|
|
Loading…
Add table
Reference in a new issue