Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
main.cpp File Reference
#include "irrlichttypes_bloated.h"
#include "irrlicht.h"
#include "irrlicht_changes/printing.h"
#include "benchmark/benchmark.h"
#include "chat_interface.h"
#include "debug.h"
#include "unittest/test.h"
#include "server.h"
#include "filesys.h"
#include "version.h"
#include "defaultsettings.h"
#include "migratesettings.h"
#include "gettext.h"
#include "log.h"
#include "log_internal.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 "serialization.h"
#include "network/socket.h"
#include "mapblock.h"
#include <lua.h>
+ Include dependency graph for main.cpp:

Macros

#define CONFIGFILE   "minetest.conf"
 
#define DEBUGFILE   "debug.txt"
 
#define DEFAULT_SERVER_PORT   30000
 
#define ENV_NO_COLOR   "NO_COLOR"
 
#define ENV_CLICOLOR   "CLICOLOR"
 
#define ENV_CLICOLOR_FORCE   "CLICOLOR_FORCE"
 
#define SERVER_ONLY   ""
 
#define LOCAL_GAME   ""
 

Typedefs

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

Functions

static void get_env_opts (Settings &args)
 
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 (std::ostream &os)
 
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 use_debugger (int argc, char *argv[])
 
static bool init_common (const Settings &cmd_args, int argc, char *argv[])
 
static void uninit_common ()
 
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)
 
static bool recompress_map_database (const GameParams &game_params, const Settings &cmd_args)
 
int main (int argc, char *argv[])
 

Variables

static FileLogOutput file_log_output
 
static OptionList allowed_options
 

Macro Definition Documentation

◆ CONFIGFILE

#define CONFIGFILE   "minetest.conf"

Referenced by read_config_file().

◆ DEBUGFILE

#define DEBUGFILE   "debug.txt"

Referenced by init_log_streams().

◆ DEFAULT_SERVER_PORT

#define DEFAULT_SERVER_PORT   30000

Referenced by game_configure_port().

◆ ENV_CLICOLOR

#define ENV_CLICOLOR   "CLICOLOR"

Referenced by get_env_opts().

◆ ENV_CLICOLOR_FORCE

#define ENV_CLICOLOR_FORCE   "CLICOLOR_FORCE"

Referenced by get_env_opts().

◆ ENV_NO_COLOR

#define ENV_NO_COLOR   "NO_COLOR"

Referenced by get_env_opts().

◆ LOCAL_GAME

#define LOCAL_GAME   ""

Referenced by set_allowed_options().

◆ SERVER_ONLY

#define SERVER_ONLY   ""

Referenced by set_allowed_options().

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(), rawstream, 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::CreateAllDirs(), 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, findWorldSubgame(), g_settings, GameParams::game_spec, Settings::get(), getWorldExists(), getWorldGameId(), SubgameSpec::id, infostream, GameParams::is_dedicated_server, 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_env_opts()

static void get_env_opts ( Settings & args)
static

References ENV_CLICOLOR, ENV_CLICOLOR_FORCE, ENV_NO_COLOR, and Settings::set().

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(), porting::getTimeUs(), httpfetch_init(), init_gettext(), init_log_streams(), migrate_settings(), mysrand(), porting::path_locale, read_config_file(), set_default_settings(), SL_GLOBAL, sockets_init(), startup_message(), and uninit_common().

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(), infostream, 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(), and rawstream.

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(), porting::getTimeS(), MapDatabase::listAllLoadableBlocks(), MapDatabase::loadBlock(), 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 ( std::ostream & os)
static

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

Referenced by main(), and startup_message().

+ 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 CONFIGFILE, DIR_DELIM, errorstream, Settings::exists(), g_settings, g_settings_path, Settings::get(), infostream, 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:

◆ recompress_map_database()

static bool recompress_map_database ( const GameParams & game_params,
const Settings & cmd_args )
static

References actionstream, Database::beginSave(), ServerMap::createDatabase(), ServerMap::deSerializeBlock(), DIR_DELIM, Database::endSave(), errorstream, GameParams::game_spec, Settings::get(), porting::getTimeS(), MapDatabase::listAllLoadableBlocks(), MapDatabase::loadBlock(), Settings::readConfigFile(), MapDatabase::saveBlock(), SER_FMT_VER_HIGHEST_WRITE, MapBlock::serialize(), porting::signal_handler_killstatus(), GameParams::world_path, and writeU8().

Referenced by run_dedicated_server().

+ 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, LOCAL_GAME, SERVER_ONLY, 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, dstream, errorstream, Settings::exists(), g_logger, Settings::get(), Settings::getFlag(), LL_ERROR, LL_INFO, LL_TRACE, LL_VERBOSE, LOG_COLOR_ALWAYS, LOG_COLOR_AUTO, LOG_COLOR_NEVER, Logger::removeOutput(), and stderr_output.

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 infostream, LATEST_PROTOCOL_VERSION, print_version(), SER_FMT_VER_HIGHEST_READ, and TOSTRING.

Referenced by init_common().

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

◆ uninit_common()

static void uninit_common ( )
static

References Settings::getLayer(), httpfetch_cleanup(), SL_TOTAL_COUNT, and sockets_cleanup().

Referenced by init_common().

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

◆ use_debugger()

static bool use_debugger ( int argc,
char * argv[] )
static

References ARRLEN, porting::getCurrentExecPath(), and warningstream.

Referenced by main().

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

Variable Documentation

◆ allowed_options

◆ file_log_output

FileLogOutput file_log_output
static

Referenced by init_log_streams().