14 #ifndef SYNCED_CONTEXT_H_INCLUDED
15 #define SYNCED_CONTEXT_H_INCLUDED
26 #include <boost/shared_ptr.hpp>
27 #include <boost/scoped_ptr.hpp>
143 virtual const char*
name()
const = 0;
151 typedef std::deque<std::pair<config,game_events::queued_event>>
event_list;
243 boost::scoped_ptr<leave_synced_context>
leaver_;
boost::scoped_ptr< checkup > new_checkup_
static void add_undo_commands(const config &commands, const game_events::queued_event &ctx)
static bool run_and_store(const std::string &commandname, const config &data, bool use_undo=true, bool show=true, synced_command::error_handler_function error_handler=default_error_function)
void do_final_checkup(bool dont_throw=false)
static bool run(const std::string &commandname, const config &data, bool use_undo=true, bool show=true, synced_command::error_handler_function error_handler=default_error_function)
Sets the context to 'synced', initialises random context, and calls the given function.
static boost::shared_ptr< random_new::rng > get_rng_for_action()
void send_request() const
static std::string generate_random_seed()
virtual config local_choice() const =0
We are in a game with no mp server and need to do this choice locally.
static void add_redo_commands(const config &commands, const game_events::queued_event &ctx)
an object to leave the synced context during draw or unsynced wml items when we don’t know whether w...
GLint GLenum GLsizei GLint GLsizei const GLvoid * data
static synced_state get_synced_state()
static event_list undo_commands_
Actions wml to be executed when the current actio is undone.
static void reset_is_simultaneously()
static void set_last_unit_id(int id)
random_new::rng * old_rng_
boost::shared_ptr< random_new::rng > new_rng_
static synced_state state_
static void just_log_error_function(const std::string &message, bool heavy)
a function to be passed to run_in_synced_context to log the error.
virtual const char * name() const =0
static void ignore_error_function(const std::string &message, bool heavy)
a function to be passed to run_in_synced_context to ignore the error.
boost::scoped_ptr< leave_synced_context > leaver_
events::command_disabler disabler_
std::deque< std::pair< config, game_events::queued_event > > event_list
static void send_user_choice()
called from get_user_choice to send a recently made choice to the other clients.
static void pull_remote_user_input()
called from get_user_choice while waiting for a remove user choice.
static int last_unit_id_
Used to restore the unit id manager when undoing.
static event_list & get_redo_commands()
static bool is_simultaneously()
void show(CVideo &video, const std::string &window_id, const t_string &message, const tpoint &mouse)
Shows a tip.
static event_list redo_commands_
Actions wml to be executed when the current actio is redone.
static checkup * generate_checkup(const std::string &tagname)
A class to check whether the results that were calculated in the replay match the results calculated ...
random_new::rng * old_rng_
static int get_unit_id_diff()
this class does not give synced random results derived classes might do.
Define the game's event mechanism.
static void reset_undo_commands()
set_scontext_synced_base()
static bool run_and_throw(const std::string &commandname, const config &data, bool use_undo=true, bool show=true, synced_command::error_handler_function error_handler=default_error_function)
static bool run_in_synced_context_if_not_already(const std::string &commandname, const config &data, bool use_undo=true, bool show=true, synced_command::error_handler_function error_handler=default_error_function)
checks whether we are currently running in a synced context, and if not we enters it...
static void set_synced_state(synced_state newstate)
GLsizei GLenum GLuint GLuint GLsizei char * message
static void default_error_function(const std::string &message, bool heavy)
a function to be passed to run_in_synced_context to assert false on error (the default).
~set_scontext_synced_base()
std::function< void(const std::string &, bool)> error_handler_function
static void set_is_simultaneously()
static event_list & get_undo_commands()
A config object defines a single node in a WML file, with access to child nodes.
static void reset_redo_commands()
virtual config request() const =0
the request which is sended to the mp server.
GLsizei const GLcharARB ** string
static config ask_server_choice(const server_choice &)
static bool is_simultaneously_