play_controller Class Reference

#include <play_controller.hpp>

Inheritance diagram for play_controller:

Inheritance graph
[legend]
Collaboration diagram for play_controller:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 play_controller (const config &level, game_state &state_of_game, int ticks, int num_turns, const config &game_config, CVideo &video, bool skip_replay, bool is_replay)
 ~play_controller ()
virtual void play_slice ()
virtual void handle_generic_event (const std::string &)
virtual void objectives ()
virtual void show_statistics ()
virtual void unit_list ()
virtual void status_table ()
virtual void save_game ()
virtual void save_replay ()
virtual void save_map ()
virtual void load_game ()
virtual void preferences ()
virtual void show_chat_log ()
virtual void show_help ()
virtual void cycle_units ()
virtual void cycle_back_units ()
virtual void undo ()
virtual void redo ()
virtual void show_enemy_moves (bool ignore_units)
virtual void goto_leader ()
virtual void unit_description ()
virtual void toggle_grid ()
virtual void search ()
virtual void play_side (const unsigned int team_num, bool save)=0
int get_ticks ()

Protected Member Functions

void handle_event (const SDL_Event &event)
 Process mouse- and keypress-events from SDL.
virtual std::string get_action_image (hotkey::HOTKEY_COMMAND, int index) const
virtual hotkey::ACTION_STATE get_action_state (hotkey::HOTKEY_COMMAND command) const
virtual bool can_execute_command (hotkey::HOTKEY_COMMAND command, int index=-1) const
 Check if a command can be executed.
virtual bool execute_command (hotkey::HOTKEY_COMMAND command, int index=-1)
void show_menu (const std::vector< std::string > &items_arg, int xloc, int yloc, bool context_menu)
bool in_context_menu (hotkey::HOTKEY_COMMAND command) const
 Determines whether the command should be in the context menu or not.
virtual void init (CVideo &video, bool is_replay)
void init_managers ()
void fire_prestart (bool execute)
void fire_start (bool execute)
virtual void init_gui ()
virtual void init_side (const unsigned int team_index, bool is_replay=false)
void place_sides_in_preferred_locations (gamemap &map, const config::child_list &sides)
virtual void finish_side_turn ()
void finish_turn ()
bool clear_shroud ()
bool enemies_visible () const
void enter_textbox ()
teamcurrent_team ()
const teamcurrent_team () const
int find_human_team_before (const size_t team) const
 Find a human team (ie one we own) starting backwards from 'team_num'.

Protected Attributes

const verification_manager verify_manager_
teams_manager team_manager_
preferences::display_managerprefs_disp_manager_
tooltips::managertooltips_manager_
game_events::managerevents_manager_
halo::managerhalo_manager_
font::floating_label_context labels_manager_
help::help_manager help_manager_
events::mouse_handler mouse_handler_
events::menu_handler menu_handler_
soundsource::managersoundsources_manager_
game_displaygui_
const set_random_generator generator_setter
const statistics::scenario_context statistics_context_
const configlevel_
const configgame_config_
std::vector< teamteams_
game_stategamestate_
gamestatus status_
gamemap map_
unit_map units_
undo_list undo_stack_
undo_list redo_stack_
const int ticks_
const
unit_type::experience_accelerator 
xp_mod_
const bool loading_game_
CKey key_
int first_human_team_
unsigned int player_number_
unsigned int first_player_
unsigned int start_turn_
bool is_host_
bool skip_replay_
bool browse_
bool linger_
bool scrolling_
bool first_turn_

Private Member Functions

void expand_autosaves (std::vector< std::string > &items)
void expand_wml_commands (std::vector< std::string > &items)

Private Attributes

std::vector< std::string > savenames_
std::vector< wml_menu_item * > wml_commands_


Detailed Description

Definition at line 40 of file play_controller.hpp.


Constructor & Destructor Documentation

play_controller::play_controller ( const config level,
game_state state_of_game,
int  ticks,
int  num_turns,
const config game_config,
CVideo video,
bool  skip_replay,
bool  is_replay 
)

play_controller::~play_controller (  ) 


Member Function Documentation

void play_controller::play_slice (  )  [virtual]

virtual void play_controller::handle_generic_event ( const std::string &   )  [inline, virtual]

Implements events::observer.

Reimplemented in playmp_controller, playsingle_controller, and replay_controller.

