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 | Public Attributes | Friends | List of all members
game_state Class Reference

#include <game_state.hpp>

Inheritance diagram for game_state:
Inheritance graph

Public Types

typedef boost::optional
< end_level_data
t_possible_end_level_data
 

Public Member Functions

bool & init_side_done ()
 
game_events::wmi_containerget_wml_menu_items ()
 
const game_events::wmi_containerget_wml_menu_items () const
 
bool has_human_sides () const
 
 game_state (const config &level, play_controller &, const tdata_cache &tdata)
 
 game_state (const config &level, play_controller &, game_board &board)
 The third parameter is an optimisation. More...
 
 ~game_state ()
 
void place_sides_in_preferred_locations (const config &level)
 
void init (const config &level, play_controller &)
 
void set_game_display (game_display *)
 
void write (config &cfg) const
 
virtual const display_contextget_disp_context () const
 
virtual const tod_managerget_tod_man () const
 
virtual const game_dataget_game_data () const
 
virtual game_lua_kernelget_lua_kernel () const
 
bool can_recruit_from (const map_location &leader_loc, int side) const
 Checks to see if a leader at leader_loc could recruit somewhere. More...
 
bool can_recruit_from (const unit &leader) const
 Checks to see if leader (assumed a leader) can recruit somewhere. More...
 
bool can_recruit_on (const map_location &leader_loc, const map_location &recruit_loc, int side) const
 Checks to see if a leader at leader_loc could recruit on recruit_loc. More...
 
bool can_recruit_on (const unit &leader, const map_location &recruit_loc) const
 Checks to see if leader (assumed a leader) can recruit on recruit_loc. More...
 
bool side_can_recruit_on (int side, map_location loc) const
 Checks if any of the sides leaders can recruit at a location. More...
 
- Public Member Functions inherited from filter_context
virtual ~filter_context ()
 

Public Attributes

game_data gamedata_
 
game_board board_
 
tod_manager tod_manager_
 
boost::scoped_ptr
< pathfind::manager
pathfind_manager_
 
boost::scoped_ptr< reportsreports_
 
boost::scoped_ptr
< game_lua_kernel
lua_kernel_
 
boost::scoped_ptr
< game_events::manager
events_manager_
 
boost::scoped_ptr
< actions::undo_list
undo_stack_
 undo_stack_ is never nullptr. More...
 
int player_number_
 
t_possible_end_level_data end_level_data_
 
bool init_side_done_
 
bool start_event_fired_
 
int server_request_number_
 
int first_human_team_
 

Friends

class replay_controller
 

Detailed Description

Definition at line 43 of file game_state.hpp.

Member Typedef Documentation

Definition at line 61 of file game_state.hpp.

Constructor & Destructor Documentation

game_state::game_state ( const config level,
play_controller ,
const tdata_cache tdata 
)
game_state::game_state ( const config level,
play_controller pc,
game_board board 
)

The third parameter is an optimisation.

Definition at line 69 of file game_state.cpp.

References transient_end_level::carryover_report, config::child(), end_level_data_, events_manager_, end_level_data::read(), and end_level_data::transient.

game_state::~game_state ( )

Definition at line 92 of file game_state.cpp.

Member Function Documentation

bool game_state::can_recruit_from ( const map_location leader_loc,
int  side 
) const

Checks to see if a leader at leader_loc could recruit somewhere.

This takes into account terrain, shroud (for side side), and the presence of visible units. The behavior for an invalid side is subject to change for future needs.

Definition at line 296 of file game_state.cpp.

References board_, pathfind::find_vacant_tile(), gamemap::is_keep(), game_board::map(), map_location::null_location(), game_board::teams(), and pathfind::VACANT_CASTLE.

Referenced by can_recruit_from(), and side_can_recruit_on().

bool game_state::can_recruit_from ( const unit leader) const

Checks to see if leader (assumed a leader) can recruit somewhere.

This takes into account terrain, shroud, and the presence of visible units.

Definition at line 316 of file game_state.cpp.

References can_recruit_from(), unit::get_location(), and unit::side().

bool game_state::can_recruit_on ( const map_location leader_loc,
const map_location recruit_loc,
int  side 
) const

Checks to see if a leader at leader_loc could recruit on recruit_loc.

This takes into account terrain, shroud (for side side), and whether or not there is already a visible unit at recruit_loc. The behavior for an invalid side is subject to change for future needs.

Definition at line 328 of file game_state.cpp.

References pathfind::a_star_search(), board_, gamemap::h(), game_board::has_visible_unit(), gamemap::is_castle(), gamemap::is_keep(), game_board::map(), team::shrouded(), pathfind::plain_route::steps, game_board::teams(), and gamemap::w().

Referenced by can_recruit_on(), and side_can_recruit_on().

bool game_state::can_recruit_on ( const unit leader,
const map_location recruit_loc 
) const

Checks to see if leader (assumed a leader) can recruit on recruit_loc.

This takes into account terrain, shroud, and whether or not there is already a visible unit at recruit_loc.

Definition at line 363 of file game_state.cpp.

References can_recruit_on(), unit::get_location(), and unit::side().

