#include <game_state.hpp>
Public Types | |
typedef boost::optional < end_level_data > | t_possible_end_level_data |
Public Member Functions | |
bool & | init_side_done () |
game_events::wmi_container & | get_wml_menu_items () |
const game_events::wmi_container & | get_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_context & | get_disp_context () const |
virtual const tod_manager & | get_tod_man () const |
virtual const game_data * | get_game_data () const |
virtual game_lua_kernel * | get_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< reports > | reports_ |
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 |
Definition at line 43 of file game_state.hpp.
typedef boost::optional<end_level_data> game_state::t_possible_end_level_data |
Definition at line 61 of file game_state.hpp.
game_state::game_state | ( | const config & | level, |
play_controller & | , | ||
const tdata_cache & | tdata | ||
) |
Definition at line 47 of file game_state.cpp.
References transient_end_level::carryover_report, config::child(), end_level_data_, end_level_data::read(), and end_level_data::transient.
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.
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().
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
Implements filter_context.
Definition at line 92 of file game_state.hpp.
|
inlinevirtual |
game_events::wmi_container & game_state::get_wml_menu_items | ( | ) |
Definition at line 385 of file game_state.cpp.
References events_manager_.
Referenced by playsingle_controller::hotkey_handler::can_execute_command(), play_controller::hotkey_handler::execute_command(), game_lua_kernel::intf_clear_menu_item(), game_lua_kernel::intf_fire_wml_menu_item(), and game_lua_kernel::intf_set_menu_item().
const game_events::wmi_container & game_state::get_wml_menu_items | ( | ) | const |
Definition at line 390 of file game_state.cpp.
References events_manager_.
|
inline |
Definition at line 73 of file game_state.hpp.
void game_state::init | ( | const config & | level, |
play_controller & | pc | ||
) |
Definition at line 165 of file game_state.cpp.
References tod_manager::add_time_area(), board_, build_team_stage_one(), build_team_stage_two(), config::child_count(), config::child_range(), create_team_builder(), events_manager_, first_human_team_, gamedata_, random_new::generator, display_context::hidden_label_categories_ref(), i, preferences::is_ignored(), LOG_NG, lua_kernel_, game_board::map(), pathfind_manager_, place_sides_in_preferred_locations(), gui2::tloadscreen::progress(), reports_, tod_manager::resolve_random(), game_data::rng(), game_board::teams_, play_controller::ticks(), and tod_manager_.
|
inline |
Definition at line 67 of file game_state.hpp.
References init_side_done_.
Definition at line 130 of file game_state.cpp.
References board_, config::child_range(), i, int(), LOG_NG, game_board::map(), game_board::map_, gamemap::num_valid_starting_positions(), placing_score(), pos, and gamemap::starting_position().
Referenced by init().
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().
Definition at line 229 of file game_state.cpp.
References config::add_child(), board_, end_level_data_, events_manager_, gamedata_, init_side_done_, lua_kernel_, config::merge_with(), pathfind_manager_, game_data::phase(), game_data::PLAY, player_number_, server_request_number_, tod_manager::to_config(), tod_manager_, undo_stack_, game_board::write_config(), and game_data::write_snapshot().
Referenced by play_controller::to_config().
|
friend |
Definition at line 46 of file game_state.hpp.
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_ |
Definition at line 62 of file game_state.hpp.
Referenced by game_state(), play_controller::get_end_level_data_const(), play_controller::is_regular_game_end(), play_controller::reset_end_level_data(), play_controller::set_end_level_data(), and write().
boost::scoped_ptr<game_events::manager> game_state::events_manager_ |
Definition at line 54 of file game_state.hpp.
Referenced by game_state(), get_wml_menu_items(), init(), play_controller::init(), game_lua_kernel::intf_add_event(), game_lua_kernel::intf_is_skipping_messages(), game_lua_kernel::intf_log(), game_lua_kernel::intf_remove_event(), game_lua_kernel::intf_skip_messages(), play_controller::pump(), play_controller::reset_gamestate(), and write().
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_ |
Definition at line 48 of file game_state.hpp.
Referenced by playmp_controller::hotkey_handler::can_execute_command(), play_controller::do_init_side(), play_controller::hotkey_handler::execute_command(), play_controller::hotkey_handler::expand_wml_commands(), play_controller::fire_preload(), play_controller::fire_prestart(), play_controller::fire_start(), game_lua_kernel::gamedata(), events::menu_handler::gamedata(), get_game_data(), init(), play_controller::init(), play_controller::init_side_begin(), play_controller::is_browsing(), play_controller::maybe_do_init_side(), playmp_controller::maybe_linger(), play_controller::reset_gamestate(), play_controller::start_game(), and write().
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_ |
Definition at line 53 of file game_state.hpp.
Referenced by events::console_handler::do_lua(), events::console_handler::do_unsafe_lua(), init(), play_controller::init(), events::mouse_handler::mouse_motion(), events::mouse_handler::move_action(), events::menu_handler::objectives(), play_controller::reset_gamestate(), events::mouse_handler::select_hex(), set_game_display(), and write().
boost::scoped_ptr<pathfind::manager> game_state::pathfind_manager_ |
Definition at line 51 of file game_state.hpp.
Referenced by init(), play_controller::init(), play_controller::reset_gamestate(), and write().
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_ |
Definition at line 66 of file game_state.hpp.
Referenced by play_controller::get_server_request_number(), play_controller::increase_server_request_number(), and write().
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_ |
Definition at line 50 of file game_state.hpp.
Referenced by play_controller::check_time_over(), play_controller::do_init_side(), events::console_handler::do_turn(), get_tod_man(), play_controller::get_tod_manager_const(), init(), play_controller::init(), play_controller::init_side_end(), replay_controller::play_side_impl(), replay_controller::replay_next_turn(), play_controller::reset_gamestate(), game_lua_kernel::tod_man(), play_controller::turn(), and write().
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().