#include "addon/manager.hpp"
#include "build_info.hpp"
#include "commandline_argv.hpp"
#include "commandline_options.hpp"
#include "config.hpp"
#include "cursor.hpp"
#include "events.hpp"
#include "filesystem.hpp"
#include "floating_label.hpp"
#include "font/error.hpp"
#include "font/font_config.hpp"
#include "formula/formula.hpp"
#include "game_config.hpp"
#include "game_config_manager.hpp"
#include "game_end_exceptions.hpp"
#include "game_launcher.hpp"
#include "gettext.hpp"
#include "gui/core/event/handler.hpp"
#include "gui/dialogs/loading_screen.hpp"
#include "gui/dialogs/message.hpp"
#include "gui/dialogs/migrate_version_selection.hpp"
#include "gui/dialogs/title_screen.hpp"
#include "gui/gui.hpp"
#include "log.hpp"
#include "preferences/preferences.hpp"
#include "scripting/application_lua_kernel.hpp"
#include "scripting/plugins/context.hpp"
#include "scripting/plugins/manager.hpp"
#include "sdl/exception.hpp"
#include "serialization/binary_or_text.hpp"
#include "serialization/chrono.hpp"
#include "serialization/parser.hpp"
#include "serialization/preprocessor.hpp"
#include "serialization/schema_validator.hpp"
#include "sound.hpp"
#include "utils/optimer.hpp"
#include "formula/string_utils.hpp"
#include <functional>
#include "game_version.hpp"
#include "video.hpp"
#include "wesconfig.h"
#include "wml_exception.hpp"
#include "utils/spritesheet_generator.hpp"
#include <fenv.h>
#include <SDL2/SDL.h>
#include <boost/program_options/errors.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include "utils/optional_fwd.hpp"
#include <cerrno>
#include <clocale>
#include <cstdio>
#include <cstdlib>
#include <exception>
#include <vector>
#include <iostream>
Go to the source code of this file.
Macros | |
#define | LOG_CONFIG LOG_STREAM(info, log_config) |
#define | LOG_GENERAL LOG_STREAM(info, lg::general()) |
#define | LOG_PREPROC LOG_STREAM(info, log_preprocessor) |
#define | error_exit(res) return res |
Functions | |
static void | safe_exit (int res) |
static void | handle_preprocess_string (const commandline_options &cmdline_opts) |
static void | handle_preprocess_command (const commandline_options &cmdline_opts) |
static int | handle_validate_command (const std::string &file, abstract_validator &validator, const std::vector< std::string > &defines) |
static int | process_command_args (commandline_options &cmdline_opts) |
Process commandline-arguments. More... | |
static void | init_locale () |
I would prefer to setup locale first so that early error messages can get localized, but we need the game_launcher initialized to have filesystem::get_intl_dir() to work. More... | |
static void | warn_early_init_failure () |
Print an alert and instructions to stderr about early initialization errors. More... | |
static void | handle_lua_script_args (game_launcher *game, commandline_options &) |
Handles the lua script command line arguments if present. More... | |
static void | check_fpu () |
static int | get_gameloop_action (game_launcher &game) |
Gets the appropriate action code for the current iteration of the game loop. More... | |
static int | do_gameloop (commandline_options &cmdline_opts) |
Setups the game environment and enters the titlescreen or game loops. More... | |
int | main (int argc, char **argv) |
Variables | |
static lg::log_domain | log_config ("config") |
static lg::log_domain | log_preprocessor ("preprocessor") |
#define error_exit | ( | res | ) | return res |
Definition at line 983 of file wesnoth.cpp.
#define LOG_CONFIG LOG_STREAM(info, log_config) |
Definition at line 117 of file wesnoth.cpp.
#define LOG_GENERAL LOG_STREAM(info, lg::general()) |
Definition at line 119 of file wesnoth.cpp.
#define LOG_PREPROC LOG_STREAM(info, log_preprocessor) |
Definition at line 122 of file wesnoth.cpp.
|
static |
|
static |
Setups the game environment and enters the titlescreen or game loops.
Definition at line 760 of file wesnoth.cpp.
References _(), cfg, check_fpu(), game_config::check_migration, config::child_range(), game_launcher::CONNECT, gui2::dialogs::loading_screen::display(), sound::empty_playlist(), gui2::dialogs::migrate_version_selection::execute(), game_config_manager::game_config(), prefs::get(), get_gameloop_action(), filesystem::get_logs_dir(), handle_lua_script_args(), game_launcher::HOST, i, gui2::init(), init_fonts, game_config_manager::init_game_config(), init_locale(), gui2::dialogs::title_screen::LAUNCH_GAME, load_config, font::load_font_config(), gui2::dialogs::title_screen::LOAD_GAME, game_launcher::LOCAL, lg::log_dir_writable(), LOG_GENERAL, gui2::dialogs::title_screen::MAP_EDITOR, gui2::dialogs::title_screen::MP_CONNECT, gui2::dialogs::title_screen::MP_HOST, gui2::dialogs::title_screen::MP_LOCAL, wfl::msg(), game_config::no_addons, game_config_manager::NO_FORCE_RELOAD, commandline_options::noaddons, cursor::NORMAL, gui2::dialogs::message::ok_button, game_config_view::optional_child(), PLAIN_LOG, game_launcher::play_campaign(), game_launcher::play_multiplayer(), sound::play_music_config(), plugins_context::play_slice(), gui2::dialogs::loading_screen::progress(), gui2::dialogs::title_screen::QUIT_GAME, gui2::dialogs::title_screen::REDRAW_BACKGROUND, refresh_addon_version_info_cache(), refresh_addons, game_config_manager::reload_changed_game_config(), game_launcher::RELOAD_DATA, gui2::dialogs::title_screen::RELOAD_GAME_DATA, gui2::dialogs::title_screen::RELOAD_UI, safe_exit(), cursor::set(), plugins_context::set_callback(), gui2::show_message(), sound::stop_music(), gui2::switch_theme(), game_config::title_music, commandline_options::to_config(), commandline_options::unit_test, VGETTEXT, cursor::WAIT, and warn_early_init_failure().
Referenced by main().
|
static |
Gets the appropriate action code for the current iteration of the game loop.
Definition at line 737 of file wesnoth.cpp.
References gui2::dialogs::title_screen::LOAD_GAME, and gui2::dialogs::title_screen::REDRAW_BACKGROUND.
Referenced by do_gameloop().
|
static |
Handles the lua script command line arguments if present.
This function will only run once.
Definition at line 648 of file wesnoth.cpp.
Referenced by do_gameloop().
|
static |
Definition at line 191 of file wesnoth.cpp.
References _(), config::all_children_view(), cfg, e, filesystem::file_exists(), preproc_define::insert(), filesystem::istream_file(), LOG_PREPROC, filesystem::ostream_file(), game_config::path, PLAIN_LOG, commandline_options::preprocess_defines, commandline_options::preprocess_input_macros, commandline_options::preprocess_output_macros, commandline_options::preprocess_path, preprocess_resource(), commandline_options::preprocess_target, io::read(), and game_config::wesnoth_version.
Referenced by process_command_args().
|
static |
Definition at line 133 of file wesnoth.cpp.
References _(), config::all_children_view(), cfg, e, filesystem::file_exists(), preproc_define::insert(), filesystem::istream_file(), LOG_PREPROC, PLAIN_LOG, commandline_options::preprocess_defines, commandline_options::preprocess_input_macros, commandline_options::preprocess_source_string, preprocess_string(), io::read(), and game_config::wesnoth_version.
Referenced by process_command_args().
|
static |
Definition at line 306 of file wesnoth.cpp.
References lg::broke_strict(), lg::LG_ERROR, LOG_PREPROC, PLAIN_LOG, preprocess_file(), io::read(), lg::set_strict_severity(), validator, and game_config::wesnoth_version.
Referenced by process_command_args().
|
static |
I would prefer to setup locale first so that early error messages can get localized, but we need the game_launcher initialized to have filesystem::get_intl_dir() to work.
Note: setlocale() does not take GUI language setting into account.
Definition at line 611 of file wesnoth.cpp.
References translation::bind_textdomain(), filesystem::get_intl_dir(), PACKAGE, and translation::set_default_textdomain().
Referenced by do_gameloop().
int main | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 990 of file wesnoth.cpp.
References do_gameloop(), e, error_exit, utils::get_unknown_exception_type(), PLAIN_LOG, process_command_args(), read_argv(), safe_exit(), events::set_main_thread(), and lg::using_own_console().
|
static |
Process commandline-arguments.
Definition at line 334 of file wesnoth.cpp.
References commandline_options::addon_server_info, game_config::addon_server_info, commandline_options::allow_insecure, game_config::allow_insecure, config::apply_diff(), filesystem::autodetect_game_data_dir(), game_config::build_arch(), image::build_spritesheet_from(), commandline_options::data_dir, commandline_options::data_path, commandline_options::debug_lua, game_config::debug_lua, commandline_options::diff_left, commandline_options::diff_right, lg::do_console_redirect(), commandline_options::do_diff, commandline_options::do_patch, filesystem::file_exists(), chrono::format_local_timestamp(), game_config::full_build_report(), commandline_options::generate_spritesheet, filesystem::get_cache_dir(), config::get_diff(), filesystem::get_exe_dir(), filesystem::get_user_data_dir(), filesystem::get_wml_location(), handle_preprocess_command(), handle_preprocess_string(), handle_validate_command(), commandline_options::headless_unit_test, commandline_options::help, filesystem::is_directory(), filesystem::is_userdata_initialized(), game_config::library_versions_report(), lg::list_log_domains(), commandline_options::log, commandline_options::log_precise_timestamps, commandline_options::log_to_file, commandline_options::logdomains, commandline_options::no_log_sanitize, commandline_options::no_log_to_file, commandline_options::nobanner, commandline_options::nogui, compression::none, filesystem::normalize_path(), game_config::optional_features_report(), commandline_options::output_file, game_config::path, PLAIN_LOG, lg::precise_timestamps(), commandline_options::preprocess, commandline_options::preprocess_defines, commandline_options::preprocess_input_macros, commandline_options::preprocess_path, commandline_options::preprocess_source_string, io::read(), commandline_options::render_image, commandline_options::report, game_config::revision, commandline_options::rng_seed, commandline_options::screenshot, filesystem::set_cache_dir(), lg::set_log_domain_severity(), lg::set_log_sanitize(), lg::set_log_to_file(), filesystem::set_user_data_dir(), commandline_options::simple_version, version_info::str(), commandline_options::strict_lua, game_config::strict_lua, commandline_options::strict_validation, strict_validation_enabled, commandline_options::usercache_dir, commandline_options::usercache_path, commandline_options::userdata_dir, commandline_options::userdata_path, commandline_options::validate_schema, commandline_options::validate_with, commandline_options::validate_wml, validator, commandline_options::version, game_config::wesnoth_version, and config_writer::write().
Referenced by main().
|
static |
Definition at line 127 of file wesnoth.cpp.
References LOG_GENERAL.
Referenced by do_gameloop(), and main().
|
static |
Print an alert and instructions to stderr about early initialization errors.
This is provided as an aid for users dealing with potential data dir configuration issues. The first code to read core WML has the responsibility to call this function in the event of a problem, to inform the user of the most likely possible cause and suggest a course of action to solve the issue.
Definition at line 635 of file wesnoth.cpp.
References PLAIN_LOG.
Referenced by do_gameloop().
|
static |
|
static |