X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fservermain.cpp;h=146c548c506d4a16c9e40f2cc3cff7fb152274aa;hb=30c34cc23e9a060ef964854038a314a94ad5cbae;hp=d9b8af40239576a9fe0e576f3007b44b5f2a7737;hpb=fcaa61de3c244bcf9726f74e36e01aea09f9dc44;p=dragonfireclient.git diff --git a/src/servermain.cpp b/src/servermain.cpp index d9b8af402..146c548c5 100644 --- a/src/servermain.cpp +++ b/src/servermain.cpp @@ -25,12 +25,13 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifndef SERVER #ifdef _WIN32 + #pragma error ("For a server build, SERVER must be defined globally") #else #error "For a server build, SERVER must be defined globally" #endif #endif -#ifdef UNITTEST_DISABLE +#ifdef NDEBUG #ifdef _WIN32 #pragma message ("Disabling unit tests") #else @@ -66,6 +67,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "strfnd.h" #include "porting.h" #include "materials.h" +#include "config.h" +#include "mineral.h" +#include "filesys.h" /* Settings. @@ -76,6 +80,12 @@ Settings g_settings; extern void set_default_settings(); +// Global profiler +Profiler g_profiler; + +// A dummy thing +ITextureSource *g_texturesource = NULL; + /* Debug streams */ @@ -92,7 +102,6 @@ std::ostream *derr_server_ptr = &dstream; std::ostream *dout_client_ptr = &dstream; std::ostream *derr_client_ptr = &dstream; - /* gettime.h implementation */ @@ -107,6 +116,15 @@ u32 getTimeMs() int main(int argc, char *argv[]) { + /* + Initialization + */ + + // Set locale. This is for forcing '.' as the decimal point. + std::locale::global(std::locale("C")); + // This enables printing all characters in bitmap font + setlocale(LC_CTYPE, "en_US"); + /* Low-level initialization */ @@ -116,19 +134,39 @@ int main(int argc, char *argv[]) disable_stderr = true; #endif + porting::signal_handler_init(); + bool &kill = *porting::signal_handler_killstatus(); + + // Initialize porting::path_data and porting::path_userdata + porting::initializePaths(); + + // Create user data directory + fs::CreateDir(porting::path_userdata); + // Initialize debug streams - debugstreams_init(disable_stderr, DEBUGFILE); +#ifdef RUN_IN_PLACE + std::string debugfile = DEBUGFILE; +#else + std::string debugfile = porting::path_userdata+"/"+DEBUGFILE; +#endif + debugstreams_init(disable_stderr, debugfile.c_str()); // Initialize debug stacks debug_stacks_init(); DSTACK(__FUNCTION_NAME); - porting::initializePaths(); - - initializeMaterialProperties(); + // Init material properties table + //initializeMaterialProperties(); + // Debug handler BEGIN_DEBUG_EXCEPTION_HANDLER + // Print startup message + dstream< filenames; filenames.push_back(porting::path_userdata + "/minetest.conf"); +#ifdef RUN_IN_PLACE + filenames.push_back(porting::path_userdata + "/../minetest.conf"); +#endif for(u32 i=0; i list = server.getPlayerInfo(); - core::list::Iterator i; - static u32 sum_old = 0; - u32 sum = PIChecksum(list); - if(sum != sum_old) - { - std::cout<PrintLine(&std::cout); - } - } - sum_old = sum; - } - } - + // Run server + dedicated_server_loop(server, kill); + } //try catch(con::PeerNotFoundException &e) {