Commit graph

38 commits

Author SHA1 Message Date
P. J. McDermott
b5d073a2ad Rename src/lua/*.h to src/lua/wrapper_*.h
These will be changed to conditionally include system Lua headers,
e.g. "lua.h", instead of submodule Lua headers, e.g. "module/lua/lua.h".
If a header named "lua.h" includes "lua.h", the build will fail due to
recursion.

This can't be solved using angle brackets to include system headers,
because macos builds won't find them:

    In file included from /Users/runner/work/wesnoth/wesnoth/src/ai/registry.cpp:30:
    In file included from /Users/runner/work/wesnoth/wesnoth/src/ai/composite/aspect.hpp:24:
    In file included from /Users/runner/work/wesnoth/wesnoth/src/ai/lua/lua_object.hpp:25:
    /Users/runner/work/wesnoth/wesnoth/src/lua/lua.h:4:14: error: 'lua.h' file not found with <angled> include; use "quotes" instead
        #include <lua.h>
                 ^~~~~~~
                 "lua.h"

Renamed with (requires GNU sed):

    $ for f in src/lua/*.h; do
    >     git mv "${f}" "src/lua/wrapper_${f#src/lua/}";
    > done
    $ git grep -El -- '#[ \t]*include[ \t]+"lua/[^"]+[.]h"' src | \
    > xargs sed -Ei -- '
    > s|(#[ \t]*include[ \t]+"lua/)(lua[.]h")(            )?|\1wrapper_\2|;
    > s|(#[ \t]*include[ \t]+"lua/)(lualib[.]h")(         )?|\1wrapper_\2|;
    > s|(#[ \t]*include[ \t]+"lua/)(lauxlib[.]h")(        )?|\1wrapper_\2|;
    > '
2024-02-11 23:21:15 -06:00
pentarctagon
970163813d 2024 copyright update 2024-01-20 22:22:23 -06:00
Pentarctagon
c44cc2742e Copyright update.. 2023-04-29 10:48:11 -05:00
Celtic Minstrel
ddbf533aba Expand the list of types that can pass through wesnoth.eval_formula.
* unit types
* weapons
* sides
2022-12-06 01:53:55 -05:00
Charles Dang
f60de6ab51 More glorious scoped enums 2022-03-21 11:00:17 -04:00
Pentarctagon
1a3498cbf3 Rename nowarn/ to lua/
Also cleanup the includes.
2022-03-09 15:01:37 -06:00
Pentarctagon
dd947db289 Avoid lua build warning without altering source code. 2022-03-09 15:01:37 -06:00
Pentarctagon
340023921d
2022 copyright update. 2022-03-06 19:07:13 -06:00
Pentarctagon
ba75e1af50
Copyright update.
This additionally:
* Makes all copyright notices identical aside from the starting year for Wesnoth-specific source files. Files not included: mariadbpp, lua, spirit po, xbrz, and bcrypt (crypt_blowfish).
* Removes all attribution from the files, since the vast majority of them are outdated or seemingly just outright incorrect. For example, I would guess that Dave is no longer the sole author of the majority of Wesnoth's current code.
2021-07-26 11:38:03 -05:00
Charles Dang
e31b327a90 Converted config_attribute_value to use utils::variant
All visitors that are used with apply_visitor have had their boost::static_visitor inheritance
made conditional as well.
2021-01-20 14:23:46 +11:00
Martin Hrubý (hrubymar10)
674fda85b7 Migrate links to https if available - Fwd c18537edc0
(cherry-picked from commit bc4d22dc72)
2018-10-07 03:23:36 +00:00
Charles Dang
45f871067f Use std::size_t everywhere instead of plain size_t
Excludes:
* spirit_po/
* xBRZ/

(cherry-picked from commit fc2a58f693)
2018-10-07 03:17:59 +00:00
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