The Battle for Wesnoth  1.19.7+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 class  mp_mode { CONNECT , HOST , LOCAL }
 
enum class  reload_mode { RELOAD_DATA , NO_RELOAD_DATA }
 
enum class  unit_test_result : int {
  TEST_PASS = 0 , TEST_FAIL = 1 , TEST_FAIL_LOADING_REPLAY = 3 , TEST_FAIL_PLAYING_REPLAY = 4 ,
  TEST_FAIL_WML_EXCEPTION = 6 , TEST_FAIL_BY_DEFEAT = 7 , TEST_PASS_BY_VICTORY = 8 , BROKE_STRICT_TEST_PASS = 9 ,
  BROKE_STRICT_TEST_FAIL = 10 , BROKE_STRICT_TEST_FAIL_BY_DEFEAT = 11 , BROKE_STRICT_TEST_PASS_BY_VICTORY = 12
}
 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...
 

Public Member Functions

 game_launcher (const commandline_options &cmdline_opts)
 
 ~game_launcher ()
 
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 has_load_data () const
 
bool load_game ()
 
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 ()
 
void select_mp_server (const std::string &server)
 
bool play_multiplayer (mp_mode mode)
 
bool play_multiplayer_commandline ()
 
bool change_language ()
 
void launch_game (reload_mode reload=reload_mode::RELOAD_DATA)
 
void play_replay ()
 
editor::EXIT_STATUS start_editor ()
 
const commandline_optionsopts () const
 

Private Member Functions

 game_launcher (const game_launcher &)=delete
 
game_launcheroperator= (const game_launcher &)=delete
 
void clear_loaded_game ()
 
void start_wesnothd ()
 
editor::EXIT_STATUS start_editor (const std::string &filename)
 
unit_test_result pass_victory_or_defeat (level_result::type res)
 
unit_test_result single_unit_test ()
 Internal to the implementation of unit_test(). More...
 

Private Attributes

const commandline_optionscmdline_opts_
 
bool start_in_fullscreen_ = false
 
font::manager font_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_
 
utils::optional< savegame::load_game_metadataload_data_
 

Detailed Description

Definition at line 52 of file game_launcher.hpp.

Member Enumeration Documentation

◆ mp_mode

Enumerator
CONNECT 
HOST 
LOCAL 

Definition at line 58 of file game_launcher.hpp.

◆ reload_mode

Enumerator
RELOAD_DATA 
NO_RELOAD_DATA 

Definition at line 59 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 
TEST_FAIL_WML_EXCEPTION 
TEST_FAIL_BY_DEFEAT 
TEST_PASS_BY_VICTORY 
BROKE_STRICT_TEST_PASS 
BROKE_STRICT_TEST_FAIL 
BROKE_STRICT_TEST_FAIL_BY_DEFEAT 
BROKE_STRICT_TEST_PASS_BY_VICTORY 

Definition at line 65 of file game_launcher.hpp.

Constructor & Destructor Documentation

◆ game_launcher() [1/2]

game_launcher::game_launcher ( const commandline_options cmdline_opts)

Definition at line 90 of file game_launcher.cpp.

References commandline_options::campaign, commandline_options::campaign_difficulty, jump_to_campaign_info::campaign_id, commandline_options::campaign_scenario, commandline_options::campaign_skip_story, commandline_options::clock, cmdline_opts_, commandline_options::core_id, commandline_options::debug, savegame::save_index_class::default_saves_dir(), jump_to_campaign_info::difficulty, prefs::disable_preferences_save(), commandline_options::editor, commandline_options::fps, commandline_options::fullscreen, prefs::get(), filesystem::get_cache_dir(), filesystem::get_user_data_dir(), commandline_options::headless_unit_test, 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_, gui2::dialogs::music_on(), prefs::network_host(), commandline_options::new_widgets, gui2::new_widgets, commandline_options::nobanner, commandline_options::nogui, commandline_options::nomusic, commandline_options::nosound, commandline_options::password, game_config::path, PLAIN_LOG, draw::point(), commandline_options::resolution, 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, game_config::set_debug(), prefs::set_login(), set_min_translation_percent(), prefs::set_music(), prefs::set_password(), prefs::set_resolution(), prefs::set_show_fps(), prefs::set_sound(), prefs::set_turn_bell(), prefs::set_ui_sound(), gui2::dialogs::show_debug_clock_button, utf8::size(), jump_to_campaign_info::skip_story, gui2::dialogs::sound(), start_in_fullscreen_, commandline_options::test, test_scenarios_, commandline_options::translation_percent, game_config::sounds::turn_bell, gui2::dialogs::ui_sound_on(), commandline_options::unit_test, commandline_options::username, commandline_options::windowed, and commandline_options::with_replay.

