From 9e46cbf7ea512330f35d0f2ede0c7c0c085c7cf4 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Wed, 12 Oct 2011 13:53:38 +0300 Subject: Header file tweaking; mainly for speed --- src/servermain.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'src/servermain.cpp') diff --git a/src/servermain.cpp b/src/servermain.cpp index dc41720fb..d429d2078 100644 --- a/src/servermain.cpp +++ b/src/servermain.cpp @@ -70,18 +70,20 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "config.h" #include "mineral.h" #include "filesys.h" +#include "defaultsettings.h" +#include "settings.h" +#include "profiler.h" /* Settings. These are loaded from the config file. */ - -Settings g_settings; - -extern void set_default_settings(); +Settings main_settings; +Settings *g_settings = &main_settings; // Global profiler -Profiler g_profiler; +Profiler main_profiler; +Profiler *g_profiler = &main_profiler; // A dummy thing ITextureSource *g_texturesource = NULL; @@ -221,7 +223,7 @@ int main(int argc, char *argv[]) */ // Initialize default settings - set_default_settings(); + set_default_settings(g_settings); // Initialize sockets sockets_init(); @@ -236,7 +238,7 @@ int main(int argc, char *argv[]) if(cmd_args.exists("config")) { - bool r = g_settings.readConfigFile(cmd_args.get("config").c_str()); + bool r = g_settings->readConfigFile(cmd_args.get("config").c_str()); if(r == false) { dstream<<"Could not read configuration from \"" @@ -255,7 +257,7 @@ int main(int argc, char *argv[]) for(u32 i=0; ireadConfigFile(filenames[i].c_str()); if(r) { configpath = filenames[i]; @@ -305,9 +307,9 @@ int main(int argc, char *argv[]) { port = cmd_args.getU16("port"); } - else if(g_settings.exists("port") && g_settings.getU16("port") != 0) + else if(g_settings->exists("port") && g_settings->getU16("port") != 0) { - port = g_settings.getU16("port"); + port = g_settings->getU16("port"); } else { @@ -319,8 +321,8 @@ int main(int argc, char *argv[]) std::string map_dir = porting::path_userdata+"/world"; if(cmd_args.exists("map-dir")) map_dir = cmd_args.get("map-dir"); - else if(g_settings.exists("map-dir")) - map_dir = g_settings.get("map-dir"); + else if(g_settings->exists("map-dir")) + map_dir = g_settings->get("map-dir"); // Create server Server server(map_dir.c_str(), configpath); -- cgit v1.2.3