mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-18 21:16:49 +00:00

the plan is, that random_new::generator will be a object that does synced random calls during a synced context and otherwise not, so that we cannot create OOS anymore by using random in unsynced actions like select event the intention is also to unfy random calls for attacks and random calls and for other actions like traits and [set_variable] rand= . the synced random generator will be set with the set_scontext_synced object. the new rng will be similar to the old rng used for attacks becasue it will ask the server for a new seed for every new user action (=recruit, attack...) that requires random numbers. Previously there were 2 different random generators, one for attacks, and one for other things, pr 121 is supposed to fix the problems with the "sending data over teh network first" an we try 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 i can also use the same rng for attacks and for other random choices. I also plan to move the code from set/get_random_results to syncec_checkup.cpp later. this commit is part of pr 121.
…
…
The Battle for Wesnoth is a Free, turn-based tactical strategy game with a high fantasy theme, featuring both single-player, and online/hotseat multiplayer combat. Fight a desperate battle to reclaim the throne of Wesnoth, or take hand in any number of other adventures. The game's source code and artwork, sound, and music assets are provided under the terms of the GNU General Public License version 2, or (at your option) any later version. Note that for artwork, sound, and music, we interpret "preferred form of the work for making modifications" as the modifiable form that the author chooses to ship us for the source tree. For convenience, a reference copy of the GNU GPL version 2 is provided in the COPYING file in this distribution. Some portions of the source code can be used under different license terms, whenever stated as such in the source. See INSTALL for instructions on how to build the game from source code. A (translated) description of how to play the game can be found in doc/manual/manual.*.html . For extensive documentation about all aspects of the game, see the official Battle for Wesnoth web site: http://www.wesnoth.org/ The official Battle for Wesnoth Forums (with over 400,000 posts from more than 20,000 registered members) can be found at: http://forums.wesnoth.org/
Description
Languages
INI
51.6%
C++
35.9%
Lua
5.7%
Python
4.3%
Emacs Lisp
1%
Other
1.1%