◆ ~game_launcher()

game_launcher::~game_launcher ( )

◆ game_launcher() [2/2]

game_launcher::game_launcher ( const game_launcher )
privatedelete

Member Function Documentation

◆ change_language()

bool game_launcher::change_language ( )

◆ clear_loaded_game()

void game_launcher::clear_loaded_game ( )
private

Definition at line 1037 of file game_launcher.cpp.

References load_data_.

Referenced by goto_editor(), and load_game().

◆ goto_campaign()

bool game_launcher::goto_campaign ( )

◆ goto_editor()

bool game_launcher::goto_editor ( )

◆ goto_multiplayer()

bool game_launcher::goto_multiplayer ( )

Definition at line 759 of file game_launcher.cpp.

References CONNECT, jump_to_multiplayer_, and play_multiplayer().

◆ has_load_data()

bool game_launcher::has_load_data ( ) const

Definition at line 650 of file game_launcher.cpp.

References load_data_.

◆ init_language()

bool game_launcher::init_language ( )

◆ init_lua_script()

bool game_launcher::init_lua_script ( )

◆ init_video()

bool game_launcher::init_video ( )

◆ 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 739 of file game_launcher.cpp.

References jump_to_campaign_info::campaign_id, and jump_to_campaign_.

◆ launch_game()

void game_launcher::launch_game ( reload_mode  reload = reload_mode::RELOAD_DATA)

◆ load_game()

bool game_launcher::load_game ( )

◆ new_campaign()

bool game_launcher::new_campaign ( )

◆ operator=()

game_launcher& game_launcher::operator= ( const game_launcher )
privatedelete

◆ opts()

const commandline_options& game_launcher::opts ( ) const
inline

Definition at line 112 of file game_launcher.hpp.

References cmdline_opts_.

◆ pass_victory_or_defeat()

game_launcher::unit_test_result game_launcher::pass_victory_or_defeat ( level_result::type  res)
private

◆ play_multiplayer()

bool game_launcher::play_multiplayer ( mp_mode  mode)

◆ 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 ( )

Definition at line 1003 of file game_launcher.cpp.

References e, load_data_, campaign_controller::play_replay(), and state_.

Referenced by launch_game().

◆ 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)

◆ 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 110 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 ( )
private

◆ 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 471 of file game_launcher.cpp.

References BROKE_STRICT_TEST_FAIL, BROKE_STRICT_TEST_FAIL_BY_DEFEAT, BROKE_STRICT_TEST_PASS, BROKE_STRICT_TEST_PASS_BY_VICTORY, cmdline_opts_, PLAIN_LOG, set_test(), single_unit_test(), TEST_FAIL, TEST_FAIL_BY_DEFEAT, TEST_FAIL_LOADING_REPLAY, TEST_FAIL_PLAYING_REPLAY, TEST_FAIL_WML_EXCEPTION, TEST_PASS, TEST_PASS_BY_VICTORY, test_scenarios_, and commandline_options::unit_test.

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 133 of file game_launcher.hpp.

◆ hotkey_manager_

const hotkey::manager game_launcher::hotkey_manager_
private

Definition at line 136 of file game_launcher.hpp.

◆ image_manager_

const image::manager game_launcher::image_manager_
private

Definition at line 134 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 151 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 148 of file game_launcher.hpp.

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

◆ load_data_

utils::optional<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 135 of file game_launcher.hpp.

◆ multiplayer_server_

std::string game_launcher::multiplayer_server_
private

Definition at line 147 of file game_launcher.hpp.

Referenced by game_launcher(), play_multiplayer(), and select_mp_server().

◆ music_muter_

sound::music_muter game_launcher::music_muter_
private

Definition at line 138 of file game_launcher.hpp.

◆ music_thinker_

sound::music_thinker game_launcher::music_thinker_
private

Definition at line 137 of file game_launcher.hpp.

◆ play_replay_

bool game_launcher::play_replay_
private

Definition at line 145 of file game_launcher.hpp.

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

◆ screenshot_filename_

std::string game_launcher::screenshot_filename_
private

Definition at line 142 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 142 of file game_launcher.hpp.

Referenced by game_launcher(), and play_screenshot_mode().

◆ start_in_fullscreen_

bool game_launcher::start_in_fullscreen_ = false
private

Definition at line 131 of file game_launcher.hpp.

Referenced by game_launcher().

◆ state_

saved_game game_launcher::state_
private

◆ test_scenarios_

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

Definition at line 140 of file game_launcher.hpp.

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


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