virtual const display_context& game_state::get_disp_context ( ) const
inlinevirtual

Implements filter_context.

Definition at line 89 of file game_state.hpp.

References board_.

virtual const game_data* game_state::get_game_data ( ) const
inlinevirtual

Implements filter_context.

Definition at line 91 of file game_state.hpp.

References gamedata_.

virtual game_lua_kernel* game_state::get_lua_kernel ( ) const
inlinevirtual

Implements filter_context.

Definition at line 92 of file game_state.hpp.

virtual const tod_manager& game_state::get_tod_man ( ) const
inlinevirtual

Implements filter_context.

Definition at line 90 of file game_state.hpp.

References tod_manager_.

game_events::wmi_container & game_state::get_wml_menu_items ( )
const game_events::wmi_container & game_state::get_wml_menu_items ( ) const

Definition at line 390 of file game_state.cpp.

References events_manager_.

bool game_state::has_human_sides ( ) const
inline

Definition at line 73 of file game_state.hpp.

void game_state::init ( const config level,
play_controller pc 
)
bool& game_state::init_side_done ( )
inline

Definition at line 67 of file game_state.hpp.

References init_side_done_.

void game_state::place_sides_in_preferred_locations ( const config level)
void game_state::set_game_display ( game_display gd)

Definition at line 224 of file game_state.cpp.

References lua_kernel_.

Referenced by play_controller::init(), and play_controller::reset_gamestate().

bool game_state::side_can_recruit_on ( int  side,
map_location  loc 
) const

Checks if any of the sides leaders can recruit at a location.

Definition at line 368 of file game_state.cpp.

References unit_map::begin(), board_, can_recruit_from(), can_recruit_on(), unit_map::end(), unit_map::find(), and game_board::units().

Referenced by play_controller::hotkey_handler::in_context_menu().

void game_state::write ( config cfg) const

Friends And Related Function Documentation

friend class replay_controller
friend

Definition at line 46 of file game_state.hpp.

Member Data Documentation

game_board game_state::board_

Definition at line 49 of file game_state.hpp.

Referenced by game_lua_kernel::board(), events::menu_handler::board(), can_recruit_from(), can_recruit_on(), playsingle_controller::check_objectives(), play_controller::check_victory(), events::mouse_handler::current_team(), play_controller::current_team(), events::mouse_handler::current_unit_attacks_from(), events::mouse_handler::cycle_units(), play_controller::do_init_side(), play_controller::hotkey_handler::expand_wml_commands(), events::mouse_handler::fill_weapon_choices(), play_controller::find_last_visible_team(), events::mouse_handler::find_unit(), play_controller::finish_side_turn(), events::mouse_handler::get_adj_enemies(), get_disp_context(), play_controller::get_map_const(), events::mouse_handler::get_route(), play_controller::get_teams_const(), play_controller::get_units_const(), init(), play_controller::init(), play_controller::is_observer(), play_controller::is_team_visible(), playmp_controller::linger(), playsingle_controller::linger(), events::menu_handler::map(), game_lua_kernel::map(), events::mouse_handler::mouse_motion(), events::mouse_handler::move_action(), events::mouse_handler::move_unit_along_route(), place_sides_in_preferred_locations(), playsingle_controller::play_scenario(), playsingle_controller::play_scenario_main_loop(), playsingle_controller::play_side_impl(), play_controller::play_turn(), play_controller::reset_gamestate(), events::mouse_handler::select_hex(), events::mouse_handler::show_attack_dialog(), events::mouse_handler::show_attack_options(), playsingle_controller::show_turn_dialog(), side_can_recruit_on(), play_controller::tab(), events::menu_handler::teams(), game_lua_kernel::teams(), events::mouse_handler::unit_in_cycle(), game_lua_kernel::units(), events::menu_handler::units(), events::mouse_handler::viewing_team(), and write().

t_possible_end_level_data game_state::end_level_data_
boost::scoped_ptr<game_events::manager> game_state::events_manager_
int game_state::first_human_team_

Definition at line 72 of file game_state.hpp.

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

game_data game_state::gamedata_
bool game_state::init_side_done_

Definition at line 63 of file game_state.hpp.

Referenced by init_side_done(), and write().

boost::scoped_ptr<game_lua_kernel> game_state::lua_kernel_
boost::scoped_ptr<pathfind::manager> game_state::pathfind_manager_
int game_state::player_number_

Definition at line 59 of file game_state.hpp.

Referenced by write().

boost::scoped_ptr<reports> game_state::reports_

Definition at line 52 of file game_state.hpp.

Referenced by init().

int game_state::server_request_number_
bool game_state::start_event_fired_

Definition at line 64 of file game_state.hpp.

Referenced by play_controller::start_game().

tod_manager game_state::tod_manager_
boost::scoped_ptr<actions::undo_list> game_state::undo_stack_

undo_stack_ is never nullptr.

It is implemented as a pointer so that undo_list can be an incomplete type at this point (which reduces the number of files that depend on actions/undo.hpp).

Definition at line 58 of file game_state.hpp.

Referenced by play_controller::undo_stack(), and write().


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