Minetest  5.4.0
main.cpp File Reference
#include "irrlichttypes.h"
#include "irrlicht.h"
#include "irrlichttypes_extrabloated.h"
#include "chat_interface.h"
#include "debug.h"
#include "unittest/test.h"
#include "server.h"
#include "filesys.h"
#include "version.h"
#include "client/game.h"
#include "defaultsettings.h"
#include "gettext.h"
#include "log.h"
#include "util/quicktune.h"
#include "httpfetch.h"
#include "gameparams.h"
#include "database/database.h"
#include "config.h"
#include "player.h"
#include "porting.h"
#include "network/socket.h"
#include "gui/guiMainMenu.h"
#include "client/clientlauncher.h"
#include "gui/guiEngine.h"
#include "gui/mainmenumanager.h"
#include <lua.h>
+ Include dependency graph for main.cpp:

Macros

#define DEBUGFILE   "debug.txt"
 
#define DEFAULT_SERVER_PORT   30000
 

Typedefs

typedef std::map< std::string, ValueSpecOptionList
 

Functions

static bool get_cmdline_opts (int argc, char *argv[], Settings *cmd_args)
 
static void set_allowed_options (OptionList *allowed_options)
 
static void print_help (const OptionList &allowed_options)
 
static void print_allowed_options (const OptionList &allowed_options)
 
static void print_version ()
 
static void print_worldspecs (const std::vector< WorldSpec > &worldspecs, std::ostream &os, bool print_name=true, bool print_path=true)
 
static void print_modified_quicktune_values ()
 
static void list_game_ids ()
 
static void list_worlds (bool print_name, bool print_path)
 
static bool setup_log_params (const Settings &cmd_args)
 
static bool create_userdata_path ()
 
static bool init_common (const Settings &cmd_args, int argc, char *argv[])
 
static void startup_message ()
 
static bool read_config_file (const Settings &cmd_args)
 
static void init_log_streams (const Settings &cmd_args)
 
static bool game_configure (GameParams *game_params, const Settings &cmd_args)
 
static void game_configure_port (GameParams *game_params, const Settings &cmd_args)
 
static bool game_configure_world (GameParams *game_params, const Settings &cmd_args)
 
static bool get_world_from_cmdline (GameParams *game_params, const Settings &cmd_args)
 
static bool get_world_from_config (GameParams *game_params, const Settings &cmd_args)
 
static bool auto_select_world (GameParams *game_params)
 
static std::string get_clean_world_path (const std::string &path)
 
static bool game_configure_subgame (GameParams *game_params, const Settings &cmd_args)
 
static bool get_game_from_cmdline (GameParams *game_params, const Settings &cmd_args)
 
static bool determine_subgame (GameParams *game_params)
 
static bool run_dedicated_server (const GameParams &game_params, const Settings &cmd_args)
 
static bool migrate_map_database (const GameParams &game_params, const Settings &cmd_args)
 
int main (int argc, char *argv[])
 

Variables

FileLogOutput file_log_output
 
static OptionList allowed_options
 

Macro Definition Documentation

◆ DEBUGFILE

#define DEBUGFILE   "debug.txt"

◆ DEFAULT_SERVER_PORT

#define DEFAULT_SERVER_PORT   30000

Typedef Documentation

◆ OptionList

typedef std::map<std::string, ValueSpec> OptionList

Function Documentation

◆ auto_select_world()

static bool auto_select_world ( GameParams game_params)
static

References _, DIR_DELIM, dstream, getAvailableWorlds(), infostream, GameParams::is_dedicated_server, porting::path_user, print_worldspecs(), and GameParams::world_path.

Referenced by game_configure_world().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create_userdata_path()

static bool create_userdata_path ( )
static

References fs::CreateDir(), porting::path_user, and fs::PathExists().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ determine_subgame()

static bool determine_subgame ( GameParams game_params)
static

References errorstream, findSubgame(), findWorldSubgame(), g_settings, GameParams::game_spec, Settings::get(), getWorldExists(), getWorldGameId(), SubgameSpec::id, infostream, SubgameSpec::isValid(), warningstream, and GameParams::world_path.

Referenced by game_configure_subgame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ game_configure()

static bool game_configure ( GameParams game_params,
const Settings cmd_args 
)
static

References errorstream, game_configure_port(), game_configure_subgame(), and game_configure_world().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ game_configure_port()

static void game_configure_port ( GameParams game_params,
const Settings cmd_args 
)
static

References DEFAULT_SERVER_PORT, Settings::exists(), g_settings, Settings::getU16(), GameParams::is_dedicated_server, and GameParams::socket_port.

Referenced by game_configure().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ game_configure_subgame()

static bool game_configure_subgame ( GameParams game_params,
const Settings cmd_args 
)
static

References determine_subgame(), and get_game_from_cmdline().

Referenced by game_configure().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ game_configure_world()

static bool game_configure_world ( GameParams game_params,
const Settings cmd_args 
)
static

References auto_select_world(), get_world_from_cmdline(), and get_world_from_config().

Referenced by game_configure().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_clean_world_path()

static std::string get_clean_world_path ( const std::string &  path)
static

References _, and dstream.

Referenced by get_world_from_cmdline(), and get_world_from_config().

