previously the unit ctor could invoke arbitrary umc lua code, for
example via advance_to -> add_modification ->
resources::lua_kernel->apply_effect and during that call the unit was
not owned by a unit_ptr, so the code could not use unit_ptr objects at
several places because the unit might not be owned by a unit_ptr object.
previously the game ignores the side= attribute when the game was
started the normal way, and refused to load start-of-scenario of
scenario that ha a side with a wrong side= attribute.
Now in both cases it loads the scenario sucesfully but gives a warning.
This commit removes the utility srt_cast() function and replaces its calls,
along with calls to lexical_cast<std::string>() (and its boost variant),
with std::to_string().
In a few cases where the input type isn't compatible with to_string,
lexical_cast<std::string> is still used.
In other cases where lexical_cast was operating on MAKE_ENUM enums, the
call has been replaced with ENUM::enum_to_string, which is faster.
We cannot call it name becasue thats already used by the unti that is
generated from the side tag.
if given (nonempty), side_name= will be used instead of current_player
in some dialogs (new turn dialog, statistics).
In [scenario] side_name= defaults to name= while in [multiplayer]
side_name= defaults to empty (so that current_player is used in those
dialogs by default).
This specially fixes http://gna.org/bugs/?24226 while still giving wml
authors in mp and in sp the option to use the real players name in those
dialogs.
If you dont want that the engine uses the [side] wml table to create a
leader for that side, it is now enough to just omit the type attribute.
Previously it was necessary to add a no_leader=yes attribute.
The no_leader attribute is still used by the mp connect engine (which is
also used in sp) to prevent the mp connect engine from adding a random
leader from the current era. no_leader now defaults to yes for sides in
[scenario] and to no for sides in [multiplayer] so that the connect
engine now by default doesn't add a random mp leader to sides in sp
games.
instead of calling constructor and init you now only have to call the
constructor.
In order to make this work this commit removes the uses of
resources::gameboard/units during team construction. while doing that i
moved the unit_creator class to a new file.
This commit also removes the ticks parameter from game_startes
constructor and replaces it with a ticks() function in play_controller,
other classes were also changed to use the play_controller::ticks()
function.