70814 Commits

Author SHA1 Message Date
Jyrki Vesterinen
fbb0e0229c Improve consistency of WML name validation functions
* moved the new function next to valid_id()
* renamed to valid_tag(), and renamed valid_id() to valid_attribute()
* removed unnecessary parentheses I forgot in
* changed the name of valid_id()'s parameter from "id" to "name"
* changed WML parser to use valid_tag() when it validates tag names

Thanks to @CelticMinstrel who told me about config::valid_id().
2018-01-19 20:27:53 +02:00
Gregory A Lundberg
b5f76eff79
Bump copyright to 2018 2018-01-19 00:02:20 -06:00
josteph
e952cb7c8b UI: Colorize the 'damage versus' tooltip and align the unit names. 2018-01-19 14:33:12 +11:00
Charles Dang
fa6df6d664 Core: wmlindent run
[ci skip]
2018-01-19 12:34:36 +11:00
Charles Dang
e938ac4147 EI S17: fixed incorrect type_tree key (should be type_adv_tree)
[ci skip]

Former was the old name before it was renamed to the latter.
2018-01-19 12:29:57 +11:00
Charles Dang
ae8f554e58 Campaigns: wmllint run
[ci skip]
2018-01-19 12:24:50 +11:00
Charles Dang
ca7e3c126d Campaigns: wmlindent run
[ci skip]
2018-01-19 12:20:04 +11:00
Charles Dang
10561d3e53 Remove empty [on_redo] action
This was introduced this development cycle (1.13) in 2015 (commit 6010455f563f4b16bb89f2df6893908a36251cdc)
and removed in 33c2e6aa67c9377f170f9302204a8de10c200564. Presumably the action was left for backwards
compatibility, but we do not guarantee backwards compatibility for changes that never made it to a stable
release.
2018-01-19 12:13:42 +11:00
doofus-01
48fa7d9461 remove specific mention of horses 2018-01-19 10:28:38 +11:00
doofus-01
c669a75e67 touch-up archer sprites 2018-01-19 10:28:38 +11:00
doofus-01
b5b1539143 base sprites for Quenoth scouts 2018-01-19 10:28:38 +11:00
V N
5209271db3 Lua: add variables metatable
The implementation differs from already-existing
wml.variable.proxy in that it does not try to proxy table sub-fields,
and is fast & simple.

Example usage:
wml.variables.test = 123
print(wml.variables.test)
2018-01-19 09:53:06 +11:00
Charles Dang
ba8aa80af8 Used a deque instead of a vector for active event handlers
Since events can be added and removed constantly, this should be more performance-friendly than
a vector since it avoids reallocations. Though, since this container only holds shared_ptrs instead
of the objects themselves, it probably doesn't make that much difference right now, but I might
switch to object-direct storage in the future. Not sure.
2018-01-18 20:48:52 +11:00
Jyrki Vesterinen
7aa39dc451 Go back to std::isalnum()
It turned out that it works fine as long as it's called with a char
rather than unsigned char. (But to add to the confusion, the other
variant of the function in <cctype> *requires* that cast.)
2018-01-18 10:05:24 +02:00
Jyrki Vesterinen
19e17e9417 Replace std::isalnum() with a hand-rolled implementation
The function seems to just throw std::bad_cast() in libstdc++ and libc++.
Fortunately it's very easy to write our own implementation instead.

