Common mods are loaded from the pseudo-game "common".
+The game directory can contain the file minetest.conf, which will be used
+to set default settings when running the particular game.
+
Mod load path
-------------
Generic:
}
+void override_default_settings(Settings *settings, Settings *from)
+{
+ std::vector<std::string> names = from->getNames();
+ for(size_t i=0; i<names.size(); i++){
+ const std::string &name = names[i];
+ settings->setDefault(name, from->get(name));
+ }
+}
+
class Settings;
void set_default_settings(Settings *settings);
+void override_default_settings(Settings *settings, Settings *from);
#endif
#include "util/mathconstants.h"
#include "rollback.h"
#include "util/serialize.h"
+#include "defaultsettings.h"
void * ServerThread::Thread()
{
infostream<<"- config: "<<m_path_config<<std::endl;
infostream<<"- game: "<<m_gamespec.path<<std::endl;
+ // Initialize default settings and override defaults with those provided
+ // by the game
+ set_default_settings(g_settings);
+ Settings gamedefaults;
+ getGameMinetestConfig(gamespec.path, gamedefaults);
+ override_default_settings(g_settings, &gamedefaults);
+
// Create biome definition manager
m_biomedef = new BiomeDefManager(this);
#include "log.h"
#include "util/string.h"
+bool getGameMinetestConfig(const std::string &game_path, Settings &conf)
+{
+ std::string conf_path = game_path + DIR_DELIM + "minetest.conf";
+ return conf.readConfigFile(conf_path.c_str());
+}
+
bool getGameConfig(const std::string &game_path, Settings &conf)
{
std::string conf_path = game_path + DIR_DELIM + "game.conf";
}
};
+// minetest.conf
+bool getGameMinetestConfig(const std::string &game_path, Settings &conf);
+// game.conf
bool getGameConfig(const std::string &game_path, Settings &conf);
std::string getGameName(const std::string &game_path);