21 Commits

Author SHA1 Message Date
Pentarctagon
a5e7986b3e Updates for newer luacheck. 2022-08-06 03:03:17 -05:00
Celtic Minstrel
1dccc3ad76 Update mainline content to use the mathx module 2021-05-08 17:20:49 -04:00
Celtic Minstrel
9d3bf196b0 Update everything to use the new wesnoth.map module
- get_terrain and set_terrain replaced with direct indexing operations
- get_map_size mostly replaced with either the iterator or an on_board call.
  Only a few cases really needed to know the size of the map for some other purpose.
- shroud and fog operations, village owner, time areas, and location filters
- get_terrain_info replaced with terrain_types table
- Map generation functions create_map and create_filter
2021-02-28 18:16:33 -05:00
Celtic Minstrel
a0ee38a49a
Use to-be-closed variables to scope WML variables in tag definitions (#5536) 2021-02-15 21:11:56 -05:00
Celtic Minstrel
651090cf47 Fix erroneous deprecation warnings from [random_placement] 2020-12-20 15:17:26 -05:00
Celtic Minstrel
732b7942bb Replace all references to deprecated functions in the helper module
(and remove the require if this meant it was no longer used)
2019-12-02 01:10:34 -05:00
Celtic Minstrel
9d8d57b16d Fix WFL in [random_placement] not receiving the size variable 2019-03-03 11:56:34 -05:00
Celtic Minstrel
c4f2e839ab
Fix [random_placement] executing the code for each element twice (fixes #3663) 2018-10-27 13:56:42 -04:00
Celtic Minstrel
ab36d7b600 Support [break], [continue], and [return] in [random_placement]
(cherry-picked from commit 4a3508f13fea69b5cafdfa2d46a99caec201d6e5)
2018-10-07 03:21:22 +00:00
mattsc
0e017d9f7c Lua code: replace deprecated wesnoth.set_variable() calls
(cherry-picked from commit ce7faae4f41f23f1d1f61d2b4f5ca95d4ce4f89a)
2018-10-07 03:21:07 +00:00
Celtic Minstrel
d72612443f Allow percentages in [random_placement]num_items=
(cherry-picked from commit 229d2f04831fc75a154b5b718c7d308fb3d81217)
2018-10-07 03:18:19 +00:00
Celtic Minstrel
0131631220 Allow WFL for [random_placement]num_items=
(cherry-picked from commit e4a2c141776124c4e0b16677265c4623a4a02aad)
2018-10-07 03:18:18 +00:00
Charles Dang
0103959c36 Cleaned up deprecated API usage in core Lua
[ci skip]
2018-03-13 16:55:36 +11:00
vgaming
728204665c fix code problems found by luacheck (#2388)
fix code problems found by luacheck

Second iteration of the process, now handling data/lua/wml/*.lua

luacheck command used to find bugs:
  luacheck ./*.lua --globals wesnoth wml --codes --ignore 542 213
Additionally, error code 211 (unused variables) could be ignored,
as using underscore convention `_` is controversial in
wesnoth ( see https://github.com/wesnoth/wesnoth/pull/2380#discussion_r162519341 )

Actual bugs found:
* items.lua, access of global `write_name` instead of local `cfg.write_name`
* kill.lua, typo `primary_unit` -> `primary`
* bad code style: global `i` instead of local `i`
  (would conflict with 3-rd party code if it would use global `i`, too)
2018-01-23 13:35:04 -06:00
Celtic Minstrel
6efc5ae090 Replace helper.distance_between -> wesnoth.map.distance_between (fixes #1686) 2017-05-11 04:14:03 -04:00
Celtic Minstrel
8d4cf3cf62 Shorten requires where possible 2017-05-03 02:42:25 -04:00
gfgtdf
a53090d648 wml cleanups, add terrain= attribute to [random_placement] loc
replacing some [while] with [repeat] or [random_placement]

Adding  terrain= attribute to the variable generated by [random_placement] this mkaes it easier to use [random_placement] as a replacement for [store_locations] + [while] since [store_locations] also generates the [terrain] attribute:
2016-12-10 14:07:13 +01:00
Gregory A Lundberg
fc6774289e Upgrade deprecated Lua
loadstring was removed, load does the same thing.
atan2 was remvoed, atan works instead
2016-10-17 10:34:43 -05:00
gfgtdf
5de1d9b046 optimise [random_placement]
the cases distance=0 and distance = -1 now dont loop thougth all
possible locations anymore when removing a used location.
2016-05-20 14:42:49 +02:00
Celtic Minstrel
d3374d3670 WML tags fixup 2016-04-04 20:10:52 -04:00
Celtic Minstrel
a791909544 Split the more complicated WML tags into separate Lua files 2016-04-04 17:03:38 -04:00