From: Perttu Ahola Date: Thu, 21 Mar 2013 19:42:23 +0000 (+0200) Subject: Support game-specific minetest.conf X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=c2250d95c4da368d1535794a1c7f2092ce479d7a;p=zefram%2Fminetest%2Fminetest_engine.git Support game-specific minetest.conf --- diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 19fa8147..af8b1cc9 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -57,6 +57,9 @@ eg. 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: diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index b0ae271c..25edffe3 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -243,3 +243,12 @@ void set_default_settings(Settings *settings) } +void override_default_settings(Settings *settings, Settings *from) +{ + std::vector names = from->getNames(); + for(size_t i=0; isetDefault(name, from->get(name)); + } +} + diff --git a/src/defaultsettings.h b/src/defaultsettings.h index 37e3f717..00aacad8 100644 --- a/src/defaultsettings.h +++ b/src/defaultsettings.h @@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc., class Settings; void set_default_settings(Settings *settings); +void override_default_settings(Settings *settings, Settings *from); #endif diff --git a/src/server.cpp b/src/server.cpp index 2dcab63b..f77ac6ad 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -58,6 +58,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "util/mathconstants.h" #include "rollback.h" #include "util/serialize.h" +#include "defaultsettings.h" void * ServerThread::Thread() { @@ -687,6 +688,13 @@ Server::Server( infostream<<"- config: "<