remove side check for require_random

I move this check from the server to the client to fix a possible OOS:
to reproduce:

[event]
name = "turn end"
[set_variable]
name=v1
rand= "1..8"
[/set_variable]
[/event]
[event]
name = "moveto"
[message]
side_for=2
message="adfsd"
[/message]
[set_variable]
name=v2
rand= "1..8"
[/set_variable]
[/event]

Do the following: (in a 2p scenario, with no hidden sides):
1) move side 1 leader
2) ignore the message on side 2
3) click end turn on side 1
4) then click on the message on side 2.
5) ->>OOS.

the reason is, the when the rand for v2 is executed on side 1 the
current_side on the  server is side 1 and when rand for v2 is executed
on side 2 the serversided current_side is side 2 => the server accepted
both require_random
use the new synced_context system

the main intention of that patch is to fix gna.org/bugs/?20871,
gna.org/bugs/?21697, some OOS erros related to use of multiple
[get_global_variable] with different sides in one event.
To remove the deterministic random for traits and similar as discusssed
here http://forums.wesnoth.org/viewtopic.php?f=6&t=39611. And to sync
start end prestart events.

this patch unifies how side commands (like attack, recruit, ...) are
executed, during human turn, replay or ai turn by makeing them al call
the same function scned_context::run_in_scned_context.
We also use the new random generator which is automaticly synced during
the execution of scned_context::run_in_scned_context, and otherwise not.
So we cannot cause oos anymore by using rand= from an unsnced command
like "select"
Alternativeley we can also set the new random synced by using the new
RAII object set_sconext_sycned, this happens for example during prestart
events.
Unlike the old random generator, the new random generator is not
determinstic by default because it asks the server (or itself in a SP
game) for a new seed, at every side command (attack, move, recruit ...)
that requires random ,similar to how the previous rand for attacks
worked (it doesnt ask at the beginning, just the first time it is needed
unlinke how attacks worked before). That way we can also unify the rng
for attacks and for other random choices.

this commit breaks ai's advancement aspects, but form what i have heared
that should be fixable.
this commit might create some unused code, that shall be cleared,
especialy i want to remove random.hpp/cpp, rng.hpp/cpp
this commit might contain spelling mistakes.

these are melded commit (playturn.cpp/replay_controller.cpp/replay::add_config/src/synced_context.cpp)
that
fix a mp bug

it might happen that we land in playmp_controller::play_side but still
have data in the replay that we recieved from network earlier.

this commit also contains small code cleanups.

fix mp observers

the previous code would fail to process
[turn]
[command]
[move]
x = 3,4,5
y = 4,3,3
[/move]
[/command]
[/turn]
[turn]
[command]
dependent = yes
[input]
[/input]
[/command]
[/turn]
because [input] would be processed after [move] was processed, but
[move] need [input] on the replay to work properly.
(if luas sync_choice was called from a moveto event)

fix mp obervers

the provious code would skip important code in the replay if we found
"speak" commands after it.

another commit:

sync end turn events normally

i hesitated to sync end turn events before, because from the server side
of view every action need a clear defined side assiciated to it, from
wich it accepts [require_new_random].
but now i think the server just associates side 1, that means the new
side after the side turn to the action.

this patch also contains some oos error checks,
adding wesnoth.is_synced() #21697
fix an OOS

by moving the code that determines 'which client sends the require_random package to the server' to the client
this commit fixed the following bug (together with another serversided commit):
to reproduce:

[event]
name = "turn end"
[set_variable]
name=v1
rand= "1..8"
[/set_variable]
[/event]
[event]
name = "moveto"
[message]
side_for=2
message="adfsd"
[/message]
[set_variable]
name=v2
rand= "1..8"
[/set_variable]
[/event]

Do the following: (in a 2p scenario, with no hidden sides):
1) move side 1 leader
2) ignore the message on side 2
3) click end turn on side 1
4) then click on the message on side 2.
5) ->>OOS.

the reason is, the when the rand for v2 is executed on side 1 the
current_side on the  server is side 1 and when rand for v2 is executed
on side 2 the serversided current_side is side 2 => the server accepted
both require_random

this bug fixed that by moving the decision which side should send the
require_random to the clients.

this commit might contain spelling corrections.
removed unused rng code.

i also replaced set_random_results/get_random_results with
synced_checkup in recruit_checksums in create.cpp.

i don't see a reason why we shouldn't use the checkup when calling
place_recruit from wml, since the wml is called on all clients. Just
like a normal recruit. (if we are in an unsynced context then checkup
doesnt have any effect anyway.)
begin to implement the deterministic mode.
an additional check when leaving the synced context.
record moves before entering the synced context.
implement the deterministic mode for sp.

the player can now choose whether he want to play a new SP game in the
deterministic mode where he'll get the same results when he reloads a
game.

i don't really know much about the gamestatus cpp/hpp file, so i just
copied from the difficulty code (to create the random_mode attribute).

i think it would also be nice to enable the deterministic mode for MP
but i currently don't know enough about the mp connect code to that.
removed an additional unit checksum check.

we do already check for unit checksums in perform_attack,.
tidy up get_user_choice function
stop replay when we have reached the end.

the old code used to execute one last [end_turn] after the end of the
replay was reached, This doesn't work because the wml might require
[message][option] or similar during "turn end" events and we don't have
the data for that.
bring back unit_advancements_aspect

by moving code from synced_commands.cpp to actions/attack.cpp so that it
can be directly called from ai/actions.cpp
removed unused code
use is_skipping() in replay.
added a check for unit's destination in moves
correct the value of pos_ in replays.
rearrange comments and debuglogs
don't use undo stack for attacks in replay.
delete outcommented lines