For some reason, when the variant constructor only accepts
std::shared_ptr<const variant_callable>, MSVC2013 gets confused about which
constructor it should call when it has, say,
std::shared_ptr<ai::attack_analysis>. Making the constructor a template
fixes it.
This allows the variant_callable to store a shared_ptr to its callable while ensuring that
callables that were allocated on the stack or as part of a larger structure are not
double-freed.
This ensures that units can be fetched even if a game board isn't present.
This also removed an unnecessary assert for the presence of resources::tod_manager (it wasn't used).
In the case of as_nonempty_range, the function was rewritten to remove absolute reliance on gamedata.
In the other case, we simply silently return now.
This is a partial revert of ed15163b95317. Most place still use resources::gameboard->units(), but
they should still point to the same place.
This was done since the editor doesn't have a game_board and needs a way to specify a global unit_map.
The assumption is that the highlight ratio is only ever 0.5, 1.0, or 1.5. This might be true now... but probably best to avoid equality comparisons if possible.
Shadows - like most ghost units - have varying alpha levels as part of their animation, however, the Shadow also has the Nightstalker ability which reduces alpha by 0.5 (invisible unit).
As a result, there is an alpha underflow when the animation frames vary from -0.1 to 0.3.
By using a multiplication instead of an addition-1, as suggested by CelticMinstrel, the alpha variation becomes 0.2 to 0.4, avoiding the underflow and making the Shadow slightly less translucent at night.
For some reason, it only occurred in debug builds when I tested.
The problem was that partial relayout didn't respect
invalidate_layout_blocker. As a result, in situations such as populating a
listbox one entry at a time, the layout system ended up performing dozens
of full relayouts that, not surprisingly, is extremely expensive.
Regression from commit 01035f0adcc40a81eddc9aab8637ee3674830735.
The set_origin method worked, but not in every circumstance. For example, if the story box were not aligned to the bottom of the
screen in the initial part, it would not be correctly place. If you resized the screen while the box was not at the bottom, it
would return there. This was due to set_origin being purely temporary - ie, the layout engine did not record the new position,
and when invalidate_layout was called, the default (per the dialog WML) position of 'bottom' was restored.
This new method fixes the above issues. It also fixes an issue the old GUI2 screen had where a top-aligned box would also obscure
any available title.
options setting attributes in a container like
```
[options]
[slider]
id="container.attribute"
....
[/slider]
[/options]
```
were broken in a previous refactor in 1.13.0. This commit should restore them.