utils::wide_string was a std::vector<wchar_t>
On most unix systems, this is 32 bits wide, and therefore a UCS-4 encoding.
On windows however, wchar_t is 16 bits wide, and the naive approach results
in UCS-2, which can only represent the Basic Multilingual Plane.
Most functions that used wide_string have been moved over to ucs4_string.
The Win32 API has been moved over to a specially created utf16_string instead.
Specialty tolower #ifdefs have been removed, as the towlower function has
been available since OS X 10.3, OpenBSD 3.7 and probably ancient versions of
all other BSDs too. The only issue is that on windows, the function cannot
be applied to characters outside the BMP.
Fixes a NULL pointer dereference when drawing preview pane overlays in
the Recall Unit dialog for a unit whose overlays list includes an image
that doesn't exist or can't be read, and debug mode is not enabled.
This didn't happen in debug mode because image::get_image() retrieves a
valid placeholder surface (currently images/misc/missing-image.png) in
that situation with debug mode enabled.
Reported by SkyOne in the forums: http://r.wesnoth.org/t39983
Thanks to mattsc for pinpointing the commit at fault.
Note: the code handling overlays on the listbox/menu of the Recall Unit
dialog shouldn't be affected by this since it uses the BLIT image path
function instead of accessing surfaces directly.
This incidentally would allow displaying overlays for other preview
panes in the future (e.g. the main sidebar) since most of the required
functionality was implemented on the unit_preview_pane base class.
A simple std::strftime wrapper was introduced, which takes care of date
translations when needed. I.e. if correct locale is not available, or
locale in use does not support am/pm designations.
As part of a GSoC proposal I added a new aspect so a scenario editor can control advancements in two ways:
1. Define a aspect with a string-value like "Swordsman, Knight", so the units of interesst will always advance to this
2. Use the LUA-Engine and return a function of the form advance(x, y) which will itself return a string-value
like "Swordsman, Knight". Everytime a ai-unit advances advance(x, y) will be called.
The corresponding wikipage (http://wiki.wesnoth.org/AiWML) is going to be updated soon.
...and update various parts of the code to call it (instead of using
unit_type_data::find() to "find" a known unit_type).
There was one call in the editor's code where I am unsure if there are
supposed to be side effects other than building the unit_type. So I
left the code as-is and just added a comment for someone else to
evaluate later.
This allows some simplification both when the context is set and (in
one spot) when the context is used.
The semantics for the location parameters to set_specials_context() have
changed; attempts to use the old version will give a compiler error as the
function signatures have also changed (all current calls have been updated).
...preventing a segmentation fault when deleting all saved games in
the Load Game dialog
This is a trunk-specific regression. The test is intact in 1.10.
...to make room for some checkbox rearrangement
This makes the dialog work properly on 800x480 again, and also makes the
Cancel Orders checkbox look less like it was haphazardly thrown into the
layout.