Commit graph

425 commits

Author SHA1 Message Date
Celtic Minstrel
b7a6f16f11 Add recall_filter to Lua unit proxy 2016-08-23 17:48:14 -04:00
Celtic Minstrel
1e575480a4 When creating units in Lua from a vconfig, don't parse any contained [filter_recall] or [event] 2016-08-23 17:48:14 -04:00
Celtic Minstrel
30b7ab8b2d Reduce use of const_cast 2016-08-20 20:38:46 -04:00
Celtic Minstrel
bb43fa29c4 Use luaW_pushunit when getting lists of units 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
4dcba0c3cd Fix bug in wesnoth.put_unit 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
gfgtdf
cf16c6c787 fixup 16f5980a3c 'config... ...now return return iterator_range.' 2016-08-14 16:23:26 +02:00
gfgtdf
16f5980a3c config::all_children_range(), attribute_range() now return iterator_range
This also fixed compilation with boost veryion < 1.56 by using
iterator_range::pop_front() instead of iterator_range::drop_front()
which was added in boost 1.56

This also makes config::all_children_iterator a random access iterator.
2016-08-14 15:50:22 +02:00
gfgtdf
4d84d42c47 iterator_range instead of pair for config::child_itors
with this wwe can use .size(), .empty(), .front(), operator bool, etc.
on config::child_itors objects.
2016-08-13 16:59:34 +02:00
gfgtdf
a20f221e83 remove dialogs.cpp
And move its code in other files where it fits better.

This also moves some code from actions.cpp to the new file
advancements.cpp

This also removed a parameter from show_objectives and
menu_handler::objectives that was always gui_->viewing_side()
2016-08-10 16:06:54 +02:00
Celtic Minstrel
f4ac23a3c5 Allow [endlevel] to be used in victory or defeat events 2016-08-08 04:09:32 -04:00
Charles Dang
62f3502cf3 Add std::dec after std::hex when necessary 2016-08-06 09:40:11 +11:00
Jyrki Vesterinen
a74f1054ca Always use underscores in event names
Follow-up of 3cbf249b. This commit changes event names to be written with
underscores everywhere where events are fired (or every place I found in a
quick search, anyway).
2016-08-05 08:43:47 +03:00
Charles Dang
6130c668c4 Use cleaner format for formatter() when possible 2016-08-05 11:58:42 +11:00
Celtic Minstrel
44d171ab58 Include builtin conditions in wesnoth.wml_conditions
This excludes the [true] and [false] ConditionalWML tags,
which are still hard-coded. (People shouldn't be trying to
override or extend these anyway.)
2016-08-02 16:57:46 -04:00
Celtic Minstrel
53828a01b9 New [remove_object] WML tag 2016-08-02 00:52:52 -04:00
Celtic Minstrel
6dab777f66 Accept [effect] in [modify_unit] 2016-08-02 00:01:48 -04:00
Celtic Minstrel
4a668e0ec4 Fix crash on invalid ConditionalWML tag in some contexts 2016-07-30 16:44:17 -04:00
Celtic Minstrel
dc3d22a5e4 Merge pull request #710 from spixi/call_events_by_id
Allow firing an event by id instead of name.
2016-07-30 01:21:12 -04:00
Charles Dang
a1f6884555 Refactor uses of boost::tuple to std::tuple or std::pair as appropriate 2016-07-25 17:26:24 +11: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
Spixi
5588642c81 Allow firing an event by id instead of name. 2016-07-23 12:23:19 +02:00
Celtic Minstrel
a824d88079 Lua API: Make end level data mutable 2016-07-18 20:59:49 -04:00
Celtic Minstrel
be2a613fff Move Lua dispatch shim to top of file 2016-07-18 20:59:49 -04:00
gfgtdf
2825a9d84d add __cfg getter to lua attack userdata 2016-07-16 22:44:50 +02:00
Celtic Minstrel
b145513db3 Fix some issues with fog control
- add_fog removed fog and remove_fog added it
- similarly, [lift_fog] and [clear_fog] were swapped
- make sure first argument is a list of sides before trying to interpret it as one
2016-07-16 10:24:13 -04:00
gfgtdf
ceea75cf0a replace some victory with scenario_end events.
victory is an unsynced event to its potentially unsafe to change the
gamestate in it, this mostly effects LoW (which can be played as a mp
campaign) where i replaced most victory events.

