Since wmllint gets confused if a side's contained [ai] block comes after any of its contained [unit] blocks. This refactor should make the side 2 code block more human readable too.
This version uses SDL_GetTicks() as a monotonic source to avoid the
previous version's pitfalls, namely the fact that the game's framerate
may not necessarily be a constant, and in particular, the old code
assumed a completely different framerate than what we ended up with
after the texture-based rendering changes in 1.17.x, resulting in an
almost-unnoticeable text fade due to the update() function being
called WAY more often than before.
Note that the reliance on SDL_GetTicks() means the timings break
at some point after 49 days of game runtime, exactly once. This
should result in a visible "jitter" effect if the 32-bits ticks value
wraps around in the middle of a fade sequence, but other than that
it's not that big of a deal to warrant requiring SDL 2.0.18+ for the
64-bit version.
I for one hope players wouldn't be running Wesnoth for that long
anyway. The game isn't exciting enough to justify it.
The logic is that the strings included the names of WML tags, but
weren't clear that they were WML tags, and so the tag names are
being translated.
This reverts almost all of the string changes of PR #7600, which
were in commit f5be4cffb7, as well
as a few similar strings which weren't in 1.16.x.
static variables are only initialized the first time they are encountered, even if they are only defined in the body of the method. therefore their value here is set to the first language used when this method is called, but won't change later if the language changes because they've already been initialized.
Fixes#8393
(cherry picked from commit ef972bb0a0)
These functions are not used anywhere, and they have other issues besides the one fixed in this commit – they're implied to return all moves, but they only return one move for each possibly destination hex. However, this will make them at least be minimally usable.
Since the detection happens after loading the config tree, it is necessary to expose the links and subtypes of the types alias and composite, respectively.
This implementation builds a graph of all links to detect cycles, ignoring all other types.
To handle links in elements of lists, all subtypes of composite types are visited, keeping the type name of the parent composite type.
Signed-off-by: Rafael Fillipe Silva <rfsc.mori@gmail.com>
This pattern presents the same infinite loop issue as the find_key and find_tag calls on wml_tag. The solution is the same, to use a helper to keep track of the already seen tags and stop when a cycle is detected.
Note that this is only detected if the tag referencing the missing super is used in a .cfg file. The super element itself doesn't need to be used for the detection to work.
The schema self validator should already catch this, but it deserves a warning of its own as the schema self validator can be disabled.
Note that if the .cfg file does not use the tags that causes a cycle, those won't be detected.
This change exposes the super_refs_ so the schema validator does not need to reinvent wml_tag::expand when detecting super cycles.
The super dependency graph is built during the validation of each tag, finishing and reporting cycles at the end of the root tag.
Adds a test with a schema example containing a super cycle and a .cfg file containing an unknown key to this schema. Previously, this would cause an infinite loop or crash. Now an exception for invalid key should be thrown.
A super cycle may be found during the validation, leading to an infinite loop. For example, calling find_key on an unknown key defined in the .cfg file may trigger this behavior if a cycle exists.
To handle this, a new version of these functions was introduced, keeping the original in the class' private scope. During the search there is a bookkeeping helper that will cause the routine to return nullptr if the search goes back to the initial tag context.