Commit graph

76 commits

Author SHA1 Message Date
Celtic Minstrel
6846506860 Lua Units: Add animations key which returns a list of animations defined
Note: It returns only the flags (for use in [animate_unit], not the full animation.)
2017-05-10 17:40:19 -04:00
gfgtdf
f71e64e364 bring back unit_map::replace 2017-04-29 16:06:42 +02:00
Charles Dang
f9a021eaab Deploy display_context::get_team when possible
This replaces uses of teams()[side - 1] when appropriate. Doesn't touch usecases in other classes.
2017-04-26 02:39:03 +11:00
Celtic Minstrel
58ee985c5b Lua: Add float mutator macros and some fixups/cleanup to other mutator/accessor macros
- Enclose all macro arguments in parentheses, except those meant to be statements
- Use pushlstring to allow strings with nulls
- New float mutators
2017-04-24 11:01:07 -04:00
Celtic Minstrel
69a7d5a755 Use fallthrough annotation attributes where applicable
This commit also has some random reformatting. Please ignore it.
2017-04-19 03:50:55 -04:00
gfgtdf
c4625197d7 less unit copying 2017-04-14 23:45:13 +02:00
Charles Dang
2349296836 Small improvement to ebeeae3 2017-04-15 03:19:20 +11:00
Charles Dang
ebeeae3872 Unit: refactor upkeep handling to use a visitor pattern 2017-04-15 01:30:16 +11:00
Celtic Minstrel
b4dc11ce36 Belated 2017 copyright update 2017-03-19 10:05:38 -04: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
d31555f8cf Pedantic includes
Change all includes to start at the base instead of assuming the directory where included from.

This makes it more apparent exactly which header has been included, since many have the same name.

This also allows moving all header files out of the src directory.
2016-11-11 11:00:22 -06:00
Celtic Minstrel
e85f8ec94e Rename several types to avoid t_ prefix 2016-11-09 01:15:15 -05:00
Gregory A Lundberg
b8244b0694 Correct the calls instead
Do not change the released Lua source code. Lua is written as standard C, but we compile it as C++ so we can use exceptions. Change the call sites to avoid the warnings about using a C cast instead of static_cast<int>().

NB: The changes to Wesnoth C++ code will be required to upgrade to Lua 5.3, anyway.

This reverts:

commit cee3ab2084
Author: Mark de Wever <koraq@xs4all.nl>
Date:   Sun Feb 5 19:55:32 2012 +0000

    Fix compiler warnings.
2016-10-17 10:34:41 -05: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
gfgtdf
553ac0fd05 add wml_x/y() getter & setter in map_location 2016-09-16 22:35:41 +02:00
Celtic Minstrel
b8b1e8a223 Store unit methods in metatable instead of doing linear search 2016-09-11 17:05:51 -04:00
Celtic Minstrel
0180a72573 Fix lots of warnings in MSVC12
Some explanations:
- savepng uses setjmp, so I changed it to C; this guarantees that someone does not accidentally introduce a C++ object in it (unlikely though that is)
- The loop in multiplayer.cpp seemed intended to allow the command-line to request repeated plays, so the break was removed rather than refactoring it to an if statement
- Some uninitialized structs were changed to be zero-initialized
- Use luaW_toboolean instead of lua_toboolean
- Needed explicit constructor for vconfig iterators, since their only member is const
2016-09-06 17:55:00 -04:00
Celtic Minstrel
e821e508c3 Merge pull request #744 from lua_refactor
Refactor some Lua stuff and reduce const_cast usage

Conflicts:
	src/scripting/game_lua_kernel.cpp
	src/scripting/lua_unit.cpp
2016-08-24 03:13:38 -04: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
22a39d0bb4 Move Lua unit attacks metatable to own file 2016-08-20 20:38:46 -04:00
Celtic Minstrel
fa0e63e3a3 Move unit metatable stuff into lua_unit file 2016-08-20 20:38:46 -04:00
Celtic Minstrel
3804027d10 Avoid luaW_hasmetatable when checking for units 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
Renamed from src/scripting/lua_api.cpp (Browse further)