#include <map_settings_manager.h>
Public Member Functions | |
MapSettingsManager (const std::string &map_meta_path) | |
~MapSettingsManager () | |
bool | getMapSetting (const std::string &name, std::string *value_out) const |
bool | getMapSettingNoiseParams (const std::string &name, NoiseParams *value_out) const |
bool | setMapSetting (const std::string &name, const std::string &value, bool override_meta=false) |
bool | setMapSettingNoiseParams (const std::string &name, const NoiseParams *value, bool override_meta=false) |
bool | loadMapMeta () |
bool | saveMapMeta () |
MapgenParams * | makeMapgenParams () |
Public Attributes | |
MapgenParams * | mapgen_params = nullptr |
Private Attributes | |
std::string | m_map_meta_path |
SettingsHierarchy | m_hierarchy |
Settings * | m_defaults |
Settings * | m_map_settings |
MapSettingsManager::MapSettingsManager | ( | const std::string & | map_meta_path | ) |
References m_defaults, m_hierarchy, and m_map_settings.
MapSettingsManager::~MapSettingsManager | ( | ) |
References m_defaults, m_map_settings, and mapgen_params.
bool MapSettingsManager::getMapSetting | ( | const std::string & | name, |
std::string * | value_out ) const |
References Settings::getNoEx(), and m_map_settings.
Referenced by ModApiMapgen::l_get_mapgen_edges(), ModApiMapgen::l_get_mapgen_params(), ModApiMapgen::l_get_mapgen_setting(), makeMapgenParams(), and TestMapSettingsManager::testMapSettingsManager().
bool MapSettingsManager::getMapSettingNoiseParams | ( | const std::string & | name, |
NoiseParams * | value_out ) const |
References Settings::getNoiseParams(), and m_map_settings.
Referenced by ModApiMapgen::l_get_mapgen_setting_noiseparams(), and TestMapSettingsManager::testMapSettingsManager().
bool MapSettingsManager::loadMapMeta | ( | ) |
References errorstream, m_map_meta_path, m_map_settings, open_ifstream(), and Settings::parseConfigLines().
Referenced by ServerMap::ServerMap(), TestMapSettingsManager::testMapMetaFailures(), TestMapSettingsManager::testMapMetaSaveLoad(), and TestMapSettingsManager::testMapSettingsManager().
MapgenParams * MapSettingsManager::makeMapgenParams | ( | ) |
References Mapgen::createMapgenParams(), errorstream, Mapgen::getMapgenName(), Mapgen::getMapgenType(), getMapSetting(), m_defaults, m_map_settings, MAPGEN_DEFAULT, MAPGEN_INVALID, mapgen_params, MapgenParams::mgtype, and MapgenParams::readParams().
Referenced by loadGameConfAndInitWorld(), TestMapSettingsManager::testMapMetaSaveLoad(), and TestMapSettingsManager::testMapSettingsManager().
bool MapSettingsManager::saveMapMeta | ( | ) |
References fs::CreateAllDirs(), errorstream, infostream, m_map_meta_path, m_map_settings, mapgen_params, fs::RemoveLastPathComponent(), Settings::updateConfigFile(), and MapgenParams::writeParams().
Referenced by loadGameConfAndInitWorld(), ServerMap::save(), TestMapSettingsManager::testMapMetaSaveLoad(), and TestMapSettingsManager::testMapSettingsManager().
bool MapSettingsManager::setMapSetting | ( | const std::string & | name, |
const std::string & | value, | ||
bool | override_meta = false ) |
References m_defaults, m_map_settings, mapgen_params, and Settings::set().
Referenced by ModApiMapgen::l_set_mapgen_params(), ModApiMapgen::l_set_mapgen_setting(), loadGameConfAndInitWorld(), and TestMapSettingsManager::testMapSettingsManager().
bool MapSettingsManager::setMapSettingNoiseParams | ( | const std::string & | name, |
const NoiseParams * | value, | ||
bool | override_meta = false ) |
References m_defaults, m_map_settings, mapgen_params, and Settings::setNoiseParams().
Referenced by ModApiMapgen::l_set_mapgen_setting_noiseparams(), and TestMapSettingsManager::testMapSettingsManager().
|
private |
Referenced by MapSettingsManager(), ~MapSettingsManager(), makeMapgenParams(), setMapSetting(), and setMapSettingNoiseParams().
|
private |
Referenced by MapSettingsManager().
|
private |
Referenced by loadMapMeta(), and saveMapMeta().
|
private |
MapgenParams* MapSettingsManager::mapgen_params = nullptr |