443 Commits

Author SHA1 Message Date
Alexander van Gessel
6318b37ffd Get rid of utils::wide_string
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.
2014-03-23 01:56:40 +01:00
Ignacio R. Morelle
0f1e3fab3e Add missing check for a null surface from image::get_image()
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.
2014-02-06 18:53:55 -03:00
Alexander van Gessel
724dd0f949 Fall back to variation_name if variation_id is not present (bug #21280) 2014-01-13 01:14:46 +01:00
Ignacio R. Morelle
a4f47a63c7 New Year copyright update 2014-01-01 02:08:52 -03:00
Ignacio R. Morelle
c7cacb1d5a gui1: Display unit overlays and crowns in the Recall dialog preview pane
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.
2013-12-19 22:38:24 -03:00
Ignacio R. Morelle
7883f366df gui1: Display unit overlays and crowns in the Recall dialog's list 2013-12-19 22:38:24 -03:00
Alexander van Gessel
0d18c7ca56 Move format_time_summary to its own file to fix linking issues 2013-12-17 00:36:48 +01:00
Alexander van Gessel
dcdce05935 Factor out two nearly-identical format_time_summary functions 2013-12-09 16:36:11 +01:00
Alexander van Gessel
fe7729a07c Add a !null assert
Found by coverity
2013-12-08 03:08:03 +01:00
fendrin
a561e1b3ed Autogenerated terrain help sections. 2013-11-16 16:27:55 +01:00
David Mikos
59546bc9cd Fix segfault on delete of last save. Bug #20845 2013-10-10 12:30:33 +10:30
Andrius Silinskas
947a842bad Translatable months and weekdays. Missing am/pm designations.
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.
2013-10-02 14:49:37 +01:00
fendrin
3c636c3163 Show the unit profile based on the variation_id.
The old implementation took the variation_name which is now used to show
the user a translated text.
2013-09-26 20:41:32 +02:00
JaMiT
c0435769bd Split game_events.cpp.
VC and XCode projects still need to be updated.
2013-08-11 19:31:20 -05:00
Alexander van Gessel
08f3e12a79 Make the GUI1 network transfer dialog use SI units too 2013-07-03 05:06:42 +02:00
fendrin
fa86e2e350 Fix some wrong spelling, mostly in comments. 2013-06-23 17:18:49 +02:00
JaMiT
4da4104965 Use the correct index for filter_textbox::delete_item().
This fixes the issues when dismissing recallable units as reported:
http://forum.wesnoth.org/viewtopic.php?f=4&t=38479
2013-06-08 15:28:23 -05:00
JaMiT
86089f2ba4 Remove some do-nothing code. 2013-06-08 15:28:23 -05:00
Charles Dang
fe5df57bb2 Made unit preview pane use non-copper regular image as opposed to menu-button image 2013-06-04 20:49:11 +11:00
flix/Felix Bauer
29e8584738 Add new aspect 'advancements'
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.
2013-06-01 17:21:12 +03:00
Charles Dang
8ee955a096 Replaced refs to old lite_small image with one to new image 2013-05-30 22:23:02 +11:00
fendrin
01167bcc07 Port the unit_list dialog to the editor. 2013-05-15 05:58:57 +02:00
Mark de Wever
8956607cd9 Fix a compiler warning.
When defining LOW_MEM a parameter was unused.
2013-04-13 21:31:41 +02:00
Boldizsár Lipka
0d96709a72 Move the recall dialog into a separate function. 2013-04-13 12:17:08 +02:00
Boldizsár Lipka
adbbddcecd Move the recruit dialog into a separate function. 2013-04-13 12:17:08 +02:00
Ignacio R. Morelle
7c9fa8bb7e Disable difficulty option in Load Game when not applicable (patch #3834)
Fixes bug #20381. Patch by nurupo.
2013-04-06 00:35:22 -03:00
Eric S. Raymond
043c4f9fd3 Remove $Id$ cookies. 2013-03-26 21:41:37 -04:00
J. Tyne
b65d5603ee Change unit::type() to return a reference instead of a never-NULL pointer. 2013-01-16 12:07:23 +00:00
J. Tyne
273b2ccc62 Make unit_type_data::build_unit_type() public,
...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.
2013-01-03 23:29:45 +00:00
J. Tyne
4555889028 Document and use (existing) non-empty guarantee for unit_type::genders(). 2013-01-03 05:34:46 +00:00
J. Tyne
83958a10fb Use unit_type::race() instead of getting the race id...
...then searching for a matching unit_race.
2013-01-03 05:00:38 +00:00
J. Tyne
239b4e30b4 Rename unit_type::race() to unit_type::race_id().
This is for more consistent naming of functions (this function returns a string,
while unit::race() returns a pointer to unit_race).
2013-01-03 03:07:03 +00:00
J. Tyne
6c01ba329d Uniformize (and document) the use of a dummy race...
...to guarantee certain pointers are never NULL.

(The pointers cannot be references because they sometimes need to
change what they point to.)
2013-01-02 05:46:10 +00:00
Mark de Wever
43b71f2ff0 New year copyright update. 2013-01-01 09:22:03 +00:00
J. Tyne
7178438765 Remove vestiges of the --smallgui command line parameter,
...which was made unnecessary in 1.9.5.
2012-12-26 19:29:38 +00:00
J. Tyne
1500af41a2 Update an outdated comment. 2012-10-24 15:47:27 +00:00
J. Tyne
15e56212b6 Refactor how abilities and weapon specials are reported...
...so that they can be reported as "active" or "inactive". (Changes to
the reporting will come later.)
2012-10-23 23:51:44 +00:00
J. Tyne
cf3c6891f6 Refactor weapon special contexts.
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).
2012-09-25 19:07:32 +00:00
Alexander van Gessel
42a4eb44a5 Add help support for unit variations 2012-09-16 21:27:40 +01:00
J. Tyne
33446a704e Reduce some overhead.
(Use the new get_amla_unit() instead of get_advanced_unit() + extra
processing.)
2012-09-15 19:51:10 +00:00
J. Tyne
4a91a59311 Merge the two codepaths for advancing a unit (regular & AMLA). 2012-08-30 18:28:47 +00:00
Ignacio R. Morelle
3771d25656 gui1: Restore saved games info count test,
...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.
2012-08-27 23:34:26 +00:00
J. Tyne
724618c287 Split actions.cpp into six pieces (into a new "actions" subdirectory).
Most of the project files have also been updated, but I ran into some
difficulties trying to update VC9 and Xcode.
2012-08-25 14:06:46 +00:00
Anonymissimus
892c256f97 introduce [unstore_unit]animate=yes|no (def. yes) parameter
FR in the forums

http://forums.wesnoth.org/viewtopic.php?f=12&t=36999&p=534561#p534561
2012-08-04 18:22:13 +00:00
Mark de Wever
16dbfff895 Remove a useless cast.
Detected by the upcoming gcc-4.8.
2012-07-28 16:34:42 +00:00
Sergey Popov
6b6eafb213 Use BOOST_FOREACH directly instead of #define foreach BOOST_FOREACH
The define is extremely unreliable, will break compile with boost >=
1.50 and upstream can't fix issues with it, see
https://svn.boost.org/trac/boost/ticket/6131
2012-07-07 00:49:45 +00:00
Ignacio R. Morelle
bdbd6150c2 gui1, gui2: Rename "Reselect difficulty" option to "Change difficulty"
This affects both internal ids and symbols and translatable strings.
2012-05-18 20:11:11 +00:00
Iurii Chernyi
0f10db9d92 Fixed bug #19538: Filters matching 0 saved games cause crash.
Patch #3220 by trademark
2012-03-30 15:54:49 +00:00
Jérémy Rosen
551946d6c7 save_index refactoring patch #3125 by Oleg Tsarev 2012-02-18 17:57:20 +00:00
Ignacio R. Morelle
7503e91071 gui1: Remove the Load Game dialog message text...
...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.
2012-02-07 22:41:43 +00:00