Commit graph

462 commits

Author SHA1 Message Date
Celtic Minstrel
6000d644d8 Add a second version of luaW_type_error
This can make some Lua error messages more helpful.
Unfortunately it's rather difficult to deploy, as most
calls to luaW_type_error are within "check" functions,
where the info needed for the new version is unknown.
2017-05-10 17:40:12 -04:00
Celtic Minstrel
04670c313b Some additions to wesnoth.simulate_combat output 2017-05-07 12:47:53 -04:00
Celtic Minstrel
a5bd278cf2 fixup! Move wesnoth.get_time_stamp and wesnoth.get_image_size to lua_kernel_base 2017-05-05 17:56:53 -04:00
Celtic Minstrel
3bbb83357e Move wesnoth.get_time_stamp and wesnoth.get_image_size to lua_kernel_base 2017-05-05 15:24:56 -04:00
Charles Dang
e4f03fe459 Moved all preferences source files into a single folder 2017-05-04 11:04:19 +11:00
Charles Dang
e0f3ce428d Cleaned up unnecessary uses of get()->
This applies both to uses of smart pointers and the SDL_Surface wrapper (surface).
2017-04-30 23:47:34 +11:00
gfgtdf
12f9215da2 deployed some range for loops on gameboard::teams() (#1007)
deployed some range for loops on gameboard::teams()
2017-04-29 16:08:45 +02:00
Celtic Minstrel
5b4dbe1c61 Port [volume] to Lua
This also fixes [volume] considering 100% to be an invalid volume.
2017-04-27 17:09:05 -04:00
Celtic Minstrel
6906ced4e7 Properly port [music] to Lua 2017-04-27 17:09:03 -04:00
Celtic Minstrel
0a591cd424 Properly port [scroll] to Lua 2017-04-27 17:05:53 -04:00
Celtic Minstrel
339587ee2b Properly port [kill] to Lua 2017-04-27 16:55:38 -04:00
Charles Dang
5d6a37f990 Even more deployment of display_context::get_team 2017-04-26 10:23:19 +11:00
Charles Dang
af3a7a7734 Cleaned up remaining usecases of teams()
* Cleaned up a few ternary cases (avoid ternary syntax in operator[])
* Made game_lua_kernel::board public so a helper function could use it to access get_team()
* Fixes up 8320dd3
2017-04-26 09:25:59 +11:00
Charles Dang
8320dd349e This was supposed to be with 06199650e
[ci skip]
2017-04-26 05:14:50 +11:00
Charles Dang
921bbc2d7d Forward get_team call to a display_context derivative when necessary 2017-04-26 03:00:10 +11:00
Charles Dang
0031f9a45a Don't copy-initialize containers 2017-04-25 04:30:49 +11:00
Celtic Minstrel
66f4c2ba3d Add WML tag to change the map zoom level 2017-04-24 12:04:23 -04:00
Celtic Minstrel
1fb4d36ef8 Enable scenarios to change theme in an event 2017-04-24 11:01:12 -04: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
Charles Dang
323516d3d8 Avoid copy initialization of arrays (use direct instead) 2017-04-21 03:10:07 +11:00
Charles Dang
9f5d312bfe Fixup 8923978 2017-04-20 08:05:36 +11:00
Celtic Minstrel
8923978c70 Squash some MSVC warnings 2017-04-19 04:08:10 -04:00
Charles Dang
6addb2e12f Cleaned up some comments and an include related to intrusive_ptr
The include in attack_type is no longer needed since I changed its management to use shared_ptrs
2017-04-15 15:34:36 +11:00
gfgtdf
e4926328f9 use std::scoped_ptr where appropriate 1 2017-04-14 13:48:35 +02:00
Celtic Minstrel
fcc0da5bd4 Some cleanup of attack_type usage for enable_shared_from_this safety
- Call shared_from_this() instead of taking the address
- Don't use raw pointers to attack_type
- Change some cases of attack_type objects that weren't owned by a shared_ptr
  (either owned by another object or allocated directly on the stack)

List of files that currently call attack_type constructors:
- game_events/conditional_wml.cpp
- gui/dialogs/unit_attack.cpp
- scripting/lua_unit_attacks.cpp
- units/types.cpp
- units/unit.cpp

Each of these has been individually considered and made safe for use with
enable_shared_from_this. (Most of them already were safe.)
2017-04-11 17:15:38 -04:00
Charles Dang
0c3260dc05 Finished deploying std::map::emplace (cont. e1a579da51)
Apparently, the last time I did this I only grepped for `insert(std::pair` not `insert(std::make_pair`. Oversight, much?
2017-04-12 07:51:42 +11:00
Celtic Minstrel
7835e05d93 Fix [animate_unit][facing] not working.
This also tweaks the animator:add() API, replacing the facing key
with a target key and requiring it to be an adjacent location.
2017-04-09 01:29:10 -04:00
Celtic Minstrel
ac6a62046e Add wesnoth.log_replay which adds stuff to the saved game in [upload_log] 2017-04-08 20:20:31 -04:00
Celtic Minstrel
e78f499a1c Fix [animate_unit]text= rejecting translatable strings (GNA25625) 2017-03-26 11:15:12 +11:00
gfgtdf
cbd3c2644c add lua end_music setter/getter
this also refactors some play_controller members and moves them
to game_data

this also adds a scenario_id getter in lua.
2017-03-23 18:08:16 +01:00
Celtic Minstrel
16df1f3c43 wesnoth.create_animator: Set standing right after animation completed rather than at finalization 2017-03-23 12:44:28 -04:00
Celtic Minstrel
c3e0ce4745 Fixup wesnoth.get_end_level_data 2017-03-23 12:43:25 -04:00
gfgtdf
bd6a0c69d1 replace wesnoth.set_next_scenario() with wesnoth.game_config.next_scenario setter/getter 2017-03-20 02:48:03 +01:00
Celtic Minstrel
b4dc11ce36 Belated 2017 copyright update 2017-03-19 10:05:38 -04:00
Celtic Minstrel
f0c127915b Allow wesnoth.select_unit() to deselect the unit
Since @vultraz recently decided to remove this feature from wesnoth.deselect_hex.
2017-03-18 17:35:51 +11:00
Charles Dang
0becb66a8c Don't call select_hex when deselecting a hex (fixes bug #24712) 2017-03-14 12:36:35 +11:00
Celtic Minstrel
2069449805 Fix inverted condition in Lua shroud op API 2017-03-10 18:09:39 -05:00
Celtic Minstrel
2a498070f7 fixup 6de1c9441f 2017-03-10 01:16:33 -05:00
Celtic Minstrel
6de1c9441f Fix some [modify_ai] isses (addresses GNA25558)
As far as I can tell, the most likely cause of the bug was that several
cases of [modify_ai]action=add were called with a path that lacked the final
empty braces at the end of the path.

This commit makes both the tag and the underlying Lua API calls explicitly
handle this case as if the final empty braces were, in fact, present.
2017-03-10 00:12:11 -05:00
Celtic Minstrel
9d6b0b2213 Fix another index typo in [animate_unit] 2017-02-28 18:51:24 -05:00
Celtic Minstrel
d6b5f8428a Fix popping one value too many in [animate_unit] 2017-02-28 17:47:41 -05:00
Celtic Minstrel
ee79eb426e Fix some invalid Lua stack accesses in [animate_unit] 2017-02-28 16:26:22 -05:00
Charles Dang
d0837b5d9e Fixup c58e2d00 (backwards logic) 2017-02-28 16:26:31 +11:00
Charles Dang
f81392893d Attempt to fix some errors reported by @singalen 2017-02-27 18:52:10 +11:00
Celtic Minstrel
8822dacd92 Merge branch 'wml_tag_porting' 2017-02-26 19:32:44 -05:00
ln-zookeeper
45c81b3569 Removed deprecation warning of [print] red,green,blue=
Because there isn't any difficulty in supporting both.
2016-12-31 21:31:42 +02:00
Charles Dang
e22c8967ee Cleaned up global.hpp includes 2016-12-17 15:21:04 +11:00
Celtic Minstrel
9802de9813 fixup! Properly port [modify_side] to Lua 2016-12-12 13:49:19 -05:00
Celtic Minstrel
010acd870d Properly port [animate_unit] to Lua 2016-12-11 18:08:08 -05:00
Celtic Minstrel
c58e2d0095 wesnoth.scroll_to_tile can now skip if onscreen 2016-12-11 18:07:46 -05:00