Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
subgames.cpp File Reference
#include <common/c_internal.h>
#include "content/subgames.h"
#include "porting.h"
#include "filesys.h"
#include "settings.h"
#include "log.h"
#include "util/strfnd.h"
#include "defaultsettings.h"
#include "map_settings_manager.h"
#include "util/string.h"
+ Include dependency graph for subgames.cpp:

Classes

struct  GameFindPath
 

Macros

#define MAX_WORLD_NAMES   100
 
#define LEGACY_GAMEID   "minetest"
 

Functions

std::string getSubgamePathEnv ()
 
static SubgameSpec getSubgameSpec (const std::string &game_id, const std::string &game_path, const std::unordered_map< std::string, std::string > &mods_paths)
 
SubgameSpec findSubgame (const std::string &id)
 
SubgameSpec findWorldSubgame (const std::string &world_path)
 
std::set< std::string > getAvailableGameIds ()
 
std::vector< SubgameSpecgetAvailableGames ()
 
bool getWorldExists (const std::string &world_path)
 
std::string getWorldName (const std::string &world_path, const std::string &default_name)
 Try to get the displayed name of a world.
 
std::string getWorldGameId (const std::string &world_path, bool can_be_legacy)
 
std::string getWorldPathEnv ()
 
std::vector< WorldSpecgetAvailableWorlds ()
 
void loadGameConfAndInitWorld (const std::string &path, const std::string &name, const SubgameSpec &gamespec, bool create_world)
 
std::vector< std::string > getEnvModPaths ()
 

Macro Definition Documentation

◆ LEGACY_GAMEID

#define LEGACY_GAMEID   "minetest"

Referenced by getWorldGameId().

◆ MAX_WORLD_NAMES

#define MAX_WORLD_NAMES   100

Function Documentation

◆ findSubgame()

SubgameSpec findSubgame ( const std::string & id)

References fs::AbsolutePath(), BasicStrfnd< T >::at_end(), DIR_DELIM, getEnvModPaths(), getSubgamePathEnv(), getSubgameSpec(), BasicStrfnd< T >::next(), PATH_DELIM, porting::path_share, porting::path_user, and fs::PathExists().

Referenced by findWorldSubgame(), get_game_from_cmdline(), getAvailableGames(), read_translation_file(), TestServerModManager::runTests(), and TEST_CASE().

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

◆ findWorldSubgame()

SubgameSpec findWorldSubgame ( const std::string & world_path)

References DIR_DELIM, findSubgame(), getSubgameSpec(), getWorldGameId(), and fs::PathExists().

Referenced by ServerModManager::ServerModManager(), determine_subgame(), ModApiMainMenu::l_check_mod_configuration(), and ClientLauncher::launch_game().

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

◆ getAvailableGameIds()

std::set< std::string > getAvailableGameIds ( )

References BasicStrfnd< T >::at_end(), DIR_DELIM, fs::GetDirListing(), getSubgamePathEnv(), BasicStrfnd< T >::next(), PATH_DELIM, porting::path_share, porting::path_user, Settings::readConfigFile(), and removeStringEnd().

Referenced by getAvailableGames(), and list_game_ids().

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

◆ getAvailableGames()

std::vector< SubgameSpec > getAvailableGames ( )

References findSubgame(), and getAvailableGameIds().

Referenced by ModApiMainMenu::l_create_world(), and ModApiMainMenu::l_get_games().

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

◆ getAvailableWorlds()

std::vector< WorldSpec > getAvailableWorlds ( )

References BasicStrfnd< T >::at_end(), DIR_DELIM, fs::GetDirListing(), getWorldGameId(), getWorldName(), getWorldPathEnv(), infostream, WorldSpec::isValid(), BasicStrfnd< T >::next(), PATH_DELIM, porting::path_user, and fs::PathExists().

Referenced by auto_select_world(), get_world_from_cmdline(), ModApiMainMenu::l_delete_world(), ModApiMainMenu::l_get_worlds(), ClientLauncher::launch_game(), and list_worlds().

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

◆ getEnvModPaths()

std::vector< std::string > getEnvModPaths ( )

References BasicStrfnd< T >::at_end(), BasicStrfnd< T >::next(), and PATH_DELIM.

Referenced by findSubgame(), and ModApiMainMenu::l_get_modpaths().

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

◆ getSubgamePathEnv()

std::string getSubgamePathEnv ( )

References warningstream.

Referenced by findSubgame(), and getAvailableGameIds().

+ Here is the caller graph for this function:

◆ getSubgameSpec()

static SubgameSpec getSubgameSpec ( const std::string & game_id,
const std::string & game_path,
const std::unordered_map< std::string, std::string > & mods_paths )
static

References SubgameSpec::deprecation_msgs, DIR_DELIM, Settings::exists(), Settings::get(), Settings::getS32(), and Settings::readConfigFile().

Referenced by findSubgame(), and findWorldSubgame().

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

◆ getWorldExists()

bool getWorldExists ( const std::string & world_path)

References DIR_DELIM, and fs::PathExists().

Referenced by determine_subgame().

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

◆ getWorldGameId()

std::string getWorldGameId ( const std::string & world_path,
bool can_be_legacy )

References DIR_DELIM, Settings::exists(), Settings::get(), LEGACY_GAMEID, fs::PathExists(), and Settings::readConfigFile().

Referenced by determine_subgame(), findWorldSubgame(), getAvailableWorlds(), and ClientLauncher::launch_game().

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

◆ getWorldName()

std::string getWorldName ( const std::string & world_path,
const std::string & default_name )

Try to get the displayed name of a world.

References DIR_DELIM, Settings::exists(), Settings::get(), and Settings::readConfigFile().

Referenced by getAvailableWorlds().

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

◆ getWorldPathEnv()

std::string getWorldPathEnv ( )

Referenced by getAvailableWorlds().

+ Here is the caller graph for this function:

◆ loadGameConfAndInitWorld()

void loadGameConfAndInitWorld ( const std::string & path,
const std::string & name,
const SubgameSpec & gamespec,
bool create_world )

References fs::CreateAllDirs(), Settings::createLayer(), DIR_DELIM, Settings::exists(), g_settings, Settings::get(), Settings::getBool(), Settings::getLayer(), SubgameSpec::id, infostream, MapSettingsManager::makeMapgenParams(), MAP_BLOCKSIZE, MAX_WORLD_NAMES, SubgameSpec::path, fs::PathExists(), Settings::readConfigFile(), Settings::removeSecureSettings(), MapSettingsManager::saveMapMeta(), Settings::set(), Settings::setBool(), MapSettingsManager::setMapSetting(), SL_GAME, and Settings::updateConfigFile().

Referenced by Server::init(), and ModApiMainMenu::l_create_world().

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