Commit graph

164 commits

Author SHA1 Message Date
gfgtdf
54e27d2d3f rename team::is_human() -> is_local_human
and is_ai -> is_local_ai
2014-11-12 23:11:15 +01:00
gfgtdf
f777c3ce18 get rid of preprocessor conditional
having 2 different implementations (one for c++11 and one for c++03)
makes the code harder to maintain.
2014-11-11 20:51:34 +01:00
Chris Beck
c4014bc39c Merge branch 'master' of https://github.com/wesnoth/wesnoth 2014-11-11 12:41:14 -05:00
Chris Beck
3b8e3b6d09 fix includes 2014-11-11 12:40:53 -05:00
gfgtdf
43e0ef1f26 revert d889982437
since https://github.com/wesnoth/wesnoth/pull/201 these tags shouldn't appear in the snapshot/scenario anymore.



reverts d889982437
2014-11-11 18:29:50 +01:00
Chris Beck
aa19f6eecd move gui2 dialog lua functions to the lua kernel base 2014-11-10 21:13:22 -05:00
Chris Beck
91f5778068 move all gui2 lua bindings to their own file 2014-11-10 20:12:09 -05:00
Chris Beck
63399b47e9 move some callbacks (gettext, file ops) to lua kernel base 2014-11-10 15:34:13 -05:00
Chris Beck
720f4cdb83 use setfuncs instead of register, so we can do partial define 2014-11-10 15:34:13 -05:00
Chris Beck
76141a0de1 new code for lua protected calls in lua_kernel_base
In initial commit of the new lua kernels, I introduced a problem
by trying to use luaW_pcall and lua_pcall interchangeably via
polymorphism. This doesn't work because their return types don't
match, and it's alot of work to change luaW_pcall syntax. Besides
this there's no reason we can't use the custom error handler
everywhere.

This commits adds protected_call and load_string functions to lua
kernel base. These are an intended replacement for luaW_pcall,
and replace the "run" function. They do better error reporting
and allow to specify an error handler.

The error reporting is very flexible -- by default we select a
an error reporting function associated polymorphically to the lua
kernel, so the in-game lua kernel can send chat messages, and
others can do something else. However an arbitrary handler may
be specified, and exceptions instead of logging may also be
requested.
2014-11-10 15:32:19 -05:00
Chris Beck
ecc714e41e add application lua kernel and game launcher lua wrapper object
The application lua kernel is meant to interpret scripts to drive
the client. Its main features are, it stores a script in its
registry and provides a C++ function to call it with a config
as its argument. Its initialization also creates a "game_launcher"
object, which stands as a limited lua proxy for the C++
game_launcher object.

The game_launcher object is a table, holding a pointer to the
actual game_launcher it represents, and with metamethods to return
version info and the command line arguments. It also holds
callbacks to set the script for the current application lua kernel,
and to call the "play_multiplayer" function of game_launcher.
Currently it is readonly and you cannot write to its fields,
although that may change to allow the target server to be reset,
etc.

Some minor changes that are included in this commit:
- the actual C++ game launcher object provides an accessor to the
command line options.
- the scripting/lua_types.hpp file now has include guards
2014-11-09 20:47:26 -05:00
Chris Beck
ca309d98b2 branch off "lua_common" functions from api defn file
This includes the gettext and vconfig impl functions, and many
macros used to write lua callbacks. This code can't properly go in
the lua_kernel_base files, so it goes here.
2014-11-09 18:45:14 -05:00
Chris Beck
4541412ebc add lua_kernel_base as a super class of game_lua_kernel
This class holds some "basic" initialization and methods that we
would want in any lua kernel. It is not pure virtual, it could
be instantiated.
2014-11-09 18:45:14 -05:00
Chris Beck
042b72a4b8 rename scripting/lua.?pp to game_lua_kernel.?pp 2014-11-09 18:45:14 -05:00
Renamed from src/scripting/lua.cpp (Browse further)