The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Namespaces | Macros | Functions | Variables
wesnoth.cpp File Reference
#include "global.hpp"
#include "about.hpp"
#include "addon/manager.hpp"
#include "addon/manager_ui.hpp"
#include "build_info.hpp"
#include "commandline_options.hpp"
#include "config.hpp"
#include "cursor.hpp"
#include "editor/editor_main.hpp"
#include "filesystem.hpp"
#include "floating_label.hpp"
#include "font.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/core_selection.hpp"
#include "gui/dialogs/loadscreen.hpp"
#include "gui/dialogs/title_screen.hpp"
#include "gui/dialogs/message.hpp"
#include "gui/widgets/helper.hpp"
#include "help/help.hpp"
#include "image.hpp"
#include "log.hpp"
#include "preferences.hpp"
#include "scripting/application_lua_kernel.hpp"
#include "scripting/plugins/context.hpp"
#include "scripting/plugins/manager.hpp"
#include "sdl/exception.hpp"
#include "sdl/rect.hpp"
#include "serialization/binary_or_text.hpp"
#include "serialization/parser.hpp"
#include "serialization/preprocessor.hpp"
#include "serialization/string_utils.hpp"
#include "serialization/validator.hpp"
#include "serialization/unicode_cast.hpp"
#include "sound.hpp"
#include "statistics.hpp"
#include "tstring.hpp"
#include "version.hpp"
#include "video.hpp"
#include "wesconfig.h"
#include "widgets/button.hpp"
#include "wml_exception.hpp"
#include <fenv.h>
#include <SDL.h>
#include "utils/functional.hpp"
#include <boost/iostreams/categories.hpp>
#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/filter/bzip2.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/optional.hpp>
#include <boost/program_options/errors.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/tuple/tuple.hpp>
#include <algorithm>
#include <cerrno>
#include <clocale>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <exception>
#include <fstream>
#include <iostream>
#include <vector>

Go to the source code of this file.

Namespaces

 game
 

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)
 

Functions

static void safe_exit (int res)
 
template<typename filter >
static void encode (const std::string &input_file, const std::string &output_file)
 
template<typename filter >
static void decode (const std::string &input_file, const std::string &output_file)
 
static void gzip_encode (const std::string &input_file, const std::string &output_file)
 
static void gzip_decode (const std::string &input_file, const std::string &output_file)
 
static void bzip2_encode (const std::string &input_file, const std::string &output_file)
 
static void bzip2_decode (const std::string &input_file, const std::string &output_file)
 
static void handle_preprocess_command (const commandline_options &cmdline_opts)
 
