]> git.lizzy.rs Git - minetest.git/blobdiff - src/main.cpp
Use numeric indices and raw table access with LUA_REGISTRYINDEX
[minetest.git] / src / main.cpp
index d84a09f7616e3dd2edc18d6c14ef540c8a19b7a2..950d30b5a21607c08f8cb182d758d9971c4d6392 100644 (file)
@@ -29,11 +29,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include "irrlicht.h" // createDevice
 
-#include "main.h"
 #include "mainmenumanager.h"
 #include "irrlichttypes_extrabloated.h"
 #include "debug.h"
-#include "test.h"
+#include "unittest/test.h"
 #include "server.h"
 #include "filesys.h"
 #include "version.h"
@@ -41,7 +40,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "game.h"
 #include "defaultsettings.h"
 #include "gettext.h"
-#include "profiler.h"
 #include "log.h"
 #include "quicktune.h"
 #include "httpfetch.h"
@@ -59,38 +57,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "touchscreengui.h"
 #endif
 
-/*
-       Settings.
-       These are loaded from the config file.
-*/
-static Settings main_settings;
-Settings *g_settings = &main_settings;
-std::string g_settings_path;
-
-// Global profiler
-Profiler main_profiler;
-Profiler *g_profiler = &main_profiler;
-
-// Menu clouds are created later
-Clouds *g_menuclouds = 0;
-irr::scene::ISceneManager *g_menucloudsmgr = 0;
-
-/*
-       Debug streams
-*/
-
-// Connection
-std::ostream *dout_con_ptr = &dummyout;
-std::ostream *derr_con_ptr = &verbosestream;
-
-// Server
-std::ostream *dout_server_ptr = &infostream;
-std::ostream *derr_server_ptr = &errorstream;
-
-// Client
-std::ostream *dout_client_ptr = &infostream;
-std::ostream *derr_client_ptr = &errorstream;
-
 #define DEBUGFILE "debug.txt"
 #define DEFAULT_SERVER_PORT 30000
 
@@ -137,26 +103,6 @@ static bool migrate_database(const GameParams &game_params, const Settings &cmd_
 
 /**********************************************************************/
 
-#ifndef SERVER
-/*
-       Random stuff
-*/
-
-/* mainmenumanager.h */
-
-gui::IGUIEnvironment* guienv = NULL;
-gui::IGUIStaticText *guiroot = NULL;
-MainMenuManager g_menumgr;
-
-bool noMenuActive()
-{
-       return (g_menumgr.menuCount() == 0);
-}
-
-// Passed to menus to allow disconnecting and exiting
-MainGameCallback *g_gamecallback = NULL;
-#endif
-
 /*
        gettime.h implementation
 */
@@ -207,7 +153,7 @@ int main(int argc, char *argv[])
        log_add_output_maxlev(&main_stderr_log_out, LMT_ACTION);
        log_add_output_all_levs(&main_dstream_no_stderr_log_out);
 
-       log_register_thread("main");
+       log_register_thread("Main");
 
        Settings cmd_args;
        bool cmd_args_ok = get_cmdline_opts(argc, argv, &cmd_args);
@@ -400,20 +346,18 @@ static void print_allowed_options(const OptionList &allowed_options)
 
 static void print_version()
 {
-#ifdef SERVER
-       dstream << "minetestserver " << minetest_version_hash << std::endl;
-#else
-       dstream << "Minetest " << minetest_version_hash << std::endl;
+       dstream << PROJECT_NAME_C " " << g_version_hash << std::endl;
+#ifndef SERVER
        dstream << "Using Irrlicht " << IRRLICHT_SDK_VERSION << std::endl;
 #endif
-       dstream << "Build info: " << minetest_build_info << std::endl;
+       dstream << "Build info: " << g_build_info << std::endl;
 }
 
 static void list_game_ids()
 {
        std::set<std::string> gameids = getAvailableGameIds();
        for (std::set<std::string>::const_iterator i = gameids.begin();
-                       i != gameids.end(); i++)
+                       i != gameids.end(); ++i)
                dstream << (*i) <<std::endl;
 }
 
@@ -543,7 +487,7 @@ static void startup_message()
        infostream << PROJECT_NAME << " " << _("with")
                   << " SER_FMT_VER_HIGHEST_READ="
                << (int)SER_FMT_VER_HIGHEST_READ << ", "
-               << minetest_build_info << std::endl;
+               << g_build_info << std::endl;
 }
 
 static bool read_config_file(const Settings &cmd_args)