Commit graph

462 commits

Author SHA1 Message Date
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
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
Celtic Minstrel
fe818f8005 Add Lua API function to set the current time of day 2016-04-02 09:38:34 -04:00
Celtic Minstrel
ca382018b7 BOOST_FOREACH -> range for 2016-04-02 09:38:29 -04:00
Celtic Minstrel
982394fe3a Remove custom FOREACH macro in favour of range-for 2016-04-01 12:08:05 -04:00
Charles Dang
a0a8836bbe Used to_string() method instead of enum::enum_to_string() when possible 2016-04-01 02:41:17 +11:00
Celtic Minstrel
fb6031d6a1 lua_function= in SUF now has limited support for non-global functions
To be precise, the string is considered as a dot-separated list of components.
2016-03-31 02:13:40 -04:00
Celtic Minstrel
4c45683d4d Modernize luaW_getglobal
The variadic form now uses a variadic template, and a vector form has been added.
Since the nullptr sentinel argument is no longer required, it has been removed from all calls.
2016-03-31 02:13:39 -04:00
Celtic Minstrel
86b4680371 Use vector/templating for Lua-like bulk registration functions 2016-03-31 02:13:38 -04:00
Celtic Minstrel
3ac7f8d970 NULL -> nullptr
A few cases of NULL were missed, since changing them led to errors
(Mainly instances where it was passed to a boost::function)
2016-03-31 00:42:38 -04:00
Charles Dang
cf6fa69d27 Removed C++11 include guards
This also expands the OVERRIDE compatibility macro (FINAL was not used).
2016-03-31 12:06:35 +11:00
Charles Dang
876710af8c Use std::to_string() or equivalent wherever possible
This commit removes the utility srt_cast() function and replaces its calls,
along with calls to lexical_cast<std::string>() (and its boost variant),
with std::to_string().

In a few cases where the input type isn't compatible with to_string,
lexical_cast<std::string> is still used.

In other cases where lexical_cast was operating on MAKE_ENUM enums, the
call has been replaced with ENUM::enum_to_string, which is faster.
2016-03-31 11:18:51 +11:00
Celtic Minstrel
64892b8c81 Align formula and Lua views of unit types
- New key in both - race
2016-03-30 02:15:21 -04:00
Celtic Minstrel
02cfb7c279 Update/correct RN and changelog 2016-03-27 15:13:23 -04:00