42 #define LOG_NG LOG_STREAM(info, log_engine)
49 game_config, tdata, video, mp_info && mp_info->skip_replay_until_turn != 0)
50 , network_processing_stopped_(false)
51 , blindfold_(*gui_, mp_info && mp_info->skip_replay_blindfolded)
74 LOG_NG <<
"network processing activated again";
79 LOG_NG <<
"network processing stopped";
94 if (
gui_->is_blindfolded()) {
96 LOG_NG <<
"Taking off the blindfold now " << std::endl;
97 gui_->redraw_everything();
122 LOG_NG <<
"playmp::play_human_turn...\n";
125 boost::scoped_ptr<countdown_clock> timer;
153 SDL_Color
color = {255,255,255,SDL_ALPHA_OPAQUE};
155 SDL_Rect rect =
gui_->map_area();
171 bool time_left = timer->update();
191 LOG_NG <<
"playmp::play_human_turn...\n";
217 std::shared_ptr<gui::button> btn_end =
gui_->find_action_button(
"button-endturn");
218 btn_end->enable(
false);
220 gui_->get_theme().refresh_title2(
"button-endturn",
"title2");
221 gui_->invalidate_theme();
222 gui_->redraw_everything();
228 gui_->get_theme().refresh_title2(
"button-endturn",
"title");
229 gui_->invalidate_theme();
230 gui_->redraw_everything();
236 LOG_NG <<
"beginning end-of-scenario linger\n";
260 LOG_NG <<
"finished human turn" << std::endl;
262 LOG_NG <<
"caught load-game-exception" << std::endl;
266 LOG_NG <<
"caught network-error-exception" << std::endl;
273 LOG_NG <<
"ending end-of-scenario linger\n";
321 LOG_NG <<
"playmp::after_human_turn...\n";
331 LOG_NG <<
"is networked...\n";
353 LOG_NG <<
"finished networked...\n";
361 info[
"type"] =
"termination";
362 info[
"condition"] =
"out of sync";
365 std::stringstream temp_buf;
366 std::vector<std::string> err_lines =
utils::split(err_msg,
'\n');
367 temp_buf <<
_(
"The game is out of sync, and cannot continue. There are a number of reasons this could happen: this can occur if you or another player have modified their game settings. This may mean one of the players is attempting to cheat. It could also be due to a bug in the game, but this is less likely.\n\nDo you want to save an error log of your game?");
368 if(!err_msg.empty()) {
369 temp_buf <<
" \n \n";
372 temp_buf << *
i <<
'\n';
384 if (name ==
"ai_user_interact")
389 else if (name ==
"ai_gamestate_changed")
393 else if (name ==
"host_transfer"){
398 gui_->invalidate_theme();
409 gui_->get_chat_manager().add_chat_message(time(
nullptr),
"", 0,
410 _(
"This side is in an idle state. To proceed with the game, it must be assigned to another controller. You may use :droid, :control or :give_control for example."),
420 if(!
is_host() && has_next_scenario) {
bool disable_auto_moves()
void clear()
Clears the stack of undoable (and redoable) actions.
void set_all_units_user_end_turn()
bool player_type_changed_
int skip_replay_until_turn
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)
events::generic_event & host_transfer()
void turn_changed(const std::string &player_name)
const end_level_data & get_end_level_data_const() const
void add_countdown_update(int value, int team)
static lg::log_domain log_engine("engine")
virtual void after_human_turn()
void set_clip_rect(const SDL_Rect &r)
virtual void handle_generic_event(const std::string &name)
bool is_networked_mp() const override
void send_to_wesnothd(const config &cfg, const std::string &packet_type="unknown") const override
virtual void play_linger_turn()
bool save_game_interactive(CVideo &video, const std::string &message, gui::DIALOG_TYPE dialog_type)
Save a game interactively through the savegame dialog.
bool receive_data(config &result)
PROCESS_DATA_RESULT sync_network()
void undo()
Undoes the top action on the undo stack.
void reset_end_scenario_button()
And endturn was required eigher by the player, by the ai or by [end_turn].
void play_slice(bool is_delay_enabled=true)
void set_countdown_time(const int amount) const
boost::scoped_ptr< hotkey_handler > hotkey_handler_
REPLAY_RETURN do_replay(bool one_move)
Contains the exception interfaces used to signal completion of a scenario, campaign or turn...
PROCESS_DATA_RESULT process_network_data_from_reader()
bool ignore_replay_errors_
no linger overlay, show fog and shroud.
void set_source(source_type source)
virtual ~playmp_controller()
void process_network_data()
static config get_update_shroud()
Records that the player has manually updated fog/shroud.
virtual void check_objectives()
virtual void play_side_impl()
void send_data(const configr_of &request)
void end_turn_enable(bool enable)
static UNUSEDNOWARN std::string _(const char *str)
void throw_quit_game_exception()
virtual void play_side_impl()
void wait_for_upload()
Wait for the host to upload the next scenario.
bool network_processing_stopped_
int current_side() const
Returns the number of the side whose turn it is.
int mp_countdown_action_bonus
bool is_regular_game_end() const
void set_lifetime(int lifetime)
We received invalid data from wesnothd during a game This means we cannot continue with the game but ...
virtual void play_human_turn()
void pull_remote_choice()
virtual void do_idle_notification()
Will handle sending a networked notification in descendent classes.
void set_color(const SDL_Color &color)
mp_campaign_info * mp_info_
config & add_child(const std::string &key)
virtual void play_idle_loop()
void set_position(double xpos, double ypos)
twesnothd_connection & wesnothd_connection
static bool quit()
Shows the quit confirmation if needed.
void update_gui_to_player(const int team_index, const bool observe=false)
Changes the UI for this client to the passed side index.
int mp_countdown_reservoir_time
static void process_error(const std::string &msg)
bool network_receive_dialog(CVideo &video, const std::string &msg, config &cfg, twesnothd_connection &wesnothd_connection)
An extension of playsingle_controller::hotkey_handler, which has support for MP wesnoth features like...
virtual bool attach_handler(observer *obs)
PROCESS_DATA_RESULT process_network_data(const config &cfg)
When the host uploaded the next scenario this is returned.
We foudn a player action in the replay that caused the game to end.
void process_oos(const std::string &err_msg) const
Asks the user whether to continue on an OOS error.
Game configuration data as global variables.
const std::string & next_scenario() const
Exception used to signal that the user has decided to abort a game, and to load another game instead...
The turn was not ended yet.
int add_floating_label(const floating_label &flabel)
add a label floating on the screen above everything else.
static source_type get_source_from_config(config &src)
void set_end_scenario_button()
actions::undo_list & undo_stack()
static void save(LexState *ls, int c)
GLuint const GLchar * name
virtual void on_not_observer()
virtual void after_human_turn()
playmp_controller(const config &level, saved_game &state_of_game, const config &game_config, const tdata_cache &tdata, CVideo &video, mp_campaign_info *mp_info)
int countdown_time() const
virtual void handle_generic_event(const std::string &name)
playturn_network_adapter network_reader_
Various functions that implement the undoing (and redoing) of in-game commands.
void set_action_bonus_count(const int count)
Standard logging facilities (interface).
virtual bool detach_handler(observer *obs)
static PROCESS_DATA_RESULT replay_to_process_data_result(REPLAY_RETURN replayreturn)
boost::scoped_ptr< game_display > gui_
std::vector< std::string > split(std::string const &val, const char c, const int flags)
Splits a (comma-)separated string into a vector of pieces.
int mp_countdown_turn_bonus
A config object defines a single node in a WML file, with access to child nodes.
virtual bool should_return_to_play_side()
int action_bonus_count() const
mp_game_settings & mp_settings()
Multiplayer parameters for this game.
virtual void play_network_turn()
Will handle networked turns in descendent classes.
GLsizei const GLcharARB ** string
bool recieve_from_wesnothd(config &cfg) const override
An [end_turn] was added to the replay.