static int process_command_args (const 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 do_gameloop (const std::vector< std::string > &args)
 Setups the game environment and enters the titlescreen or game loops. More...
 
static void wesnoth_terminate_handler (int)
 
int main (int argc, char **argv)
 

Variables

static lg::log_domain log_config ("config")
 
static lg::log_domain log_preprocessor ("preprocessor")
 

Macro Definition Documentation

#define LOG_CONFIG   LOG_STREAM(info, log_config)

Definition at line 127 of file wesnoth.cpp.

Referenced by do_gameloop().

#define LOG_GENERAL   LOG_STREAM(info, lg::general())

Definition at line 129 of file wesnoth.cpp.

Referenced by do_gameloop(), and safe_exit().

#define LOG_PREPROC   LOG_STREAM(info,log_preprocessor)

Definition at line 132 of file wesnoth.cpp.

Referenced by handle_preprocess_command().

Function Documentation

static void bzip2_decode ( const std::string input_file,
const std::string output_file 
)
static

Definition at line 202 of file wesnoth.cpp.

Referenced by process_command_args().

static void bzip2_encode ( const std::string input_file,
const std::string output_file 
)
static

Definition at line 197 of file wesnoth.cpp.

Referenced by process_command_args().

static void check_fpu ( )
static

Definition at line 555 of file wesnoth.cpp.

Referenced by do_gameloop().

template<typename filter >
static void decode ( const std::string input_file,
const std::string output_file 
)
static

Definition at line 169 of file wesnoth.cpp.

References e, safe_exit(), and game::error::what().

static int do_gameloop ( const std::vector< std::string > &  args)
static

Setups the game environment and enters the titlescreen or game loops.

Definition at line 574 of file wesnoth.cpp.

References gui2::ttitle_screen::CHANGE_LANGUAGE, check_fpu(), config::child(), config::child_range(), config::clear(), sound::commit_music_changes(), preferences::core_id(), gui2::ttitle_screen::CORES, game_config::debug, filesystem::directory_name(), gui2::tloadscreen::display(), e, gui2::ttitle_screen::EDIT_PREFERENCES, sound::empty_playlist(), image::flush_cache(), statistics::fresh_stats(), game_config_manager::get(), gui2::ttitle_screen::GET_ADDONS, gui2::tcore_selection::get_choice(), get_int, gui2::tdialog::get_retval(), handle_lua_script_args(), i, gui2::init(), init_locale(), preferences::joystick_support_enabled(), font::load_font_config(), gui2::ttitle_screen::LOAD_GAME, preferences::load_hotkeys(), LOG_CONFIG, LOG_GENERAL, manage_addons(), game_config::mp_debug, gui2::ttitle_screen::MULTIPLAYER, gui2::ttitle_screen::NEW_CAMPAIGN, next, game_config_manager::NO_FORCE_RELOAD, game_launcher::NO_RELOAD_DATA, cursor::NORMAL, gui2::ttitle_screen::NOTHING, game_launcher::play_multiplayer(), sound::play_music_config(), sound::play_music_repeatedly(), plugins_context::play_slice(), process_command_args(), gui2::tloadscreen::progress(), gui2::ttitle_screen::QUIT_GAME, refresh_addon_version_info_cache(), game_launcher::RELOAD_DATA, gui2::ttitle_screen::RELOAD_GAME_DATA, t_string::reset_translations(), safe_exit(), cursor::set(), plugins_context::set_callback(), preferences::set_core_id(), image::set_team_colors(), gui2::tdialog::show(), gui2::ttitle_screen::SHOW_ABOUT, about::show_about(), gui2::show_error_message(), gui2::ttitle_screen::SHOW_HELP, help::show_help(), gui2::ttitle_screen::START_MAP_EDITOR, sound::stop_music(), commandline_options::timeout, game_config::title_music, commandline_options::to_config(), gui2::ttitle_screen::TUTORIAL, commandline_options::unit_test, image::update_from_preferences(), cursor::WAIT, warn_early_init_failure(), and game_config::wesnoth_program_dir.

Referenced by main().

template<typename filter >
static void encode ( const std::string input_file,
const std::string output_file 
)
static

Definition at line 145 of file wesnoth.cpp.

References e, safe_exit(), and game::error::what().

static void gzip_decode ( const std::string input_file,
const std::string output_file 
)
static

Definition at line 192 of file wesnoth.cpp.

Referenced by process_command_args().

static void gzip_encode ( const std::string input_file,
const std::string output_file 
)
static

Definition at line 187 of file wesnoth.cpp.

Referenced by process_command_args().

static void handle_lua_script_args ( game_launcher game,
commandline_options  
)
static

Handles the lua script command line arguments if present.

This function will only run once.

Definition at line 506 of file wesnoth.cpp.

References game_launcher::init_lua_script().

Referenced by do_gameloop().

static void handle_preprocess_command ( const commandline_options cmdline_opts)
static
static void init_locale ( )
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 471 of file wesnoth.cpp.

References translation::bind_textdomain(), filesystem::get_intl_dir(), translation::init(), PACKAGE, and translation::set_default_textdomain().

Referenced by do_gameloop().

int main ( int  argc,
char **  argv 
)
static int process_command_args ( const commandline_options cmdline_opts)
static
static void safe_exit ( int  res)
static

Definition at line 137 of file wesnoth.cpp.

References LOG_GENERAL.

Referenced by decode(), do_gameloop(), encode(), and main().

static void warn_early_init_failure ( )
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 493 of file wesnoth.cpp.

Referenced by do_gameloop().

static void wesnoth_terminate_handler ( int  )
static

Definition at line 916 of file wesnoth.cpp.

Referenced by main().

Variable Documentation

lg::log_domain log_config("config")
static
lg::log_domain log_preprocessor("preprocessor")
static