* 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().
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.
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)
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.
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.)
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.
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.
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.
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.
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.
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.
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.
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.
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.