Definition at line 51 of file play_controller.hpp.

void play_controller::objectives (  )  [virtual]

Reimplemented from hotkey::command_executor.

Definition at line 226 of file play_controller.cpp.

References menu_handler_, events::menu_handler::objectives(), and player_number_.

Referenced by play_slice().

void play_controller::show_statistics (  )  [virtual]

void play_controller::unit_list (  )  [virtual]

Reimplemented from hotkey::command_executor.

Definition at line 234 of file play_controller.cpp.

References menu_handler_, and events::menu_handler::unit_list().

void play_controller::status_table (  )  [virtual]

Reimplemented from hotkey::command_executor.

Definition at line 238 of file play_controller.cpp.

References menu_handler_, and events::menu_handler::status_table().

void play_controller::save_game (  )  [virtual]

Reimplemented from hotkey::command_executor.

Definition at line 242 of file play_controller.cpp.

References menu_handler_, gui::OK_CANCEL, and events::menu_handler::save_game().

void play_controller::save_replay (  )  [virtual]

Reimplemented from hotkey::command_executor.

Definition at line 246 of file play_controller.cpp.

References menu_handler_, gui::OK_CANCEL, and events::menu_handler::save_game().

void play_controller::save_map (  )  [virtual]

Reimplemented from hotkey::command_executor.

Definition at line 250 of file play_controller.cpp.

References menu_handler_, and events::menu_handler::save_map().

void play_controller::load_game (  )  [virtual]

Reimplemented from hotkey::command_executor.

Definition at line 254 of file play_controller.cpp.

References events::menu_handler::load_game(), and menu_handler_.

void play_controller::preferences (  )  [virtual]

Reimplemented from hotkey::command_executor.

Reimplemented in replay_controller.

Definition at line 258 of file play_controller.cpp.

References menu_handler_, and events::menu_handler::preferences().

Referenced by replay_controller::preferences().

void play_controller::show_chat_log (  )  [virtual]

Reimplemented from hotkey::command_executor.

Definition at line 270 of file play_controller.cpp.

References menu_handler_, and events::menu_handler::show_chat_log().

void play_controller::show_help (  )  [virtual]

Reimplemented from hotkey::command_executor.

Definition at line 274 of file play_controller.cpp.

References menu_handler_, and events::menu_handler::show_help().

void play_controller::cycle_units (  )  [virtual]

Reimplemented from hotkey::command_executor.

Definition at line 262 of file play_controller.cpp.

References browse_, events::mouse_handler::cycle_units(), and mouse_handler_.

void play_controller::cycle_back_units (  )  [virtual]

Reimplemented from hotkey::command_executor.

Definition at line 266 of file play_controller.cpp.

References browse_, events::mouse_handler::cycle_back_units(), and mouse_handler_.

void play_controller::undo (  )  [virtual]

void play_controller::redo (  )  [virtual]

void play_controller::show_enemy_moves ( bool  ignore_units  )  [virtual]

void play_controller::goto_leader (  )  [virtual]

Reimplemented from hotkey::command_executor.

Definition at line 294 of file play_controller.cpp.

References events::menu_handler::goto_leader(), menu_handler_, and player_number_.

void play_controller::unit_description (  )  [virtual]

void play_controller::toggle_grid (  )  [virtual]

Reimplemented from hotkey::command_executor.

Definition at line 302 of file play_controller.cpp.

References menu_handler_, and events::menu_handler::toggle_grid().

void play_controller::search (  )  [virtual]

Reimplemented from hotkey::command_executor.

Definition at line 306 of file play_controller.cpp.

References menu_handler_, and events::menu_handler::search().

virtual void play_controller::play_side ( const unsigned int  team_num,
bool  save 
) [pure virtual]

int play_controller::get_ticks (  ) 

Definition at line 310 of file play_controller.cpp.

References ticks_.

void play_controller::handle_event ( const SDL_Event &  event  )  [protected, virtual]

std::string play_controller::get_action_image ( hotkey::HOTKEY_COMMAND  command,
int  index 
) const [protected, virtual]

Reimplemented from hotkey::command_executor.

Definition at line 969 of file play_controller.cpp.

References wml_menu_item::image, wml_commands_, and game_config::wml_menu_image.

hotkey::ACTION_STATE play_controller::get_action_state ( hotkey::HOTKEY_COMMAND  command  )  const [protected, virtual]

