The Battle for Wesnoth  1.15.2+dev
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
game_launcher Class Reference

#include <game_launcher.hpp>

Public Types

enum  mp_selection { MP_CONNECT, MP_HOST, MP_LOCAL }
 
enum  unit_test_result : int { unit_test_result::TEST_PASS = 0, unit_test_result::TEST_FAIL = 1, unit_test_result::TEST_FAIL_LOADING_REPLAY = 3, unit_test_result::TEST_FAIL_PLAYING_REPLAY = 4 }
 Status code after running a unit test, should match the run_wml_tests script and the documentation for the –unit_test command-line option. More...
 
enum  RELOAD_GAME_DATA { RELOAD_DATA, NO_RELOAD_DATA }
 

Public Member Functions

 game_launcher (const commandline_options &cmdline_opts, const char *appname)
 
 ~game_launcher ()
 
CVideovideo ()
 
bool init_video ()
 
bool init_language ()
 
bool init_lua_script ()
 
bool play_test ()
 
bool play_screenshot_mode ()
 
bool play_render_image_mode ()
 
unit_test_result unit_test ()
 Runs unit tests specified on the command line. More...
 
bool is_loading () const
 
void clear_loaded_game ()
 
bool load_game ()
 
void set_tutorial ()
 
void set_test (const std::string &id)
 
std::string jump_to_campaign_id () const
 Return the ID of the campaign to jump to (skipping the main menu). More...
 
bool new_campaign ()
 
bool goto_campaign ()
 
bool goto_multiplayer ()
 
bool goto_editor ()
 
bool jump_to_editor () const
 
void select_mp_server (const std::string &server)
 
bool play_multiplayer (mp_selection res)
 
bool play_multiplayer_commandline ()
 
bool change_language ()
 
void show_preferences ()
 
void launch_game (RELOAD_GAME_DATA reload=RELOAD_DATA)
 
void play_replay ()
 
editor::EXIT_STATUS start_editor ()
 
void start_wesnothd ()
 
const commandline_optionsopts () const
 

Private Member Functions

 game_launcher (const game_launcher &)
 
void operator= (const game_launcher &)
 
void mark_completed_campaigns (std::vector< config > &campaigns)
 
editor::EXIT_STATUS start_editor (const std::string &filename)
 
unit_test_result single_unit_test ()
 Internal to the implementation of unit_test(). More...
 

Private Attributes

const commandline_optionscmdline_opts_
 
const std::unique_ptr< CVideovideo_
 
font::manager font_manager_
 
const preferences::manager prefs_manager_
 
const image::manager image_manager_
 
const events::event_context main_event_context_
 
const hotkey::manager hotkey_manager_
 
sound::music_thinker music_thinker_
 
sound::music_muter music_muter_
 
std::vector< std::string > test_scenarios_
 
std::string screenshot_map_
 
std::string screenshot_filename_
 
saved_game state_
 
bool play_replay_
 
std::string multiplayer_server_
 
bool jump_to_multiplayer_
 
jump_to_campaign_info jump_to_campaign_
 
bool jump_to_editor_
 
std::unique_ptr< savegame::load_game_metadataload_data_
 

Detailed Description

Definition at line 50 of file game_launcher.hpp.

Member Enumeration Documentation

◆ mp_selection

Enumerator
MP_CONNECT 
MP_HOST 
MP_LOCAL 

Definition at line 58 of file game_launcher.hpp.

◆ RELOAD_GAME_DATA

Enumerator
RELOAD_DATA 
NO_RELOAD_DATA 

Definition at line 103 of file game_launcher.hpp.

◆ unit_test_result

Status code after running a unit test, should match the run_wml_tests script and the documentation for the –unit_test command-line option.

Enumerator
TEST_PASS 
TEST_FAIL 
TEST_FAIL_LOADING_REPLAY 
TEST_FAIL_PLAYING_REPLAY 

Definition at line 64 of file game_launcher.hpp.

Constructor & Destructor Documentation

◆ game_launcher() [1/2]

game_launcher::game_launcher ( const commandline_options cmdline_opts,
const char *  appname 
)

Definition at line 105 of file game_launcher.cpp.

