The Battle for Wesnoth  1.19.7+dev
Classes | Namespaces
synced_user_choice.hpp File Reference
#include "gettext.hpp"
#include "config.hpp"
#include "events.hpp"
#include "generic_event.hpp"
#include <map>
#include <set>
Include dependency graph for synced_user_choice.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mp_sync::user_choice
 Interface for querying local choices. More...
 
class  user_choice_manager
 

Namespaces

 mp_sync
 

Functions

replay commands as legal from

Performs a choice for WML events.

The choice is synchronized across all the multiplayer clients and stored into the replay. The function object is called if the local client is responsible for making the choice. otherwise this function waits for a remote choice and returns it when it is received. information about the choice made is saved in replay with dependent=true

Parameters
nameTag used for storing the choice into the replay.
sideThe number of the side responsible for making the choice. If zero, it defaults to the currently active side.
Note
In order to prevent issues with sync, crash, or infinite loop, a number of precautions must be taken when getting a choice from a specific side.
  • The server must recognize non-active players. Preferably the server should be notified about which player the data is expected from, and discard data from unexpected players.
config mp_sync::get_user_choice (const std::string &name, const user_choice &uch, int side=0)
 
std::map< int, configmp_sync::get_user_choice_multiple_sides (const std::string &name, const user_choice &uch, std::set< int > sides)
 Performs a choice for multiple sides for WML events. More...