56125 Commits

Author SHA1 Message Date
aquileia
188c7c3386 Merge branch '8573/util/count-leading-ones/1' of https://github.com/8680-wesnoth/wesnoth into codepoint_count 2014-03-23 13:19:14 +01:00
Alexander van Gessel
4e50c064e3 Merge branch 'master' of github.com:wesnoth/wesnoth 2014-03-23 13:13:44 +01:00
Alexander van Gessel
883fe46cad Use existing named constants 2014-03-23 13:13:19 +01:00
Alexander van Gessel
5b72299c39 Match declaration with definition 2014-03-23 13:13:08 +01:00
David Mikos
c770104621 Fix bug #21257: make skip AI mid-movement animations invisible and only enable at end. 2014-03-23 18:08:10 +10:30
Alexander van Gessel
6b5f357b6e Follow up the utf8 namespace with ucs4 and utf16 namespaces 2014-03-23 04:24:02 +01:00
Alexander van Gessel
a25a0b7d35 Reshuffle some tests 2014-03-23 03:48:04 +01:00
Alexander van Gessel
b0d31d07e3 Merge branch 'wide_string_elimination'
Conflicts:
	src/dialogs.cpp
	src/gui/dialogs/addon_list.cpp
	src/gui/widgets/password_box.cpp
	src/gui/widgets/text.cpp
	src/gui/widgets/text_box.cpp
	src/marked-up_text.cpp
	src/serialization/string_utils.cpp
	src/serialization/string_utils.hpp
	src/text.cpp
2014-03-23 03:46:01 +01:00
Alexander van Gessel
1f4fe17576 Add some unicode handling tests 2014-03-23 02:59:00 +01:00
Alexander van Gessel
9d2465fb20 Prevent some possible buffer overflows 2014-03-23 02:22:52 +01:00
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
Alexander van Gessel
8386c592e7 Merge pull request #126 from aquileia/utf8
Improve UTF-8 handling
2014-03-23 01:10:14 +01:00
aquileia
246f599bd0 fix signature and test for UTF-8 functions
On the advise of 8680, the unicode string was replaced by the hex
transcription of the corresponding codepoints (which he kindly
provided).
This might help to pass the overzealous encoding check of clang.

This commit also fixes a discrepancy between the signature of u8index in
declaration and definition.
2014-03-23 00:08:27 +01:00
8573
36e3da74eb Add count_leading_ones function
Add the following function in `src/util.hpp`:

    template<typename N> inline unsigned int count_leading_ones(N n);

This function returns the quantity of leading `1` bits in `n`.
2014-03-22 20:43:15 +00:00
8573
97d24001eb Add count_leading_zeros function
Add the following function in `src/util.hpp`:

    template<typename N> inline unsigned int count_leading_zeros(N n);

This function returns the quantity of leading `0` bits in `n`.
2014-03-22 20:42:18 +00:00
8573
23fddb0e93 Add count_ones function
Add the following function in `src/util.hpp`:

    template<typename N> inline unsigned int count_ones(N n);

This function returns the quantity of `1` bits in `n` — i.e., `n`’s
population count.
2014-03-22 20:42:04 +00:00
8573
2313201837 Have bit_width(x) take x by reference.
In `src/util.hpp`, change the following function signature:

    template<typename T> inline std::size_t bit_width(T x);

To the following function signature:

    template<typename T> inline std::size_t bit_width(const T& x);

This avoids needing to call `T`’s copy-constructor, which could be
annoying.
2014-03-22 20:37:11 +00:00
aquileia
2f6a6a7d0e move UTF-8 functions to a separate namespace 2014-03-22 20:57:01 +01:00
aquileia
9351a25249 Fix a wrongly passed parameter in text_box.cpp 2014-03-22 20:55:58 +01:00
Ignacio R. Morelle
e96bd0f1e1 Sort players changelog categories by alphabetical order 2014-03-22 15:39:27 -03:00
aquileia
52c80db79e Improve UTF-8 handling
For manipulation of UTF-8 encoded strings (insert, delete, truncate, and
size), usually conversion to wstring and back was necessary. This has
two disadvantages:
* the size of wstring is implementation defined
* the
double conversion is slow

