64038 Commits

Author SHA1 Message Date
Celtic Minstrel
b53ee994c9 Formula engine: now exponentiation returns null on NaN 2016-03-18 00:30:33 -04:00
Celtic Minstrel
6da744a37a Formula engine: add empty map literal 2016-03-18 00:29:39 -04:00
Celtic Minstrel
de4186c47b Formula engine: add type() function 2016-03-18 00:29:18 -04:00
Celtic Minstrel
4a3fce393a Formula engine: fix index operator having lowest precedence
It now has the highest precedence
2016-03-17 23:27:23 -04:00
Celtic Minstrel
a4469210d4 Formula engine: fix exponentiation being left-associative 2016-03-17 23:27:22 -04:00
Celtic Minstrel
0b84677ee9 Formula engine: Lists can be indexed with negative numbers
(this counts from the end)
2016-03-17 23:27:22 -04:00
Celtic Minstrel
38f6e8c4f1 Formula engine: Add string escapes mechanism
This builds on the string substitution syntax:
- [(] means an open bracket
- [)] means a close bracket
- ['] means a single quote / apostrophe

The tokenizer is now aware of string substitutions, making this possible
as well as the nesting of strings within string substitutions.
2016-03-17 23:27:21 -04:00
Celtic Minstrel
b239dd5fd1 Formula engine: New string functions find_string and replace 2016-03-17 23:27:20 -04:00
Celtic Minstrel
bb0d00f348 Formula engine: Fix rounding issues with math functions 2016-03-17 23:27:20 -04:00
Celtic Minstrel
6aed979113 Reformat the formula function classes 2016-03-17 23:27:19 -04:00
Celtic Minstrel
a40ffc0351 Formula engine: Catch cases of NaN resulting from math functions
They are now converted to null.
2016-03-17 23:27:18 -04:00
Celtic Minstrel
523154f807 Formula engine: Add several more math functions 2016-03-17 23:27:17 -04:00
Celtic Minstrel
f32b51b022 Formula engine: Add root functions 2016-03-17 23:27:16 -04:00
Celtic Minstrel
c589298e0f Formula engine: Add inverse trig functions 2016-03-17 23:27:15 -04:00
Celtic Minstrel
1cf9f616ec Formula engine: Substring function now accepts negative size
This results in counting backwards from the given offset.
Size of 1 and -1 have the same effect.
2016-03-17 23:27:15 -04:00
Celtic Minstrel
159dbcf28e Formula engine: New take_while function
Returns all elements up to the first one failing the condition
2016-03-17 23:27:14 -04:00
Celtic Minstrel
390baf7d11 Formula engine: New function to zip a list of lists 2016-03-17 23:27:13 -04:00
Celtic Minstrel
2637f23afd Formula engine: New function to reverse a string 2016-03-17 23:27:12 -04:00
Celtic Minstrel
59dd9cc6af Formula engine: Add optional base argument to reduce() 2016-03-17 23:27:12 -04:00
Celtic Minstrel
c1ca72f1dc Formula engine: fix abs() and modulus not working on decimals 2016-03-17 23:27:11 -04:00
Celtic Minstrel
fe05f51c9e Formula engine: Fix decimal values not being convertible to integers 2016-03-17 23:27:11 -04:00
Celtic Minstrel
4aa725ac29 Formula engine: When possible, use synced RNG for the dice roll operator 2016-03-17 23:27:10 -04:00
Celtic Minstrel
ad6528d13c Formula engine: Support function definitions everywhere
This constructs a temporary function symbol table (lasting only the duration of the formula)
if no symbol table was passed to the formula at construction time.
2016-03-17 23:27:09 -04:00
Celtic Minstrel
6490b535a3 Tweak output of formula evaluation command prompt 2016-03-17 23:27:08 -04:00
Celtic Minstrel
1c9eb0cdbb Formula engine: add tan and tail functions, extra argument to head function 2016-03-17 23:27:08 -04:00
Celtic Minstrel
e4b944d83b Make variant iterator bidirectional and stdlib compatible 2016-03-17 23:27:07 -04:00
Celtic Minstrel
279ced9b55 Formula engine: allow lists to be indexed by a list
This produces a slice of the original list
2016-03-17 23:27:06 -04:00
Celtic Minstrel
0674f2a844 Formula engine: support wfl/wflend instead of fai/faiend 2016-03-17 23:27:06 -04:00
Celtic Minstrel
1ae426c51c Formula engine: new concatenate and range operators
str .. str = concatenation
list .. list = concatenation
int ~ int = range (as a list)
2016-03-17 23:27:05 -04:00
Celtic Minstrel
03bbc79367 Formula engine: change undocumented string substitution syntax
It used to use {}, which gets caught by the preprocessor.
Now it uses [] instead.
2016-03-17 23:27:04 -04:00
Celtic Minstrel
240b5f61a7 Output formula errors in unit filters to WML error stream
(And consider them to match no units)
2016-03-17 23:27:03 -04:00
Celtic Minstrel
26a2638f2c Make the formula and Lua views of a unit coincide more closely
Several keys were either missing or misnamed in the formula view.
These have been changed to match the Lua and WML names for the keys.
This affects canrecruit, moves, and max_moves, as well as status.

In addition, a large number of keys were missing entirely from the formula view.
Most of these keys have now been added and can be accessed from formulas.
A few that have little use in filters (such as image_mods or profile) are still missing.

The Lua view missed a few keys that the formula view did provide.
Although these could in principle have been obtained by using the special __cfg key,
they have now been added to the Lua view anyway.
2016-03-17 23:27:03 -04:00
Celtic Minstrel
f02a038879 Fix wesnoth.erase_unit for recall units 2016-03-17 22:41:05 -04:00
Charles Dang
8b2ba647d1 Slight contrast bump to Wooden Bridges (regular and rotten) 2016-03-18 10:09:33 +11:00
ln-zookeeper
541dbb95c9 Fixed Clean Gray Cobbles drawing transitions on itself 2016-03-18 00:30:02 +02:00
ln-zookeeper
4e6a4e8aad Cleaned up off-hex stray pixels 2016-03-18 00:02:39 +02:00
Charles Dang
80823d7987 Enable formula debugger in debug mode 2016-03-18 05:21:13 +11:00
Charles Dang
0a8247d837 Forward-declare a variant header include 2016-03-17 23:19:21 +11:00
Charles Dang
e8dd50aa8c tformula_debugger: use verbatim scroll labels 2016-03-17 23:18:08 +11:00
Charles Dang
86261779f2 tscroll_label: update to verbatim style (matches description now) 2016-03-17 23:17:44 +11:00
Elvish_Hunter
256dd1e3da Ported hexometer for Bash to Python3 2016-03-17 11:19:04 +01:00
ln-zookeeper
8c2fd342e4 Cleaned up off-hex stray pixels 2016-03-17 01:16:55 +02:00
Celtic Minstrel
92ab82fc8e Update changelog 2016-03-16 17:53:00 -04:00
Charles Dang
999acb187f tlobby_main: more design tweaks 2016-03-17 08:39:40 +11:00
Celtic Minstrel
d94c73a972 GUI: Fix tooltips occasionally getting cut off on the right 2016-03-16 16:50:29 -04:00
Charles Dang
32c9378992 tlobby_main: design improvements 2016-03-17 07:18:24 +11:00
Charles Dang
8c4dfc5d69 Design tweaks to description scroll label 2016-03-17 07:18:23 +11:00
Celtic Minstrel
df7cdba42c Merge pull request #628 from CelticMinstrel/lua_map_locations
Several location-related Lua things
2016-03-16 15:50:12 -04:00
Celtic Minstrel
268620e2ca GUI: Simplify WML message dialog formulas
Now with 99% less WML macros inserted into the formula.
This makes it easier to read and possibly even more efficient.
2016-03-16 15:47:00 -04:00
Celtic Minstrel
afcb382009 Replace Lua map_location helpers with new luaW functions
This does change the interface and return values of several functions.
However, these functions were undocumented, so this shoud not be a problem.
2016-03-16 12:51:34 -04:00