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>).
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.
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.
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`.
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`.
Merge branch '8573/util/count-leading-ones/1' of https://github.com/8680-wesnoth/wesnoth into codepoint_count
Improve byte_size_from_utf8_first()

The count_leading_ones function by 8680 improves speed and readability
of this function which parses UTF-8 characters.
Update Xcode project
Messenger MAI: add optional [filter_second] tag

This allows selection of the escort units.
Move Micro AI auxiliary functions into their own file
Move path to Micro AI candidate actions files into variable

The purpose of this commit (and the previous) is to make it easier for
UMC authors to add functionality to the Micro AIs.
blindfold is removed when control of a side is received

in blindfold_ii, blindfold was taken off when local side takes control
in this fixup, blindfold is taken off as soon as host gives control of
any side.
to achieve this, playturn.cpp must be able to ask the playcontroller to
remove the blindfold.
we create a virtual method of play_controller, on_not_observer,
which is called whenever this client gets local control of a side
(it becomes ai or human)
on all play_controllers except play_mpcontroller, this does nothing
in play_mpcontroller it calls a "remove_blindfold" function
when a human side takes control, remove_blindfold is still called,
as a precaution.
apply a brief blindfold when changing sides in hotseat mp

Fix bug #3865: While the turn dialog used for changing sides is active,
apply a blindfold, which is removed when the dialog is cleared.
ai_helper.get_closest_location(): fix bug with tags in SLF

The way how the Standard Location Filter was dealt with only worked
with keys, not tags.
Messenger MAI: fix bug with escort units blocking the messenger

When there were lots of escort units, they previously quite frequently
blocked the messenger’s way, preventing him from making progress even
when it was possible.  Escort units now specifically move out of the
way if they do not need to attack enemy units in the messenger’s way.
Messenger MAI: allow several messengers to be controlled by AI

For two of the CAs this mostly just means reading the [filter] tag and
picking one of the messengers.  However, for the CA moving the escort
units, it means a complete rewrite, as the AI now needs to figure out
which escort unit should be moved toward which messenger.
Messenger MAI: add optional invert_order= key

In the default configuration, the AI moves the messenger which has
advanced the furthest through the waypoints first.  If this key is set,
the rearmost messenger is moved first.
MAIs: minor code simplification in AIs that take both [filter] and id=

These are the AIs that used to use Behavior Candidate Actions (BCA).
Patrol MAI: fix bug with save/load persistent data storage

WML values may not be used as keys, this can make savegames invalid.
Store information in the units now rather than in self.data. (Note:
storing in self.data would also be possible if the syntax were changed.)
fixup b854aab437f157eea642131b882a4987a95c5b6b (ai side drops)

logic error was introduced in client side controller types:
when a player drops and controls an ai-side, the side_drop signal
is only sent to the host, who should make that side a local ai,
not a networked ai.