References preferences::_set_maximized(), preferences::_set_resolution(), filesystem::base_name(), commandline_options::campaign, commandline_options::campaign_difficulty, jump_to_campaign_info::campaign_id_, commandline_options::campaign_scenario, commandline_options::campaign_skip_story, utils::clamp(), commandline_options::clock, cmdline_opts_, commandline_options::core_id, commandline_options::debug, savegame::save_index_class::default_saves_dir(), jump_to_campaign_info::difficulty_, preferences::disable_preferences_save(), commandline_options::editor, font_manager_, commandline_options::fps, commandline_options::fullscreen, filesystem::get_cache_dir(), filesystem::get_cwd(), filesystem::get_user_config_dir(), filesystem::get_user_data_dir(), commandline_options::headless_unit_test, if(), sound::init_sound(), jump_to_campaign_info::jump_, jump_to_campaign_, jump_to_editor_, jump_to_multiplayer_, commandline_options::load, load_data_, commandline_options::max_fps, game_config::mp_debug, multiplayer_server_, preferences::music_on(), preferences::network_host(), gui2::new_widgets, commandline_options::new_widgets, game_config::no_delay, commandline_options::nodelay, commandline_options::nogui, commandline_options::nomusic, commandline_options::nosound, commandline_options::password, game_config::path, play_replay_, commandline_options::resolution, filesystem::sanitize_path(), jump_to_campaign_info::scenario_id_, commandline_options::screenshot, screenshot_filename_, screenshot_map_, commandline_options::screenshot_map_file, commandline_options::screenshot_output_file, commandline_options::server, game_config::server_list, preferences::set_core_id(), game_config::set_debug(), preferences::set_draw_delay(), CVideo::set_fullscreen(), preferences::set_level(), preferences::set_login(), set_min_translation_percent(), preferences::set_music(), preferences::set_password(), preferences::set_show_fps(), preferences::set_sound(), preferences::set_turn_bell(), preferences::set_UI_sound(), gui2::dialogs::show_debug_clock_button, utf8::size(), jump_to_campaign_info::skip_story_, preferences::sound_on(), state_, commandline_options::test, test_scenarios_, commandline_options::translation_percent, preferences::turn_bell(), preferences::UI_sound_on(), commandline_options::unit_test, commandline_options::username, video(), commandline_options::windowed, commandline_options::with_replay, and font::manager::~manager().

◆ ~game_launcher()

game_launcher::~game_launcher ( )

Definition at line 1057 of file game_launcher.cpp.

References sound::close_sound().

◆ game_launcher() [2/2]

game_launcher::game_launcher ( const game_launcher )
private

Member Function Documentation

◆ change_language()

bool game_launcher::change_language ( )

◆ clear_loaded_game()

void game_launcher::clear_loaded_game ( )

Definition at line 1052 of file game_launcher.cpp.

References load_data_.

Referenced by gui2::dialogs::title_screen::pre_show().

◆ goto_campaign()

bool game_launcher::goto_campaign ( )

◆ goto_editor()

bool game_launcher::goto_editor ( )

◆ goto_multiplayer()

bool game_launcher::goto_multiplayer ( )

Definition at line 757 of file game_launcher.cpp.

References jump_to_multiplayer_, MP_CONNECT, and play_multiplayer().

◆ init_language()

bool game_launcher::init_language ( )

◆ init_lua_script()

bool game_launcher::init_lua_script ( )

◆ init_video()

bool game_launcher::init_video ( )

◆ is_loading()

bool game_launcher::is_loading ( ) const

Definition at line 626 of file game_launcher.cpp.

References load_data_.

◆ jump_to_campaign_id()

std::string game_launcher::jump_to_campaign_id ( ) const

Return the ID of the campaign to jump to (skipping the main menu).

Definition at line 737 of file game_launcher.cpp.

References jump_to_campaign_info::campaign_id_, and jump_to_campaign_.

◆ jump_to_editor()

bool game_launcher::jump_to_editor ( ) const
inline

Definition at line 94 of file game_launcher.hpp.

◆ launch_game()

void game_launcher::launch_game ( RELOAD_GAME_DATA  reload = RELOAD_DATA)

◆ load_game()

bool game_launcher::load_game ( )

◆ mark_completed_campaigns()

void game_launcher::mark_completed_campaigns ( std::vector< config > &  campaigns)
private

Definition at line 721 of file game_launcher.cpp.

References preferences::is_campaign_completed().

◆ new_campaign()

bool game_launcher::new_campaign ( )

◆ operator=()

void game_launcher::operator= ( const game_launcher )
private

◆ opts()

const commandline_options& game_launcher::opts ( ) const
inline

Definition at line 111 of file game_launcher.hpp.

◆ play_multiplayer()

bool game_launcher::play_multiplayer ( mp_selection  res)

◆ play_multiplayer_commandline()

bool game_launcher::play_multiplayer_commandline ( )

◆ play_render_image_mode()

bool game_launcher::play_render_image_mode ( )

◆ play_replay()

