The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
turn_info Class Reference

TODO: rename this class since it isn't that much related to turns. More...

#include <playturn.hpp>

Public Types

enum  PROCESS_DATA_RESULT {
  PROCESS_CONTINUE, PROCESS_RESTART_TURN, PROCESS_END_TURN, PROCESS_END_LINGER,
  PROCESS_FOUND_DEPENDENT, PROCESS_END_LEVEL
}
 

Public Member Functions

 turn_info (replay_network_sender &network_sender, playturn_network_adapter &network_reader)
 
 ~turn_info ()
 
PROCESS_DATA_RESULT sync_network ()
 
void send_data ()
 
PROCESS_DATA_RESULT process_network_data (const config &cfg)
 
PROCESS_DATA_RESULT process_network_data_from_reader ()
 
events::generic_eventhost_transfer ()
 

Static Public Member Functions

static PROCESS_DATA_RESULT replay_to_process_data_result (REPLAY_RETURN replayreturn)
 

Private Member Functions

PROCESS_DATA_RESULT handle_turn (const config &t)
 
void do_save ()
 

Static Private Member Functions

static void change_side_controller (int side, const std::string &player)
 

Private Attributes

replay_network_senderreplay_sender_
 
events::generic_event host_transfer_
 
playturn_network_adapternetwork_reader_
 

Detailed Description

TODO: rename this class since it isn't that much related to turns.

Definition at line 28 of file playturn.hpp.

Member Enumeration Documentation

Enumerator
PROCESS_CONTINUE 
PROCESS_RESTART_TURN 
PROCESS_END_TURN 
PROCESS_END_LINGER 

When the host uploaded the next scenario this is returned.

PROCESS_FOUND_DEPENDENT 

When we couldn't process the network data because we found a dependent command, this should only happen if we were called playmp_controller::from handle_generic_event -> sync_network.

PROCESS_END_LEVEL 

We foudn a player action in the replay that caused the game to end.

Definition at line 37 of file playturn.hpp.

Constructor & Destructor Documentation

turn_info::turn_info ( replay_network_sender network_sender,
playturn_network_adapter network_reader 
)

Definition at line 53 of file playturn.cpp.

turn_info::~turn_info ( )

Definition at line 60 of file playturn.cpp.

Member Function Documentation

void turn_info::change_side_controller ( int  side,
const std::string player 
)
staticprivate
void turn_info::do_save ( )
private

Definition at line 104 of file playturn.cpp.

References resources::controller, and play_controller::do_autosave().

Referenced by process_network_data().

turn_info::PROCESS_DATA_RESULT turn_info::handle_turn ( const config t)
private
Todo:
FIXME: Check what commands we execute when it's our turn!

Definition at line 92 of file playturn.cpp.

References replay::add_config(), config::all_children_count(), do_replay(), replay::MARK_AS_SENT, resources::recorder, and replay_to_process_data_result().

Referenced by process_network_data().

events::generic_event& turn_info::host_transfer ( )
inline
turn_info::PROCESS_DATA_RESULT turn_info::process_network_data ( const config cfg)

Definition at line 126 of file playturn.cpp.

References _(), display_chat_manager::add_chat_message(), display_chat_manager::add_observer(), config::all_children_count(), config::attribute_range(), change_side_controller(), config::child(), resources::controller, team::current_player(), config::debug(), do_save(), ERR_NW, display::find_action_button(), resources::gameboard, resources::gamedata, game_display::get_chat_manager(), handle_turn(), config::has_child(), host_transfer_, team::is_local(), team::is_local_human(), display::labels(), preferences::message_bell(), events::chat_handler::MESSAGE_PRIVATE, events::chat_handler::MESSAGE_PUBLIC, game_logic::msg(), game_data::next_scenario(), events::generic_event::notify_observers(), play_controller::on_not_observer(), preferences::options(), game_display::playing_side(), PROCESS_CONTINUE, PROCESS_END_LINGER, PROCESS_RESTART_TURN, map_labels::recalculate_labels(), display::recalculate_minimap(), resources::recorder, display::redraw_everything(), display_chat_manager::remove_observer(), resources::screen, gui2::tsimple_item_selector::selected_index(), gui2::tsimple_item_selector::set_single_button(), display::set_team(), gui2::tdialog::show(), game_board::side_change_controller(), game_board::side_drop_to(), resources::teams, teams, game_board::teams(), throw_quit_game_exception(), vgettext(), and resources::whiteboard.

Referenced by playmp_controller::play_linger_turn(), playmp_controller::process_network_data(), process_network_data_from_reader(), and sync_network().

turn_info::PROCESS_DATA_RESULT turn_info::process_network_data_from_reader ( )
turn_info::PROCESS_DATA_RESULT turn_info::replay_to_process_data_result ( REPLAY_RETURN  replayreturn)
static
void turn_info::send_data ( )
turn_info::PROCESS_DATA_RESULT turn_info::sync_network ( )

Member Data Documentation

events::generic_event turn_info::host_transfer_
private

Definition at line 71 of file playturn.hpp.

Referenced by host_transfer(), and process_network_data().

playturn_network_adapter& turn_info::network_reader_
private

Definition at line 73 of file playturn.hpp.

Referenced by process_network_data_from_reader(), and sync_network().

replay_network_sender& turn_info::replay_sender_
private

Definition at line 69 of file playturn.hpp.

Referenced by send_data().


The documentation for this class was generated from the following files: