Mainly since it's particularly non-obvious why it currently works for `generic_decode_be()` in the case when `in.find_last_not_of("=")` doesn't find anything:
* It returns npos, which is the max value of an std::size_t
* this turns into -1 when assigned to an int
* -1 + 1 equals 0
* 0 * 8 / 6 is still 0
* `reserve(0)` is pointless, but at least valid
This is not a behavior change because it already returns nothing after it does all its work if `out.size()` doesn't equal 0 in this case.
And for `generic_decode_le()` in the case when `in.find_last_not_of("=")` doesn't find anything:
* It returns npos, which is the max value of an std::size_t
* this turns into -1 when assigned to an int
* -1 * 8 / 6 is -0.75, which truncates to 0 because this is integer division
* `reserve(0)` is pointless, but at least valid
This is not a behavior change since the for-loop starts i at 0 and then checks that `i <= last_char`, however last_char is -1 so the loop is just skipped.
This unifies both the Version and the Language menu labels into a
single method for both that is called both during construction and
after switching languages. Both have this issue where they aren't
t_string instances, so changing languages has no effect on them for
that reason and they need to be manually re-translated.
Instead of SDL_WINDOWEVENT_RESIZED.
The documentation is a bit unclear, but SDL_WINDOWEVENT_RESIZED seems
not to trigger under certain circumstances, specifically when changing
resolution via SDL_SetWindowSize(); SDL_WINDOWEVENT_SIZE_CHANGED
meanwhile is implied to trigger any time the window size changes
whether it's from an API call, or the operating system, or a user
action.
<https://wiki.libsdl.org/SDL2/SDL_WindowEventID>
We need to translate at least one of these events into a GUI2 event in
order for dialogs to be properly re-laid out after the window size
changes, but we should not handle both because that could result in
unnecessary work recalculating all dialog layouts.
Closes#7436.
This adds support for having up to 28 distinct sub-achievements within a single achievement. This limit exists since wesnoth's layout isn't smart enough to tell a horizontal listbox to actually use its scrollbar instead of forcing a horizontal scrollbar on the whole window.
Additionally this adds the [set_sub_achievement] and [has_sub_achievement] WML tags and their respective lua functions. [has_sub_achievement] is unsafe for use in MP, for the same reasons that [has_achievement] is.
* wmlxgettext: Improve parser resiliency for malformed files
- WML files with no translatable strings will no longer
crash the script on unbalanced tags (but translatable will).
- .cfg files belonging to man(1) will no longer crash the script.
* Remove stray quotes from textdomain declarations
These are not recognized by the wmlxgettext parser.
This removes --wconsole, --wnoconsole, and --wnoredirect. Instead these are now handled by --no-log-to-file and --log-to-file.
If logging to file is enabled, then output will be written to the log file. If logging to file is not enabled, then output is written to the terminal. On Windows, a terminal will be created for the output to be written to if wesnoth is not launched from a terminal.
This version doesn't rely on custom parsing of the version number from
the (notably *not meant to be parsed*) operatingSystemVersionString
property, and explicitly appends the version number components to the
reported string instead so we don't get weirdness like "Apple macOS
13.3.1 ((Build" from an operatingSystemVersionString value like
"Version 13.3.1 (a) (Build 22E772610a)" (found after the early May
2023 rapid response patch to Ventura).
Additionally, this replaces the clunky version comparison to decide
whether to use the macOS or OS X branding with the @available syntax.
<https://developer.apple.com/library/archive/releasenotes/AppKit/RN-AppKit/index.html>
(Under "Runtime Version Check")
gui_->show_everything() also depends on the blindfold
feature somehow, that's why the previous implementation
avoided using it and just disabled show_everything in
play_controllers constructor. However i now think
it's safe to use it here.
- We now don't show an error message in the log when no
[side]s are defined, (this broke the unit test).
- We avoid calling `gui_->set_playing_team` when no [side]s
are defined.
- skip_empty_sides now doesn't throw, previously the behaviour
was inconsistent when there were no non-null sides. (it didn't
throw when there were no sides at all)
- skip_empty_sides now returns two values instead of changing
the parameter. (this was mostly to make the implementation
easier)