sync, attack events, start/prestart and more

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 also introduces the optional deterministic mode for SP, where you'll get the same random (attack results, recuits...) results when you relaod a savegame.

finaly this pr also contains a commit that gives a third argument to wesnoth.synchronize_choice that allows to specify on which side the function is evaluated.

previously and afterwards there can be 2 ways an action(attack, rectuit, move...) can be executed: the first way is that the action runs on the local client, and the action is sended over the network as soon as it is completed, this happend in recruits, moves, recall, and some more. The second way is that the action is sended over the network first and is then executed on all clients simultaniously, this happends in attck events, and similar happends in prestart/start events. This is also why mp_sync didn't work in this actions before: side 2 noticed that it needs data from side 1 but side 1 did send the execeution of the action before it generated the  user_input data. That's why side 2 doesn't have the user input data at this point and gives OOS. Previously there was one special and very bugged case when the code waited for remote input before calling get_user_choice to not get an OOS: [get_global_variable]. The most important part of this patch is about moving the "waiting" into get_user_choice so that the caller of get_user_choice don't have to worry about it. With this we can also use get_user_choice if we already sended data over the network. And we can enable the mp_sync in attack related events and prestart events.

Previously there were 2 different random generators, one for attacks, and one for other things, since this patch fixed the problems with the "sending data over teh network first" this patch tries to throw the old rng for non attack things out. So that attacks and other tings use the same rng.

We use a 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 doesn't ask at the beginning, just the first time it is needed unlinke how attacks worked before). That way we can also use the same rng for attacks and for other random choices.

The pr also moves code from do_replay_handle to synced_commands.cpp. The main intention was just to make do_replay_handle.cpp smaller, but this also allows us to call run_in_scned_context from non-replay in most cases. to ensure teh same actuion is executed in replay and non-replay (especialy, before for attacks there was a code for 'advancements after attacks' implemented trice for human turn ai turn and replay.).
But in some cases this function isn't used. because for example in case of ai attacks we want to pass ai_advancement_aspects to attacks, or incase of Moves some functions use move_unit's return value. 

we replace the rng... get/set_random_results by synced_checkup.

unfortunately using rand= or [get_global_variable] during a [filter]lua_function=[/filter] still causes OOS when it's a filter for a ability and you hover the mouse over that unit with the ability while a unit moves.
(note that this want supported before too.)

I did some rebasing and it's quite unlikeley that ALL of the commits still compile on their own, becasue i might have seen overseen some dependencies.


this patch breaks all replays form older versions.
this patch might create some unused code, that shall be cleared, especialy i want to remove random.hpp/cpp, rng.hpp/cpp