These were emptied out when SDL 1.2 was removed (358bd1235f07d8d577). I seem to recall
someone saying it might be worth keeping them around in case something needed to be put
back, but it's been a year and a half. Not much worth in keeping empty files.
* Added a point ctor that takes an SDL_Point.
* Added a toggle_fullscreen function to CVideo.
* Change all management of resolution data to use point instead of std::pair<int, int>. This
shortens the code considerably.
* Cleaned up preferences_dialog::set_resolution_list
* Made CVideo::set_resolution return a bool indicating whether resolution was changed.
* Swapped which of the two set_resolution overloads contains the main implementation.
* Moved the events::raise_resize_event() call when setting resolution to the CVideo function
where it should have always been (instead of the prefs dialog callback). This is a pretty
essential component and having it localized in one place meant any other area of the code
that might have called set_resolution wouldn't have it.
I thought changing what the return value of sdl_event_handler::hotkey_pressed meant wouldn't
cause any regressions, but apparently I was wrong. This made it so certain key-down events
were never fired at all, meaning the associated keys could never be entered in a textbox.
Pretty serious!
I've restored the bool retval to dispatcher::execute_hotkey. It will return false if there's
no associated hotkey function (like before), and true otherwise. sdl_event_handler::hotkey_pressed
has also been reverted to return the value of that function.
* The vector of surfaces is now a class member variable instead of a local
variable. This saves a memory allocation every time the function is called
- which is worth it in this case, as the function is a major performance
bottleneck.
* The surfaces are now being moved instead of copied where possible. Turns
out that freeing a SDL surface is fairly expensive in performance-critical
code.
* Pointers to ToDs are now cached, reducing the number of calls to
get_time_of_day() from 37 to 7.
In a stress-test in Aetheryn's Mod at 50 % zoom, the FPS I was getting on
my PC (Intel Core i5-4430) increased from 16 to 23.
Play_controller::play_slice() that the aforementioned function calls
redraws the game anyway. Calling redraw code from two places makes
profiling data harder to investigate.
* Removed window reference from callback function signature. Instead, bind (or capture)
window reference when register_button is called.
* Moved long callbacks to their own functions.
This is needed to properly reinitialize streambuf objects after cancel.
This prevents crash from issue #2203 but download after cancel still doesn't
work properly. More investigation needed.
The bool retval was presumably meant to allow stopping execution of the main hotkey callbacks
if a local one was meant to take precedence. However, that wasn't used anywhere (all callbacks
were returning true) and the return value just meant we had to create lambdas or wrapper functions
everywhere. If necessary, we can re-add halt functionality later.
I did leave sdl_event_handler::hotkey_pressed returning a bool value, though, except now it signals
whether there was a valid dispatcher with which to execute the hotkey callback. This seemed reasonable
since we probably wouldn't want to continue if there were no dispatcher anyway, though this only has
any effect in the key_down handler.
Early in the 1.13 development cycle there used to be an option to show the mp_connect screen
(now mp_staging) before starting an SP campaign. That was scrapped and the only code that used
it (in the SP initialization process) commented it out. Since we're not going to restore it,
might as well remove this flag.
Also removes the one instance remaining of a "show_configure" flag. Pretty sure this might have
also been a relic from the same time as show_connect, but it looks like it was since removed.
SP now has a dedicated screen for configuring active modifications in SP, which was the only
reason to show the configure dialog anyway (plus the mp create and configure screens were combined
later in 1.13 anyway).
note: please do only enter "Part of the string", not the full strings.
The text in the po files is broken into parts and full strings, with
missing newlines, will not cause matches for the string.
Pass each parameter through Lua tostring() to convert to strings. This also allows meta-method tostring on userdata.
This aligns the operation of wesnoth print() to be closer to what a Lua programmer would expect from the normal Lua print() which is not available.
Closes Issue #2236
Bug was that when a unit was thawed, mouse over in unit sidebar would show
incorrect movement costs (all 1's).
New implementation properly uses {UNREACHABLE} and makes use of the now
available [remove_object] tag.
There is barely any point in moving hotkeys because the command is the only
member variable that's both 1) movable and 2) faster to move than copy. In
2cc3f99651c9de13eb36ab0c490996a8dd47e50e, @Vultraz talked about "avoiding hundreds of copies", but
moving isn't necessarily any faster than copying. Seriously, making hotkeys
noncopyable was just a premature and obviously unprofiled optimization.
Besides, this also fixes build on Visual Studio 2013.
* Used an std::array instead of C array for hotkey_list_.
* Used an std::vector instead of boost::ptr_array for known_hotkeys.
* Made hotkey_command non-copyable and movable in order to avoid hundreds of copies.
* Added a hotkey_command ctor that takes a hotkey_command_temp reference.
* Hopefully prevent some reallocations by reserving an appropriate amount of memory for known_hotkeys
before filling it up.
* Search from the end of know_hotkeys when calling remove_wml_hotkey(). This avoids traversing the almost
200 vector members that likely will not match.
* Deployed auto/range-for.
* For some reason I needed to add a <cassert> include to gui2/widgets/grid.hpp.
These functions were introduced in 2.0.5, but a packaging error meant they weren't properly
included in the VS libs for that release. So I set the minimum to 2.0.6. Not sure if we want
to leave the fallbacks for the other versions or bump the minimum to 2.0.6.
[ci skip]
Something was screwy about these image's alpha. Normally when I remove an alpha channel in GIMP,
it shows up white. With these images, it showed up black. Maybe they had an embedded palette or
something, I don't know, but the problem is fixed.
Something must have changed in SDL 2.0.6 that caused this issue to appear. Not sure if anything
needs to be patched in our source code, though (but not likely)
The previous code sometimes produced invalid Pango markup.
Instead of attempting to parse Pango markup, simply scan for links in the
raw text and replace them in Pango markup. This way there is no way to
accidentally break the markup.
* display::w() and display::h() now simply forward to CVideo::getx() and gety() instead of querying
the underlying window object. This is a slight semantic change, since now these functions return
screen coordinates instead of pixels, but that's probably what we want in the long term anyway.
* sdl:🪟:get_flags() now returns the proper uint32_t instead of int
* Added a dedicated CVideo::window_has_flags function since testing window flags was the most common
use of the underlying sdl window outside the class.
* Made CVideo::set_window_mode private. This is an implementation detail and shouldn't be public.
* Removed BPP argument from CVideo::make_test_fake. It's never passed anything other than 32, and
we're long past the time when we care about window BPP.
* Removed sdl/window.hpp include from video.hpp. This was mostly only there to allow other area of
the code to call get_window()->get_flags() (and for display.hpp). There's no real reason for it to
be there anymore and was just making any modification to the sdl window header take ages.