Thanks to @Pentarctagon for the stack trace.
2018-01-18 09:41:57 +02:00
Richard Kettering
b969940ba4 Added frames for a ne stalwart attack. 2018-01-17 23:03:00 -06:00
Charles Dang
b8703b4527 MP Create Game: fix game load functionality being broken (fixes #2340)
Regression from 175e64cfaa0a18c85b5387d4464256b6c8cdf1cf.
2018-01-18 13:15:17 +11:00
Jyrki Vesterinen
52e3772c86 Lua API: reject invalid WML tag names (#2375)
Tags that the WML parser rejects shouldn't be possible to create with Lua,
either. This ensures that a UMC author can't accidentally, or deliberately,
inject such tags into the game state and make saving the game impossible.

Fixes #2375.
2018-01-17 23:52:34 +02:00
Jyrki Vesterinen
1386e3945c Added unit tests about which WML tag names Lua API accepts 2018-01-17 23:23:13 +02:00
Jyrki Vesterinen
3bc36efa58 Refuse to save if game state can't be represented as valid WML (#2375)
Such a save file can't be loaded anyway.
This way, at least the player can't overwrite an existing, working save
with one that cannot be loaded.
2018-01-17 21:05:44 +02:00
Alexander van Gessel
5df406869a
Clarify lifetime of defines maps
Wrap the bare pointer in a unique_ptr and move it into the sink.
2018-01-16 22:58:46 +01:00
Alexander van Gessel
f453f1422b
Indicate ownership transfer using unique_ptr argument
Best practice according to GotW #91.
https://herbsutter.com/2013/06/05/gotw-91-solution-smart-pointer-parameters/
2018-01-16 13:37:01 +01:00
Alexander van Gessel
65dd884b50
Store pointers in unique_ptr 2018-01-16 11:32:17 +01:00
Gregory A Lundberg
bbdb5ad86a
Fix control reaches end of non-void function
This only compiles on MS Visual C++ version 12.0, or earlier (Visual Studio 2013, or earlier).
2018-01-13 11:20:43 -06:00
Gregory A Lundberg
312af6064f
Remove incorrect noexcept clause
Do not mark a function as not throwing exceptions when it plainly does.
2018-01-13 10:36:00 -06:00
newfrenchy83
ceec498904 Update changelog (#2361)
(updated by ai0867)
2018-01-13 10:46:34 -05:00
Jyrki Vesterinen
8731930402 Fix: canceling attempt to reconnect didn't close addon manager
Only happened if the player used the buttons in the addon list: the buttons
in the right panel worked fine. The problem was that the addon list caught
the addons_client::user_exit exception separately and didn't rethrow it
when necessary, unlike the addon manager itself.

I decided to simply throw a different exception instead.
2018-01-13 14:59:58 +02:00
Jyrki Vesterinen
735c054bd3 Don't reconnect to server when the player cancels connecting to server
Requested by @loonycyborg.
2018-01-13 14:59:58 +02:00
Jyrki Vesterinen
c9ec111cf1 Addon client: close connection if the player cancels the download
This ensures that the game won't interpret the rest of the addon as a
response for the client's next request.

Fixes #2203.
2018-01-13 14:59:58 +02:00
Gunter Labes
03b6ad568c
Continue if there is an old executable
Chances are that the previous build works just as well.
We just need it for config file parsing which does not change often.
2018-01-12 19:14:41 +01:00
Sergey Popov
ed6ad71f48
Merge pull request #2329 from GregoryLundberg/GL_I2327
Implement MP Moderation
2018-01-12 17:50:19 +03:00
Charles Dang
8ae99bc86a Added some event unit tests by @Pentarctagon
Tests event execution order and events with variable names.
2018-01-11 13:12:28 -05:00
Charles Dang
88b0fe5953 Further reworking of event iteration interface
Fixes #2312. Turns out constructing a list of matching handlers breaks some undocumented
behavior, namely events being executed in the order they're added (usually the order in
which they appear in the WML). It also broke certain variable substitution by moving variable
interpolation wholly before any event execution, as opposed to between each event.

This commit implements an even simpler method: simply iterating through every registered
handler in order, checking for a name match on each one, and if it passes, immediately
executing the provided function. Cleanup will only occur once the toplevel call to
execute_on_events is completed.

This commit also removes the immediately cleanup upon removing a handler. This should
ensure (I didn't test explicitly, but from other incidental issues I'm sure this is the
case) the size of the main vector doesn't change during iteration.

I also changed the pre-add standardization code to only affect event names without variables.
Variable names are standardized later after variable substitution.
2018-01-11 13:12:28 -05:00
Gregory A Lundberg
395f8fac78
Fix doccomment 2018-01-10 18:02:44 -06:00
Jyrki Vesterinen
a65596e5b5 Fixed: label editor could create empty undoable action chain (#2306)
Empty action chains are not allowed, attempting to partially undo an empty
chain causes a fatal error.

This commit fixes some of the breakage reported in #2306, but not all.
2018-01-09 20:27:05 +02:00
Allefant
4de5cdc7d3 update the addon manager for "simple WML" 2018-01-09 09:23:50 +01:00
Gunter Labes
7cdec04c7f
only keep env vars upper case, add missing quotes 2018-01-09 02:06:04 +01:00
Gunter Labes
a535a3140c
Use a more generic default value 2018-01-08 23:36:10 +01:00
Celtic Minstrel
b069bdd16e
fixup a4e7cb01e81962ab313884ba9df6ecc35ebbe4a3 2018-01-07 23:12:46 -05:00
Gunter Labes
15059ec10c Revert network protocol change from 002b1a3c87
Best to keep compatible and also not introduce yet another format for
the userlist.
2018-01-08 02:04:16 +01:00
Gunter Labes
3fa5272737 Avoid useless user list sending 2018-01-08 02:04:04 +01:00
Jyrki Vesterinen
2288098cba Ensure that probability to be touched isn't negative
Should fix #2342. I can't verify the fix because it doesn't occur with
Visual Studio builds.
2018-01-07 20:41:56 +02:00
ln-zookeeper
80829106c1 AOI: New story art by Bhoren
I chose 2560x1440 as the size over 1920x1080 simply because when I tried both sizes at compression levels that produced a similar quality result, the difference in filesize was negligible.
2018-01-07 13:31:43 +02:00
pentarctagon
a4e7cb01e8 Fix formatting of invalid characters for #2043. 2018-01-06 17:18:24 -06:00
Gregory A Lundberg
44ed26dd00
Fix crash to desktop on no addons
If campaignd reports no addons, do not crash to desktop. Instead, go ahead and display the empty list.

Closes #2355
2018-01-04 11:39:01 -06:00
Gregory A Lundberg
fbc0a142b0
Send handshake in network byte order
The handshake value is 42. The server sends this on startup in response to a zero-length document.

Yes, that means the server replies with The Answer to The Ultimate Question of Life, the Universe, and Everything. It is unspecified whether the client properly interprets The Answer.
2018-01-03 20:09:55 -06:00
Gregory A Lundberg
5426c884dd
Persist bans
The bans were not being immediately written to the file when created or removed.

Note that the file is overwritten directly rather than saved to a temporary and moved into place. This creates a race condition: a crash while writing corrupts the file.
2018-01-03 19:53:11 -06:00
Gregory A Lundberg
ef0c3b615d
Implement kickban
Added the missing call to actually ban the IP before kicking the player.
2018-01-03 19:53:11 -06:00
Gregory A Lundberg
d9f9d83a6b
Stop hanging when banned
When a banned or connection-limited client attempts to log in, it hangs.

This is because the client does not understand that the server did not finish the handshake. This moves the check to a point just after the handshake has completed (when the server would normally ask for a version number). The client never checked for errors, so added a check.
2018-01-03 19:53:11 -06:00
Gregory A Lundberg
66f740840e
Implement max connections
The function was lost. Recovered from Git hitsory and cleaned up a bit.
2018-01-03 19:53:11 -06:00