The purpose of this patch is to add functions
to handle these tasks by a layer handling the different indexing between
codepoints and characters.

This commit applies these functions in
several places to replace the old implementations.

The byte_size_from_utf8_first() implementation will be replaced in a
separate commit as it relies on the count_leading_ones function by 8680.

Signed-off-by: aquileia <sk.aquileia@gmail.com>
2014-03-22 15:39:23 +01:00
aquileia
c928358106 Extend .gitignore for VC project files
This commit adapts .gitignore to the new MSVC compilation
recommandations on the wiki.

Signed-off-by: aquileia <sk.aquileia@gmail.com>
2014-03-22 15:39:01 +01:00
aquileia
d55848319d fix password box documetation
Signed-off-by: aquileia <sk.aquileia@gmail.com>
2014-03-22 15:38:37 +01:00
loonycyborg
7116ccf9ef scons: Made out-of-tree builds with -Y option work 2014-03-22 17:45:21 +04:00
Andrius Silinskas
fa5b916bf1 Add missing MP settings for reloaded games. Fixes #21808.
The problam was that mp::configure is not used for reloaded games and so
mp_game_settings will not be fully initialised. This leads to using default
values rather than values set using mp::configure screen or from reloaded game
config.

The optimal solution would be to either display mp::configure for reloaded games
or to populate mp_game_settings using reloaded game config. However, both
solutions require rather a lot of code restructing and are probably not suitable
for a feature freeze.
2014-03-22 12:51:05 +00:00
Nils Kneuper
80feaee818 updated German translation 2014-03-22 09:29:46 +01:00
Nils Kneuper
025342283b changelog update for Greek translation update 2014-03-22 09:29:30 +01:00
Nils Kneuper
bbdf3a16de updated Greek translation 2014-03-22 09:27:56 +01:00
mattsc
feafb1dadf Update changelogs and release notes 2014-03-21 20:33:54 -07:00
happygrue
cd1a8ea6c8 Fixed whitespace error in changelogs 2014-03-21 21:28:54 -04:00
happygrue
3265ad3b3f Rebalanced three THoT scenarios.
Tweaked starting gold and income for various sides.  Updated changelog,
players changelog.
2014-03-21 21:08:09 -04:00
Chris Beck
e6abd6d2c9 fixup bugfix 21758 (commit 186e66cec6519606bca5e07209c9a557c78b5e71) 2014-03-21 19:05:06 -04:00
lipk
eb48917ce5 Merge pull request #122 from Rift-Walker/config_edits
Config edits
2014-03-21 10:46:05 +01:00
Ignacio R. Morelle
d219881656 Improve a changelog entry 2014-03-21 01:16:32 -03:00
Ignacio R. Morelle
bbe8b7a816 Merge branch 'Add-unit-instance-recall-costs' of https://github.com/Aishiko/wesnoth into Aishiko-Add-unit-instance-recall-costs
Conflicts:
	changelog
2014-03-21 01:05:39 -03:00
Aishiko
2a923b5a26 Corrected use of cfg["foo"], removed 2 assignments, and 2 whitespace fixes
Changed from cfg["foo"] > number, to !cfg["foo"].blank(). Turned a cfg call into
just a default assignment.  Added a .to_int to a cfg["foo"] call to prepare
against bad user input.  Finally added whitespace to 2 lines to get them to line
up with the rest of the lines.
2014-03-20 23:25:16 -04:00
loonycyborg
d58589797b scons: relocate config.h and revision.h to build directory 2014-03-21 06:39:50 +04:00
8573
1c28c514a9 Add bit_width functions
Add the following functions in `src/util.hpp`:

    template<typename T> inline std::size_t bit_width();
    template<typename T> inline std::size_t bit_width(T x);