void game_launcher::play_replay ( )

◆ play_screenshot_mode()

bool game_launcher::play_screenshot_mode ( )

◆ play_test()

bool game_launcher::play_test ( )

◆ select_mp_server()

void game_launcher::select_mp_server ( const std::string &  server)
inline

◆ set_test()

void game_launcher::set_test ( const std::string &  id)

◆ set_tutorial()

void game_launcher::set_tutorial ( )

◆ show_preferences()

void game_launcher::show_preferences ( )

◆ single_unit_test()

game_launcher::unit_test_result game_launcher::single_unit_test ( )
private

◆ start_editor() [1/2]

editor::EXIT_STATUS game_launcher::start_editor ( )
inline

Definition at line 107 of file game_launcher.hpp.

References start_editor().

Referenced by goto_editor(), and start_editor().

◆ start_editor() [2/2]

editor::EXIT_STATUS game_launcher::start_editor ( const std::string &  filename)
private

◆ start_wesnothd()

void game_launcher::start_wesnothd ( )

◆ unit_test()

game_launcher::unit_test_result game_launcher::unit_test ( )

Runs unit tests specified on the command line.

If multiple unit tests were specified, then this will stop at the first test which returns a non-zero status.

Definition at line 499 of file game_launcher.cpp.

References cmdline_opts_, set_test(), single_unit_test(), TEST_FAIL, TEST_FAIL_LOADING_REPLAY, TEST_FAIL_PLAYING_REPLAY, TEST_PASS, test_scenarios_, and commandline_options::unit_test.

◆ video()

CVideo& game_launcher::video ( )
inline

Definition at line 56 of file game_launcher.hpp.

Referenced by change_language(), game_launcher(), and init_video().

Member Data Documentation

◆ cmdline_opts_

const commandline_options& game_launcher::cmdline_opts_
private

◆ font_manager_

font::manager game_launcher::font_manager_
private

Definition at line 128 of file game_launcher.hpp.

Referenced by game_launcher().

◆ hotkey_manager_

const hotkey::manager game_launcher::hotkey_manager_
private

Definition at line 132 of file game_launcher.hpp.

◆ image_manager_

const image::manager game_launcher::image_manager_
private

Definition at line 130 of file game_launcher.hpp.

◆ jump_to_campaign_

jump_to_campaign_info game_launcher::jump_to_campaign_
private

◆ jump_to_editor_

bool game_launcher::jump_to_editor_
private

Definition at line 147 of file game_launcher.hpp.

Referenced by game_launcher(), goto_editor(), and init_lua_script().

◆ jump_to_multiplayer_

bool game_launcher::jump_to_multiplayer_
private

Definition at line 144 of file game_launcher.hpp.

Referenced by game_launcher(), goto_multiplayer(), and init_lua_script().

◆ load_data_

std::unique_ptr<savegame::load_game_metadata> game_launcher::load_data_
private

◆ main_event_context_

const events::event_context game_launcher::main_event_context_
private

Definition at line 131 of file game_launcher.hpp.

◆ multiplayer_server_

std::string game_launcher::multiplayer_server_
private

Definition at line 143 of file game_launcher.hpp.

Referenced by game_launcher(), and play_multiplayer().

◆ music_muter_

sound::music_muter game_launcher::music_muter_
private

Definition at line 134 of file game_launcher.hpp.

◆ music_thinker_

sound::music_thinker game_launcher::music_thinker_
private

Definition at line 133 of file game_launcher.hpp.

◆ play_replay_

bool game_launcher::play_replay_
private

Definition at line 141 of file game_launcher.hpp.

Referenced by game_launcher(), launch_game(), load_game(), and new_campaign().

◆ prefs_manager_

const preferences::manager game_launcher::prefs_manager_
private

Definition at line 129 of file game_launcher.hpp.

◆ screenshot_filename_

std::string game_launcher::screenshot_filename_
private

Definition at line 138 of file game_launcher.hpp.

Referenced by game_launcher(), and play_screenshot_mode().

◆ screenshot_map_

std::string game_launcher::screenshot_map_
private

Definition at line 138 of file game_launcher.hpp.

Referenced by game_launcher(), and play_screenshot_mode().

◆ state_

saved_game game_launcher::state_
private

◆ test_scenarios_

std::vector<std::string> game_launcher::test_scenarios_
private

Definition at line 136 of file game_launcher.hpp.

Referenced by game_launcher(), play_test(), and unit_test().

◆ video_

const std::unique_ptr<CVideo> game_launcher::video_
private

Definition at line 126 of file game_launcher.hpp.


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