bool play_controller::can_execute_command ( hotkey::HOTKEY_COMMAND  command,
int  index = -1 
) const [protected, virtual]

Check if a command can be executed.

Implements hotkey::command_executor.

Reimplemented in playmp_controller, playsingle_controller, and replay_controller.

Definition at line 500 of file play_controller.cpp.

References events::commands_disabled, events::menu_handler::current_unit(), unit_map::end(), enemies_visible(), gui_, hotkey::HOTKEY_ACCELERATED, hotkey::HOTKEY_AI_FORMULA, hotkey::HOTKEY_BEST_ENEMY_MOVES, hotkey::HOTKEY_CHAT_LOG, hotkey::HOTKEY_CLEAR_MSG, hotkey::HOTKEY_CUSTOM_CMD, hotkey::HOTKEY_CYCLE_BACK_UNITS, hotkey::HOTKEY_CYCLE_UNITS, hotkey::HOTKEY_FULLSCREEN, hotkey::HOTKEY_HELP, hotkey::HOTKEY_LEADER, hotkey::HOTKEY_LOAD_GAME, hotkey::HOTKEY_MAP_SCREENSHOT, hotkey::HOTKEY_MOUSE_SCROLL, hotkey::HOTKEY_MUTE, hotkey::HOTKEY_OBJECTIVES, hotkey::HOTKEY_PREFERENCES, hotkey::HOTKEY_QUIT_GAME, hotkey::HOTKEY_REDO, hotkey::HOTKEY_RENAME_UNIT, hotkey::HOTKEY_SAVE_GAME, hotkey::HOTKEY_SAVE_MAP, hotkey::HOTKEY_SAVE_REPLAY, hotkey::HOTKEY_SCREENSHOT, hotkey::HOTKEY_SEARCH, hotkey::HOTKEY_SHOW_ENEMY_MOVES, hotkey::HOTKEY_STATISTICS, hotkey::HOTKEY_STATUS_TABLE, hotkey::HOTKEY_TOGGLE_GRID, hotkey::HOTKEY_UNDO, hotkey::HOTKEY_UNIT_DESCRIPTION, hotkey::HOTKEY_UNIT_LIST, hotkey::HOTKEY_USER_CMD, hotkey::HOTKEY_ZOOM_DEFAULT, hotkey::HOTKEY_ZOOM_IN, hotkey::HOTKEY_ZOOM_OUT, linger_, menu_handler_, mouse_handler_, network::nconnections(), redo_stack_, savenames_, teams_, undo_stack_, units_, game_display::viewing_team(), and wml_commands_.

Referenced by replay_controller::can_execute_command(), playsingle_controller::can_execute_command(), and show_menu().

bool play_controller::execute_command ( hotkey::HOTKEY_COMMAND  command,
int  index = -1 
) [protected, virtual]

void play_controller::show_menu ( const std::vector< std::string > &  items_arg,
int  xloc,
int  yloc,
bool  context_menu 
) [protected]

bool play_controller::in_context_menu ( hotkey::HOTKEY_COMMAND  command  )  const [protected]

Determines whether the command should be in the context menu or not.

Independant of whether or not we can actually execute the command.

Definition at line 948 of file play_controller.cpp.

References can_recruit_on(), unit_map::end(), events::mouse_handler::get_last_hex(), hotkey::HOTKEY_RECALL, hotkey::HOTKEY_RECRUIT, hotkey::HOTKEY_REPEAT_RECRUIT, map_, mouse_handler_, player_number_, team_leader(), and units_.

Referenced by show_menu().

void play_controller::init ( CVideo video,
bool  is_replay 
) [protected, virtual]

void play_controller::init_managers (  )  [protected]

void play_controller::fire_prestart ( bool  execute  )  [protected]

void play_controller::fire_start ( bool  execute  )  [protected]

void play_controller::init_gui (  )  [protected, virtual]

void play_controller::init_side ( const unsigned int  team_index,
bool  is_replay = false 
) [protected, virtual]

void play_controller::place_sides_in_preferred_locations ( gamemap map,
const config::child_list sides 
) [protected]

void play_controller::finish_side_turn (  )  [protected, virtual]

void play_controller::finish_turn (  )  [protected]

bool play_controller::clear_shroud (  )  [protected]

