Also change its return to an optimised surface. Fixes bug #20876.
From the comment added to the source:
Unlike other image functions cut_surface does not convert the input
surface to a neutral surface, nor does it convert its return surface
to an optimised surface.
Since it seems to work for most cases, rather change this caller instead
of the function signature. (The issue was discovered in bug #20876).
For some reason, ~BG() used SDL_BlitSurface() directly instead of using
the alternate blit_surface() implementation, unlike every other image
path function type in existence that needs to do blitting.
This works the first time when scaling or cropping an image (say,
"misc/blank-hex.png~BG()~CROP(0,0,34,34)"), but the second time it's
used with different scaling/cropping parameters, it yields the result it
would without ~BG() in the pipeline. This is somehow remedied by this
change, and I don't see any potential issues arising from it anyway
(save for a negligible performance impact on ~BG(), maybe).
This branch makes it possible to compile Wesnoth using SDL2. Running the
resulting binary will not work however, that will be worked upon later.
Note compilation with strict compilation fails and will for the near
future since some struct members changed signedness.
wesnoth.synchronize_choice checks the return value of toconfig fcn,
and if it indicated that it partially failed to convert the table,
it will chat a warning, IF wesnoth is running in debug mode
(that is game_config::debug = true, which is determined by e.g.
the command line flag --debug)
by fixing up bad commit eb9274bd4c78a5f9a86bc9e0bf748f701d81e6b1.
the code to drop messages older than 5 should run inside the if block,
in the scenario when there were previous message, not outside it (!)
With this missing, certain combinations of actions/events would lead to
the ids of all CAs being dropped (e.g. in saves after using
[modify_ai]), which resulted in it not being possible to remove CAs any
more as that is done by id.
This fixes bug #21750.
MSVC was throwing error C2244 when trying to match some function
definitions to their declarations. This commit moves those
definitions to their declarations. The declarations are harder
for a human to read now, but at least all supported compilers
can understand it.
Overall statistics (only for files with a smaller recompressed size):
Original size: 14370 KiB on 172 files
Optimized size: 12855 KiB
Total saving: 1514 KiB = 10% decrease
The code will change enough to invalidate the tests, so don't bother to
get them working now.
With this commit Wesnoth compiles with SDL2 as long as strict
compilation is disabled. Running Wesnoth does not work at the moment.