These functions compute the size, in bits, of a type or value, providing
a convenient and self-documenting name for the underlying expression,
`sizeof(…) * std::numeric_limits<unsigned char>::digits`.

This commit adds two additional header `#include` directives in
`src/util.hpp`. The newly included headers are as follows:

  - `<cstddef>`, for `std::size_t`; and
  - `<limits>`, for `std::numeric_limits`.

At first, I obtained the bit width of a byte using the C preprocessor
macro `CHAR_BIT`, defined in the C standard library header `<climits>`,
rather than using `std::numeric_limits<unsigned char>::digits`, but I
subsequently switched to using `std::numeric_limits` per Soliton’s
recommendation at 2014-03-17 21:36Z in the `#wesnoth-dev` IRC channel on
the freenode IRC network (<irc://chat.freenode.net/%23wesnoth-dev>).
2014-03-20 23:55:04 +00:00
Aishiko
b979516e75 Added Aishiko to about.cfg as requsted by shadowm
Added Aishiko and a comment about her being to blame for the unit instance
recall costs.
2014-03-20 19:42:23 -04:00
Aishiko
0fe4a943f3 Changed recall cost in recall dialog to default colour 2014-03-20 19:41:35 -04:00
Aishiko
c8346d3446 Added line to changelog for adding single unit instance recall costs 2014-03-20 17:58:12 -04:00
Aishiko
c288fcb203 Single unit instances work with whiteboard.
Here the changes to get whiteboard to work are mostly cosmetic, the
right cost for each unit is displayed on the unit in question.  This
is mostly for peace of mind as the user looks at the screen they don't
get confused.  The proper gold is also taken for each recall and
replaced for each canceled/undone recall while in whiteboard.
2014-03-20 17:57:31 -04:00
Mark de Wever
69b9b01dc4 Merge branch 'SDL_Texture'
Add a wrapper for the SDL_Texture. This contains the basics more
improvements will be added later.
2014-03-20 22:25:32 +01:00
Mark de Wever
ba447c16e6 Add texture creation code for the window.
Since textures are attached to a renderer the window (and thus its
renderer) often is the best place to create the texture.
2014-03-20 22:23:30 +01:00
Mark de Wever
e2ce7ec219 Add the initial SDL_Texture wrapper code. 2014-03-20 21:42:06 +01:00
Nathan Walker
923519d75a Change config assignment op to copy-and-swap
The previous implementation was not strongly exception safe.
This code is nearly identical logically, but with strong exception safety.
It's also good practice and more readable.
2014-03-19 22:28:49 -05:00
Nathan Walker
efec4735ed (cosmetic) fix code tabs
Codeblocks made some of my tabs into spaces and I had to fix it.
Also, forgot to mention this before, but I cleaned up some of the code
for astarsearch.cpp as well.
2014-03-19 22:16:56 -05:00
Nathan Walker
5eee20be97 clean up instances of std::copy
In many places, std::copy was used with back_inserters, or other
std::inserters. These have in most cases been replaced by using the
ranged insert member function of each stl container. Firstly, this makes more
readable code. Also, this is often more efficient because,
if the compiler can find the distance between the source iterators,
it only has to make one block allocation and then fill it
with values. In other cases, containers were being default constructed
and then std::copy'd into with some form of inserter. These were cleaned up
by using the iterator range constructor instead.
Use of std::copy was especially egregious in the case of associative
containers such as map and set. Sometimes back_inserter was
being used, other times std::inserter set at front, but it doesn't matter
because there is no front or back when inserting, and it's much cleaner
to just use set or map::insert(iterator begin, iterator end).
2014-03-19 21:23:27 -05:00
Chris Beck
60ee028417 Merge pull request #120 from cbeck88/purge_human_ai
Purge "human_ai" controller type
2014-03-19 17:22:01 -04:00
Chris Beck
60777429c3 Purge "human_ai" controller type
This is a fixup of bugfix #18829 (which was commit
736ceaa6c7e81882c9c5b2e932307b1f1ecb3bfd)
2014-03-19 17:20:36 -04:00