[Commits] [wesnoth/wesnoth] caeaa6: refactor lua show_dialog

GitHub noreply at github.com
Mon Nov 17 22:15:47 UTC 2014


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: caeaa6ba67ed0e05220e189c12df768479320e01
      https://github.com/wesnoth/wesnoth/commit/caeaa6ba67ed0e05220e189c12df768479320e01
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-11-17 (Mon, 17 Nov 2014)

  Changed paths:
    M src/game_events/handlers.cpp
    M src/game_launcher.cpp
    M src/generators/lua_map_generator.cpp
    M src/generators/lua_map_generator.hpp
    M src/generators/map_create.hpp
    M src/play_controller.cpp
    M src/play_controller.hpp
    M src/scripting/application_lua_kernel.cpp
    M src/scripting/application_lua_kernel.hpp
    M src/scripting/game_lua_kernel.cpp
    M src/scripting/game_lua_kernel.hpp
    M src/scripting/lua_gui2.cpp
    M src/scripting/lua_gui2.hpp
    M src/scripting/lua_kernel_base.cpp
    M src/scripting/lua_kernel_base.hpp
    M src/scripting/mapgen_lua_kernel.cpp
    M src/scripting/mapgen_lua_kernel.hpp

  Log Message:
  -----------
  refactor lua show_dialog

The lua show dialog used to get the video object from resources,
which is not ideal. In this version, lua kernel base internalizes
a pointer to the video object, and show_dialog is bound to a
method of the lua kernel base.

>From now on, lua kernels which want to show dialogs need to be
constructed with a pointer to a CVideo, if it is null the lua will
fail with a runtime error.

The application lua kernel is constructed with the video for
game_launcher, and the game lua kernel is modified so that it is
owned by the play controller and not the game events manager, and
held in a boost scoped pointer rather than manually deleted. This
is because the game events manager doesn't have a video object,
also it conceptually seems independent of the lua kernel anyways.

The map generator lua kernels are constructed with NULL, but if a
user configuration dialog is provided (new feature) then when they
try to run it they will update with the mp_create's video pointer.





More information about the Commits mailing list