+ Here is the caller graph for this function:

◆ get_cmdline_opts()

static bool get_cmdline_opts ( int  argc,
char *  argv[],
Settings cmd_args 
)
static

References allowed_options, Settings::parseCommandLine(), and set_allowed_options().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_game_from_cmdline()

static bool get_game_from_cmdline ( GameParams game_params,
const Settings cmd_args 
)
static

References _, dstream, errorstream, Settings::exists(), findSubgame(), GameParams::game_spec, Settings::get(), and SubgameSpec::isValid().

Referenced by game_configure_subgame().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_world_from_cmdline()

static bool get_world_from_cmdline ( GameParams game_params,
const Settings cmd_args 
)
static

References _, dstream, Settings::exists(), Settings::get(), get_clean_world_path(), getAvailableWorlds(), print_worldspecs(), and GameParams::world_path.

Referenced by game_configure_world().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_world_from_config()

static bool get_world_from_config ( GameParams game_params,
const Settings cmd_args 
)
static

References Settings::exists(), g_settings, Settings::get(), get_clean_world_path(), and GameParams::world_path.

Referenced by game_configure_world().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_common()

static bool init_common ( const Settings cmd_args,
int  argc,
char *  argv[] 
)
static

References Settings::createLayer(), g_settings, Settings::get(), Settings::getS32(), httpfetch_init(), init_gettext(), init_log_streams(), mysrand(), porting::path_locale, read_config_file(), set_default_settings(), SL_GLOBAL, sockets_cleanup(), sockets_init(), and startup_message().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init_log_streams()

static void init_log_streams ( const Settings cmd_args)
static

References Logger::addOutputMaxLevel(), ARRLEN, DEBUGFILE, DIR_DELIM, Settings::exists(), file_log_output, g_logger, g_settings, Settings::get(), Settings::getU64(), LL_MAX, porting::path_user, Logger::removeOutput(), FileLogOutput::setFile(), Logger::stringToLevel(), and warningstream.

Referenced by init_common().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ list_game_ids()

static void list_game_ids ( )
static

References getAvailableGameIds().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ list_worlds()

static void list_worlds ( bool  print_name,
bool  print_path 
)
static

References _, getAvailableWorlds(), and print_worldspecs().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ main()

◆ migrate_map_database()

static bool migrate_map_database ( const GameParams game_params,
const Settings cmd_args 
)
static

References actionstream, ServerMap::createDatabase(), DIR_DELIM, errorstream, Settings::exists(), Settings::get(), MapDatabase::listAllLoadableBlocks(), MapDatabase::loadBlock(), PP, Settings::readConfigFile(), Settings::set(), porting::signal_handler_killstatus(), Settings::updateConfigFile(), and GameParams::world_path.

Referenced by run_dedicated_server().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_allowed_options()

static void print_allowed_options ( const OptionList allowed_options)
static

References _, allowed_options, padStringRight(), and VALUETYPE_FLAG.

Referenced by print_help().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_help()

static void print_help ( const OptionList allowed_options)
static

References _, allowed_options, and print_allowed_options().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_modified_quicktune_values()

static void print_modified_quicktune_values ( )
static

References dstream, getQuicktuneNames(), getQuicktuneValue(), QuicktuneValue::getString(), and QuicktuneValue::modified.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_version()

static void print_version ( )
static

References g_build_info, g_version_hash, porting::getPlatformName(), and PROJECT_NAME_C.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_worldspecs()

static void print_worldspecs ( const std::vector< WorldSpec > &  worldspecs,
std::ostream &  os,
bool  print_name = true,
bool  print_path = true 
)
static

Referenced by auto_select_world(), get_world_from_cmdline(), and list_worlds().

+ Here is the caller graph for this function:

◆ read_config_file()

static bool read_config_file ( const Settings cmd_args)
static

References DIR_DELIM, errorstream, Settings::exists(), g_settings, g_settings_path, Settings::get(), porting::path_user, Settings::readConfigFile(), and sanity_check.

Referenced by init_common().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ run_dedicated_server()

◆ set_allowed_options()

static void set_allowed_options ( OptionList allowed_options)
static

References _, allowed_options, VALUETYPE_FLAG, and VALUETYPE_STRING.

Referenced by get_cmdline_opts().

+ Here is the caller graph for this function:

◆ setup_log_params()

static bool setup_log_params ( const Settings cmd_args)
static

References _, Logger::addOutput(), Logger::addOutputMaxLevel(), Logger::color_mode, dout_con_ptr, dstream, errorstream, Settings::exists(), g_logger, Settings::get(), Settings::getFlag(), LL_ERROR, LL_INFO, LL_VERBOSE, LOG_COLOR_ALWAYS, LOG_COLOR_AUTO, LOG_COLOR_NEVER, Logger::removeOutput(), Logger::setTraceEnabled(), socket_enable_debug_output, stderr_output, and verbosestream.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ startup_message()

static void startup_message ( )
static

References _, g_build_info, infostream, PROJECT_NAME, and SER_FMT_VER_HIGHEST_READ.

Referenced by init_common().

+ Here is the caller graph for this function:

Variable Documentation

◆ allowed_options

◆ file_log_output

FileLogOutput file_log_output

Referenced by init_log_streams().