move wml [inspect] impl to lua (and lua_gui2 namespace)
This commit is contained in:
parent
ca58a71793
commit
9922b98fa3
6 changed files with 24 additions and 7 deletions
|
@ -1372,6 +1372,10 @@ function wml_actions.event(cfg)
|
|||
end
|
||||
end
|
||||
|
||||
function wml_actions.inspect(cfg)
|
||||
wesnoth.gamestate_inspector(cfg)
|
||||
end
|
||||
|
||||
function wml_actions.label(cfg)
|
||||
wesnoth.label(cfg)
|
||||
end
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include "game_errors.hpp"
|
||||
#include "game_preferences.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "gui/dialogs/gamestate_inspector.hpp"
|
||||
#include "gui/dialogs/transient_message.hpp"
|
||||
#include "gui/dialogs/wml_message.hpp"
|
||||
#include "gui/widgets/window.hpp"
|
||||
|
@ -734,12 +733,6 @@ WML_HANDLER_FUNCTION(heal_unit, event_info, cfg)
|
|||
}
|
||||
}
|
||||
|
||||
WML_HANDLER_FUNCTION(inspect, /*event_info*/, cfg)
|
||||
{
|
||||
gui2::tgamestate_inspector inspect_dialog(cfg);
|
||||
inspect_dialog.show(resources::screen->video());
|
||||
}
|
||||
|
||||
WML_HANDLER_FUNCTION(kill, event_info, cfg)
|
||||
{
|
||||
bool secondary_unit = cfg.has_child("secondary_unit");
|
||||
|
|
|
@ -74,6 +74,7 @@
|
|||
#include "scripting/lua_api.hpp" // for luaW_toboolean, etc
|
||||
#include "scripting/lua_common.hpp"
|
||||
#include "scripting/lua_cpp_function.hpp"
|
||||
#include "scripting/lua_gui2.hpp" // for show_gamestate_inspector
|
||||
#include "scripting/lua_types.hpp" // for getunitKey, dlgclbkKey, etc
|
||||
#include "sdl/utils.hpp" // for surface
|
||||
#include "side_filter.hpp" // for side_filter
|
||||
|
@ -490,6 +491,14 @@ static int impl_unit_variables_set(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int game_lua_kernel::intf_gamestate_inspector(lua_State *L)
|
||||
{
|
||||
if (game_display_) {
|
||||
return lua_gui2::show_gamestate_inspector(game_display_->video(), luaW_checkvconfig(L, 1));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the unit at the given location or with the given id.
|
||||
* - Arg 1: integer.
|
||||
|
|
|
@ -74,6 +74,7 @@ class game_lua_kernel : public lua_kernel_base
|
|||
int intf_allow_undo(lua_State *);
|
||||
int intf_add_time_area(lua_State *);
|
||||
int intf_remove_time_area(lua_State *);
|
||||
int intf_gamestate_inspector(lua_State *);
|
||||
int intf_get_unit(lua_State *);
|
||||
int intf_get_units(lua_State *);
|
||||
int intf_get_displayed_unit(lua_State*);
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "gui/auxiliary/canvas.hpp" // for tcanvas
|
||||
#include "gui/auxiliary/window_builder.hpp" // for twindow_builder, etc
|
||||
#include "gui/dialogs/gamestate_inspector.hpp"
|
||||
#include "gui/dialogs/lua_interpreter.hpp"
|
||||
#include "gui/widgets/clickable.hpp" // for tclickable_
|
||||
#include "gui/widgets/control.hpp" // for tcontrol
|
||||
|
@ -445,4 +446,11 @@ int show_lua_console(lua_State * /*L*/, CVideo & video, lua_kernel_base * lk)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int show_gamestate_inspector(CVideo & video, const vconfig & cfg)
|
||||
{
|
||||
gui2::tgamestate_inspector inspect_dialog(cfg);
|
||||
inspect_dialog.show(video);
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // end namespace lua_gui2
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
struct lua_State;
|
||||
class CVideo;
|
||||
class lua_kernel_base;
|
||||
class vconfig;
|
||||
|
||||
namespace lua_gui2 {
|
||||
|
||||
|
@ -29,6 +30,7 @@ int intf_set_dialog_canvas(lua_State *L);
|
|||
int intf_set_dialog_active(lua_State *L);
|
||||
int show_dialog(lua_State *L, CVideo & video);
|
||||
int show_lua_console(lua_State*L, CVideo & video, lua_kernel_base * lk);
|
||||
int show_gamestate_inspector(CVideo & video, const vconfig & cfg);
|
||||
|
||||
} // end namespace lua_gui2
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue