wesnoth/wesnoth — pull request #121 by gfgtdf (2014-03-19 16:52:41+00:00)
Title: Not ready yet

THIS PATCH IS NOT READY TO PULL YET.

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 patch breaks ai's advancement aspects, but form what i have heared that should be fixable.
this patch might create some unused code, that shall be cleared, especialy i want to remove random.hpp/cpp, rng.hpp/cpp
this patch might contain spelling mistakes.