Commit graph

26 commits

Author SHA1 Message Date
Gregory A Lundberg
b5f76eff79
Bump copyright to 2018 2018-01-19 00:02:20 -06:00
Alexander van Gessel
543119134b Out-of-line and forward-declare to remove some includes 2017-11-19 17:32:13 +01:00
Gregory A Lundberg
fc21ebf1be Respect lua_next constraints
The key value returned by lua_next, on the Lua stack, cannot be modified.

Certain tests such as lua_isstring will convert the value.

The solution is, instead of testing if they key can be converted to a string, test if it actually is a string by using lua_type.
2017-11-12 20:48:57 -05:00
Celtic Minstrel
d536d6ab76 Implement a destructor subscription system for formula_callable
This allows the variant_callable to store a shared_ptr to its callable while ensuring that
callables that were allocated on the stack or as part of a larger structure are not
double-freed.
2017-04-08 19:17:48 -04:00
Charles Dang
92d0be3941 Made formula_callable::get_inputs and add_input take a reference instead of a pointer 2017-04-03 21:37:58 +11:00
Charles Dang
766008978f Bunch of formula code cleanup, mostly formatting and moving stuff around
Includes a few minor syntax changes such as range-for deployment.

Also moves the implementation of formula_callable::get_value and various map_formula_callable functions to their
appropriate places.
2017-04-03 21:15:06 +11:00
Celtic Minstrel
e6045b17c6 Rename game_logic namespace to wfl and move variant class into it 2017-04-03 04:31:38 -04:00
Charles Dang
9fe45ce42f Revert variant_callable handling to raw pointers temporarily
Since there are some issues with deploying shared_ptr fully and it has not yet been done, there's the possibility
of pointers being freed twice. The raw pointer implementation results in memory leaks, but at least it should
suffice until full smart pointer support can be added.
2017-04-02 17:10:48 +11:00
Charles Dang
99874f4253 Refactor variant class
This splits the handling of each applicable type into its own helper class to better encapsulate the functionality of each.
It also contains a lot of related cleanup and improvements to the class interface itself.
2017-04-02 16:59:19 +11:00
Charles Dang
525a813c80 Deployed formula_callable::add_input en-masse 2017-03-29 15:09:07 +11:00
Charles Dang
8d608f65f5 Adding missing and fixed incorrectly formatted copyright notices 2017-03-24 08:26:06 +11:00
Charles Dang
ed15163b95 Convert uses of resources::units to resources::gameboard->units()
This mirrors the similar conversion of resources::teams in 6235e18bbd.
2016-12-02 12:00:08 +11:00
Gregory A Lundberg
1528a8bb5a Refactor luaL_typerror
Lua deprecated luaL_typerror. Wesnoth needs it. Traditionally this was handled as a by-hand edit to the Lua source kit. Refactored into Wesnoth as luaW_type_error.
2016-10-10 10:19:41 -05:00
Celtic Minstrel
39477b40a7 Fix Lua metatables by using lauxlib to manage them 2016-08-22 14:13:53 -04:00
Celtic Minstrel
30b7ab8b2d Reduce use of const_cast 2016-08-20 20:38:46 -04:00
Celtic Minstrel
6d38c77aab Extract Lua unit push code into a function 2016-08-20 20:38:46 -04:00
Celtic Minstrel
4dd99b881f Implement Lua placement new 2016-08-20 20:38:46 -04:00
Celtic Minstrel
1521f326df Move Lua unit wrapper to own file 2016-08-20 20:38:46 -04:00
Charles Dang
05092ba2f6 Refactor most boost pointer related stuff to use their stdlib counterparts
This constitutes drop-in replacements for:

* boost::shared_ptr
* boost::scoped_ptr
* boost::weak_ptr
* boost::enable_shared_from_this
* boost::static_pointer_cast
* boost::dynamic_pointer_cast

This excludes boost::intrusive_ptr, except for stray includes. Refactoring that is more complicated.
2016-07-25 09:28:42 +11:00
Celtic Minstrel
c39af95a44 Move name generator and formula API to base Lua kernel 2016-07-12 11:08:33 -04:00
Celtic Minstrel
ca6ec3b900 NULL -> nullptr 2016-04-04 15:55:00 -04:00
Celtic Minstrel
b503b6cfe1 Lua formula bridge now recognizes location objects 2016-04-02 09:38:56 -04:00
Celtic Minstrel
5bb6c30b05 Lua API: Add wesnoth.compile_formula which returns a callable userdata 2016-04-02 09:38:49 -04:00
Celtic Minstrel
ac4479090f Add a comparator function for lua_callable 2016-04-02 09:38:47 -04:00
Celtic Minstrel
38198e9151 Move config_callable to callable_objects.hpp and add a comparator function 2016-04-02 09:38:45 -04:00
Celtic Minstrel
4d1c9bdd43 Add wesnoth.eval_formula which compiles and evaluates a formula in the formula engine 2016-04-02 09:38:43 -04:00