But it also effects sp becasue it can casue bugs to create units in
unsynced events which are used later (here: in later scenarios), so i
replaced also all sp victory events that do that.

Note that the 'scenario_end event'+'proceed_to_next_scenario filter' has
a slightly different meaning than 'victory event': the second gets fired
when there is a local human side who won the scneario while the first
gets fired if there is any human side who on the scenario. In sp this
is the same since there are no remote human sides, but in mp this is the
reason why the first is synced and the second is not.

We could add a seperate event for this case ("before next scenario" or
similar) for easier use, but i didn't find a good name for
that yet.
2016-07-14 22:15:33 +02:00
Celtic Minstrel
c39af95a44 Move name generator and formula API to base Lua kernel 2016-07-12 11:08:33 -04:00
gfgtdf
dd82ed03dc fix comments 2016-07-11 22:33:55 +02:00
gfgtdf
f9d8a9a0ab fix compiler warning 2016-07-11 17:50:16 +02:00
gfgtdf
c8d098087c add support for lua_function= in location filters 2016-07-11 14:54:24 +02:00
gfgtdf
f4253c220a fix side specific variables
this fixes wesnoth.get_side_variable and wesnoth.set_side_variable
2016-07-09 21:42:10 +02:00
gfgtdf
685b69495a fix lua unit.upkeep getter 2016-07-09 21:42:10 +02:00
gfgtdf
bbc32856f1 handle [args] also in [lua] tags outside events. 2016-07-09 21:42:10 +02:00
Charles Dang
240b940618 Fixed [teleport] not working 2016-07-03 04:34:54 +11:00
loonycyborg
5acc945371 Fix -Wunused-variable from gcc 2016-06-19 00:40:24 +03:00
gfgtdf
b1ea08e291 add wesnoth.special_locations 2016-06-18 15:27:06 +02:00
Andreas Löf
a3831fead2 Various fixes to make travis happier
Take out the clag to suppress warnings for lua in clang as it's not needed.
Make cmake builds in travis verbose.
Fix uninitialised variables that clang picks up on in cmake builds.
2016-06-02 22:37:39 +12:00
Celtic Minstrel
1649930113 Lua API for the name generators 2016-04-15 15:51:23 -04:00
Celtic Minstrel
5cf12798ce Port "trivial" WML tags to Lua
This is more about adding Lua API for things that should have it than porting WML tags to Lua.
The following new Lua API functions have been added to the wesnoth table:
- add_fog, remove_fog
- add_sound_source, remove_sound_source, get_sound_source
- log
2016-04-05 02:24:42 -04:00
Celtic Minstrel
ff618e7eb3 Eliminate resources.hpp usage in game_lua_kernel 2016-04-04 22:20:40 -04:00
Celtic Minstrel
38010fd991 Revert "remove unused queued_event parameter from WML_HANDLER_FUNCTION"
This reverts commit 310ba26704.
2016-04-04 15:54:57 -04:00
Charles Dang
0ca4e6c943 Convert uses of boost functional to standard library variants
This commit converts the following function calls:

* boost::bind                          -> std::bind
* boost::function and boost::functionN -> std::function
* boost::ref and boost::cref           -> std::ref and std::cref
* boost::bad_function_call             -> std::bad_function_call

In the process, it was discovered that std::bind has trouble with overloaded
functions. There were two such cases in the code:

* gui2::twindow had an ancient unused overload to draw(). The overload was removed.
* gui2::trepeating_button was binding tdispatcher::fire. This case was converted
  to a lambda.
2016-04-04 02:20:52 +11:00
Celtic Minstrel
cc7c124744 Merge branch 'lua_formula_bridge'
Allows calling WFL code from Lua
2016-04-02 09:38:59 -04:00
Celtic Minstrel
5bb6c30b05 Lua API: Add wesnoth.compile_formula which returns a callable userdata 2016-04-02 09:38:49 -04:00