bool play_controller::enemies_visible (  )  const [protected]

void play_controller::enter_textbox (  )  [protected]

team & play_controller::current_team (  )  [protected]

const team & play_controller::current_team (  )  const [protected]

Definition at line 620 of file play_controller.cpp.

References player_number_, and teams_.

int play_controller::find_human_team_before ( const size_t  team  )  const [protected]

Find a human team (ie one we own) starting backwards from 'team_num'.

Definition at line 627 of file play_controller.cpp.

References teams_.

Referenced by playsingle_controller::play_side(), and playmp_controller::play_side().

void play_controller::expand_autosaves ( std::vector< std::string > &  items  )  [private]

void play_controller::expand_wml_commands ( std::vector< std::string > &  items  )  [private]


Member Data Documentation

Definition at line 107 of file play_controller.hpp.

Definition at line 108 of file play_controller.hpp.

Referenced by init(), init_side(), and playsingle_controller::play_scenario().

Definition at line 109 of file play_controller.hpp.

Referenced by init_managers(), and ~play_controller().

Definition at line 110 of file play_controller.hpp.

Referenced by init_managers(), and ~play_controller().

Definition at line 112 of file play_controller.hpp.

Referenced by init_managers(), and ~play_controller().

Definition at line 113 of file play_controller.hpp.

Definition at line 114 of file play_controller.hpp.

Definition at line 120 of file play_controller.hpp.

Referenced by playsingle_controller::after_human_turn(), playsingle_controller::before_human_turn(), playmp_controller::before_human_turn(), playsingle_controller::can_execute_command(), can_execute_command(), replay_controller::continue_replay(), enemies_visible(), enter_textbox(), execute_command(), finish_side_turn(), finish_turn(), fire_prestart(), handle_event(), playsingle_controller::handle_generic_event(), playmp_controller::handle_generic_event(), init(), replay_controller::init_gui(), playsingle_controller::init_gui(), init_gui(), init_managers(), replay_controller::init_replay_display(), init_side(), playsingle_controller::linger(), playmp_controller::linger(), playsingle_controller::play_ai_turn(), playsingle_controller::play_human_turn(), playmp_controller::play_human_turn(), playmp_controller::play_network_turn(), replay_controller::play_replay(), playsingle_controller::play_scenario(), replay_controller::play_side(), playsingle_controller::play_side(), playmp_controller::play_side(), play_slice(), replay_controller::play_turn(), playsingle_controller::play_turn(), replay_controller::rebuild_replay_theme(), replay_controller::replay_next_side(), replay_controller::replay_next_turn(), replay_controller::replay_show_team1(), playmp_controller::reset_end_scenario_button(), replay_controller::reset_replay(), playmp_controller::set_end_scenario_button(), show_menu(), replay_controller::show_statistics(), show_statistics(), replay_controller::stop_replay(), replay_controller::update_teams(), playmp_controller::wait_for_upload(), ~play_controller(), and replay_controller::~replay_controller().

Definition at line 121 of file play_controller.hpp.

Definition at line 122 of file play_controller.hpp.

const config& play_controller::level_ [protected]

Definition at line 124 of file play_controller.hpp.

Referenced by init(), and replay_controller::rebuild_replay_theme().

std::vector<team> play_controller::teams_ [protected]

Definition at line 131 of file play_controller.hpp.

Referenced by can_execute_command().

const int play_controller::ticks_ [protected]

Definition at line 134 of file play_controller.hpp.

const bool play_controller::loading_game_ [protected]

Definition at line 139 of file play_controller.hpp.

unsigned int play_controller::player_number_ [protected]

unsigned int play_controller::first_player_ [protected]

unsigned int play_controller::start_turn_ [protected]

Definition at line 143 of file play_controller.hpp.

Referenced by init_side().

bool play_controller::is_host_ [protected]

bool play_controller::browse_ [protected]

bool play_controller::linger_ [protected]

bool play_controller::scrolling_ [protected]

Definition at line 148 of file play_controller.hpp.

Referenced by play_slice().

bool play_controller::first_turn_ [protected]

Definition at line 149 of file play_controller.hpp.

Referenced by fire_start(), and init_side().

std::vector<std::string> play_controller::savenames_ [private]

Definition at line 154 of file play_controller.hpp.

Referenced by can_execute_command(), execute_command(), and expand_autosaves().


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

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs