aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build/android/jni/Android.mk1
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/camera.cpp5
-rw-r--r--src/client.cpp1
-rw-r--r--src/client/clientlauncher.cpp21
-rw-r--r--src/client/tile.cpp1
-rw-r--r--src/clientiface.cpp1
-rw-r--r--src/clientmap.cpp3
-rw-r--r--src/clientmedia.cpp1
-rw-r--r--src/clouds.cpp7
-rw-r--r--src/clouds.h8
-rw-r--r--src/collision.cpp1
-rw-r--r--src/content_abm.cpp1
-rw-r--r--src/content_cao.cpp1
-rw-r--r--src/content_mapblock.cpp1
-rw-r--r--src/content_sao.cpp1
-rw-r--r--src/convert_json.cpp1
-rw-r--r--src/database-sqlite3.cpp1
-rw-r--r--src/drawscene.cpp1
-rw-r--r--src/dungeongen.cpp3
-rw-r--r--src/emerge.cpp1
-rw-r--r--src/environment.cpp2
-rw-r--r--src/fontengine.cpp1
-rw-r--r--src/guiChatConsole.cpp1
-rw-r--r--src/guiEngine.cpp2
-rw-r--r--src/guiFormSpecMenu.cpp1
-rw-r--r--src/guiKeyChangeMenu.cpp1
-rw-r--r--src/guiTable.cpp1
-rw-r--r--src/guiVolumeChange.cpp1
-rw-r--r--src/guiscalingfilter.cpp1
-rw-r--r--src/httpfetch.cpp1
-rw-r--r--src/hud.cpp1
-rw-r--r--src/inventorymanager.cpp1
-rw-r--r--src/itemdef.cpp1
-rw-r--r--src/keycode.cpp1
-rw-r--r--src/localplayer.cpp1
-rw-r--r--src/log.cpp14
-rw-r--r--src/log.h17
-rw-r--r--src/main.cpp53
-rw-r--r--src/main.h61
-rw-r--r--src/mainmenumanager.h2
-rw-r--r--src/map.cpp1
-rw-r--r--src/mapblock_mesh.cpp1
-rw-r--r--src/mapgen.cpp3
-rw-r--r--src/mapgen_v5.cpp1
-rw-r--r--src/mapgen_v6.cpp1
-rw-r--r--src/mapgen_v7.cpp1
-rw-r--r--src/mapnode.cpp1
-rw-r--r--src/mg_biome.cpp1
-rw-r--r--src/mods.cpp4
-rw-r--r--src/network/connection.cpp1
-rw-r--r--src/network/serverpackethandler.cpp1
-rw-r--r--src/nodedef.cpp1
-rw-r--r--src/particles.cpp1
-rw-r--r--src/porting.cpp1
-rw-r--r--src/profiler.cpp23
-rw-r--r--src/profiler.h8
-rw-r--r--src/script/common/c_internal.cpp1
-rw-r--r--src/script/lua_api/l_internal.h1
-rw-r--r--src/script/lua_api/l_mainmenu.cpp1
-rw-r--r--src/script/lua_api/l_mapgen.cpp1
-rw-r--r--src/script/lua_api/l_util.cpp1
-rw-r--r--src/server.cpp1
-rw-r--r--src/serverlist.cpp2
-rw-r--r--src/settings.cpp3
-rw-r--r--src/settings.h4
-rw-r--r--src/shader.cpp4
-rw-r--r--src/sky.cpp7
-rw-r--r--src/socket.cpp1
-rw-r--r--src/subgame.cpp7
-rw-r--r--src/test.cpp1
-rw-r--r--src/wieldmesh.cpp1
72 files changed, 119 insertions, 193 deletions
diff --git a/build/android/jni/Android.mk b/build/android/jni/Android.mk
index af7980c51..ab4a9cfcc 100644
--- a/build/android/jni/Android.mk
+++ b/build/android/jni/Android.mk
@@ -183,6 +183,7 @@ LOCAL_SRC_FILES := \
jni/src/player.cpp \
jni/src/porting_android.cpp \
jni/src/porting.cpp \
+ jni/src/profiler.cpp \
jni/src/quicktune.cpp \
jni/src/rollback.cpp \
jni/src/rollback_interface.cpp \
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a1c2d013c..ff700257c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -329,6 +329,7 @@ set(common_SRCS
pathfinder.cpp
player.cpp
porting.cpp
+ profiler.cpp
quicktune.cpp
rollback.cpp
rollback_interface.cpp
diff --git a/src/camera.cpp b/src/camera.cpp
index 0152f7041..ca28555d2 100644
--- a/src/camera.cpp
+++ b/src/camera.cpp
@@ -20,14 +20,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "camera.h"
#include "debug.h"
#include "client.h"
-#include "main.h" // for g_settings
#include "map.h"
-#include "clientmap.h" // MapDrawControl
+#include "clientmap.h" // MapDrawControl
#include "player.h"
#include <cmath>
#include "settings.h"
#include "wieldmesh.h"
-#include "noise.h" // easeCurve
+#include "noise.h" // easeCurve
#include "gamedef.h"
#include "sound.h"
#include "event.h"
diff --git a/src/client.cpp b/src/client.cpp
index ba78cb51e..d2bbdc284 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -28,7 +28,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "util/string.h"
#include "client.h"
#include "network/clientopcodes.h"
-#include "main.h"
#include "filesys.h"
#include "porting.h"
#include "mapblock_mesh.h"
diff --git a/src/client/clientlauncher.cpp b/src/client/clientlauncher.cpp
index 6815082a6..fe4dec40f 100644
--- a/src/client/clientlauncher.cpp
+++ b/src/client/clientlauncher.cpp
@@ -17,7 +17,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include "main.h"
#include "mainmenumanager.h"
#include "debug.h"
#include "clouds.h"
@@ -35,9 +34,23 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "fontengine.h"
#include "clientlauncher.h"
-// A pointer to a global instance of the time getter
-// TODO: why?
-TimeGetter *g_timegetter = NULL;
+/* 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;
+
+
+// Instance of the time getter
+static TimeGetter *g_timegetter = NULL;
u32 getTimeMs()
{
diff --git a/src/client/tile.cpp b/src/client/tile.cpp
index 283b262a6..315c2fa29 100644
--- a/src/client/tile.cpp
+++ b/src/client/tile.cpp
@@ -26,7 +26,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "util/numeric.h"
#include "irrlichttypes_extrabloated.h"
#include "debug.h"
-#include "main.h" // for g_settings
#include "filesys.h"
#include "settings.h"
#include "mesh.h"
diff --git a/src/clientiface.cpp b/src/clientiface.cpp
index 3171e7795..7649be29e 100644
--- a/src/clientiface.cpp
+++ b/src/clientiface.cpp
@@ -30,7 +30,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "map.h"
#include "emerge.h"
#include "serverobject.h" // TODO this is used for cleanup of only
-#include "main.h" // for g_settings
#include "log.h"
const char *ClientInterface::statenames[] = {
diff --git a/src/clientmap.cpp b/src/clientmap.cpp
index 907df7128..1a52ac4ab 100644
--- a/src/clientmap.cpp
+++ b/src/clientmap.cpp
@@ -24,12 +24,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <matrix4.h>
#include "log.h"
#include "mapsector.h"
-#include "main.h" // dout_client, g_settings
#include "nodedef.h"
#include "mapblock.h"
#include "profiler.h"
#include "settings.h"
-#include "camera.h" // CameraModes
+#include "camera.h" // CameraModes
#include "util/mathconstants.h"
#include <algorithm>
diff --git a/src/clientmedia.cpp b/src/clientmedia.cpp
index 0918e8a37..ea11ad239 100644
--- a/src/clientmedia.cpp
+++ b/src/clientmedia.cpp
@@ -26,7 +26,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "log.h"
#include "porting.h"
#include "settings.h"
-#include "main.h"
#include "network/networkprotocol.h"
#include "util/hex.h"
#include "util/serialize.h"
diff --git a/src/clouds.cpp b/src/clouds.cpp
index 8fea7a6aa..3409aac73 100644
--- a/src/clouds.cpp
+++ b/src/clouds.cpp
@@ -21,10 +21,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "noise.h"
#include "constants.h"
#include "debug.h"
-#include "main.h" // For g_profiler and g_settings
#include "profiler.h"
#include "settings.h"
+
+// Menu clouds are created later
+class Clouds;
+Clouds *g_menuclouds = NULL;
+irr::scene::ISceneManager *g_menucloudsmgr = NULL;
+
Clouds::Clouds(
scene::ISceneNode* parent,
scene::ISceneManager* mgr,
diff --git a/src/clouds.h b/src/clouds.h
index a9e58e0f0..add8a7247 100644
--- a/src/clouds.h
+++ b/src/clouds.h
@@ -24,6 +24,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <iostream>
#include "constants.h"
+// Menu clouds
+class Clouds;
+extern Clouds *g_menuclouds;
+
+// Scene manager used for menu clouds
+namespace irr{namespace scene{class ISceneManager;}}
+extern irr::scene::ISceneManager *g_menucloudsmgr;
+
class Clouds : public scene::ISceneNode
{
public:
diff --git a/src/collision.cpp b/src/collision.cpp
index 12eabff09..c759f20c0 100644
--- a/src/collision.cpp
+++ b/src/collision.cpp
@@ -28,7 +28,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <vector>
#include <set>
#include "util/timetaker.h"
-#include "main.h" // g_profiler
#include "profiler.h"
// float error is 10 - 9.96875 = 0.03125
diff --git a/src/content_abm.cpp b/src/content_abm.cpp
index 1ee41b2ec..8694ef981 100644
--- a/src/content_abm.cpp
+++ b/src/content_abm.cpp
@@ -25,7 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "content_sao.h"
#include "settings.h"
#include "mapblock.h" // For getNodeBlockPos
-#include "main.h" // for g_settings
#include "map.h"
#include "scripting_game.h"
#include "log.h"
diff --git a/src/content_cao.cpp b/src/content_cao.cpp
index 6b7083d83..a8b107b49 100644
--- a/src/content_cao.cpp
+++ b/src/content_cao.cpp
@@ -42,7 +42,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "nodedef.h"
#include "localplayer.h"
#include "map.h"
-#include "main.h" // g_settings
#include "camera.h" // CameraModes
#include "wieldmesh.h"
#include "log.h"
diff --git a/src/content_mapblock.cpp b/src/content_mapblock.cpp
index a730c50a3..8fa041312 100644
--- a/src/content_mapblock.cpp
+++ b/src/content_mapblock.cpp
@@ -20,7 +20,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "content_mapblock.h"
#include "util/numeric.h"
#include "util/directiontables.h"
-#include "main.h" // For g_settings
#include "mapblock_mesh.h" // For MapBlock_LightColor() and MeshCollector
#include "settings.h"
#include "nodedef.h"
diff --git a/src/content_sao.cpp b/src/content_sao.cpp
index 9fc61aea7..51f074f7c 100644
--- a/src/content_sao.cpp
+++ b/src/content_sao.cpp
@@ -23,7 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "collision.h"
#include "environment.h"
#include "settings.h"
-#include "main.h" // For g_profiler
#include "profiler.h"
#include "serialization.h" // For compressZlib
#include "tool.h" // For ToolCapabilities
diff --git a/src/convert_json.cpp b/src/convert_json.cpp
index cea089623..68912d482 100644
--- a/src/convert_json.cpp
+++ b/src/convert_json.cpp
@@ -25,7 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "mods.h"
#include "config.h"
#include "log.h"
-#include "main.h" // for g_settings
#include "settings.h"
#include "httpfetch.h"
#include "porting.h"
diff --git a/src/database-sqlite3.cpp b/src/database-sqlite3.cpp
index c937cae31..45de3cb60 100644
--- a/src/database-sqlite3.cpp
+++ b/src/database-sqlite3.cpp
@@ -30,7 +30,6 @@ SQLite format specification:
#include "log.h"
#include "filesys.h"
#include "exceptions.h"
-#include "main.h"
#include "settings.h"
#include "util/string.h"
diff --git a/src/drawscene.cpp b/src/drawscene.cpp
index c3c3b2ef2..f7cfdd262 100644
--- a/src/drawscene.cpp
+++ b/src/drawscene.cpp
@@ -18,7 +18,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include "drawscene.h"
-#include "main.h" // for g_settings
#include "settings.h"
#include "clouds.h"
#include "clientmap.h"
diff --git a/src/dungeongen.cpp b/src/dungeongen.cpp
index 3b7e755b3..7e292024d 100644
--- a/src/dungeongen.cpp
+++ b/src/dungeongen.cpp
@@ -26,8 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "map.h"
#include "nodedef.h"
#include "profiler.h"
-#include "settings.h" // For g_settings
-#include "main.h" // For g_profiler
+#include "settings.h"
//#define DGEN_USE_TORCHES
diff --git a/src/emerge.cpp b/src/emerge.cpp
index bf104e035..9c5ee452e 100644
--- a/src/emerge.cpp
+++ b/src/emerge.cpp
@@ -28,7 +28,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "environment.h"
#include "util/container.h"
#include "util/thread.h"
-#include "main.h"
#include "constants.h"
#include "voxel.h"
#include "config.h"
diff --git a/src/environment.cpp b/src/environment.cpp
index d437dbd5d..af213e5e2 100644
--- a/src/environment.cpp
+++ b/src/environment.cpp
@@ -17,6 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include <fstream>
#include "environment.h"
#include "filesys.h"
#include "porting.h"
@@ -31,7 +32,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "scripting_game.h"
#include "nodedef.h"
#include "nodemetadata.h"
-#include "main.h" // For g_settings, g_profiler
#include "gamedef.h"
#ifndef SERVER
#include "clientmap.h"
diff --git a/src/fontengine.cpp b/src/fontengine.cpp
index fa30b4038..14b65f593 100644
--- a/src/fontengine.cpp
+++ b/src/fontengine.cpp
@@ -18,7 +18,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include "fontengine.h"
#include "log.h"
-#include "main.h"
#include "config.h"
#include "porting.h"
#include "constants.h"
diff --git a/src/guiChatConsole.cpp b/src/guiChatConsole.cpp
index b52589044..3937e405c 100644
--- a/src/guiChatConsole.cpp
+++ b/src/guiChatConsole.cpp
@@ -24,7 +24,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "gettime.h"
#include "keycode.h"
#include "settings.h"
-#include "main.h" // for g_settings
#include "porting.h"
#include "client/tile.h"
#include "fontengine.h"
diff --git a/src/guiEngine.cpp b/src/guiEngine.cpp
index 07fdbb16e..6989ffa35 100644
--- a/src/guiEngine.cpp
+++ b/src/guiEngine.cpp
@@ -19,6 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "guiEngine.h"
+#include <fstream>
#include <IGUIStaticText.h>
#include <ICameraSceneNode.h>
#include "scripting_mainmenu.h"
@@ -27,7 +28,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "version.h"
#include "porting.h"
#include "filesys.h"
-#include "main.h"
#include "settings.h"
#include "guiMainMenu.h"
#include "sound.h"
diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp
index c29e74f7a..5f67bb22a 100644
--- a/src/guiFormSpecMenu.cpp
+++ b/src/guiFormSpecMenu.cpp
@@ -44,7 +44,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "gettext.h"
#include "scripting_game.h"
#include "porting.h"
-#include "main.h"
#include "settings.h"
#include "client.h"
#include "fontengine.h"
diff --git a/src/guiKeyChangeMenu.cpp b/src/guiKeyChangeMenu.cpp
index 3ddb3f5d9..008ac8c5d 100644
--- a/src/guiKeyChangeMenu.cpp
+++ b/src/guiKeyChangeMenu.cpp
@@ -22,7 +22,6 @@
#include "guiKeyChangeMenu.h"
#include "debug.h"
#include "serialization.h"
-#include "main.h"
#include <string>
#include <IGUICheckBox.h>
#include <IGUIEditBox.h>
diff --git a/src/guiTable.cpp b/src/guiTable.cpp
index 6dcd115b0..e915770a4 100644
--- a/src/guiTable.cpp
+++ b/src/guiTable.cpp
@@ -33,7 +33,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "util/string.h"
#include "util/numeric.h"
#include "util/string.h" // for parseColorString()
-#include "main.h"
#include "settings.h" // for settings
#include "porting.h" // for dpi
#include "guiscalingfilter.h"
diff --git a/src/guiVolumeChange.cpp b/src/guiVolumeChange.cpp
index b31b99a98..c8e257f7f 100644
--- a/src/guiVolumeChange.cpp
+++ b/src/guiVolumeChange.cpp
@@ -26,7 +26,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <IGUIScrollBar.h>
#include <IGUIStaticText.h>
#include <IGUIFont.h>
-#include "main.h"
#include "settings.h"
#include "gettext.h"
diff --git a/src/guiscalingfilter.cpp b/src/guiscalingfilter.cpp
index 872d222d8..33e0648ad 100644
--- a/src/guiscalingfilter.cpp
+++ b/src/guiscalingfilter.cpp
@@ -19,7 +19,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "guiscalingfilter.h"
#include "imagefilters.h"
#include "settings.h"
-#include "main.h" // for g_settings
#include "util/numeric.h"
#include <stdio.h>
diff --git a/src/httpfetch.cpp b/src/httpfetch.cpp
index e17a8b187..50ad9e4af 100644
--- a/src/httpfetch.cpp
+++ b/src/httpfetch.cpp
@@ -33,7 +33,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "util/container.h"
#include "util/thread.h"
#include "version.h"
-#include "main.h"
#include "settings.h"
JMutex g_httpfetch_mutex;
diff --git a/src/hud.cpp b/src/hud.cpp
index 0b34a7b5b..02b69a12c 100644
--- a/src/hud.cpp
+++ b/src/hud.cpp
@@ -20,7 +20,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include "hud.h"
-#include "main.h"
#include "settings.h"
#include "util/numeric.h"
#include "log.h"
diff --git a/src/inventorymanager.cpp b/src/inventorymanager.cpp
index 178985dfd..c3a9576f9 100644
--- a/src/inventorymanager.cpp
+++ b/src/inventorymanager.cpp
@@ -22,7 +22,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "environment.h"
#include "scripting_game.h"
#include "serverobject.h"
-#include "main.h" // for g_settings
#include "settings.h"
#include "craftdef.h"
#include "rollback_interface.h"
diff --git a/src/itemdef.cpp b/src/itemdef.cpp
index 65ba356f4..95c1e47fc 100644
--- a/src/itemdef.cpp
+++ b/src/itemdef.cpp
@@ -31,7 +31,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "client/tile.h"
#endif
#include "log.h"
-#include "main.h" // g_settings
#include "settings.h"
#include "util/serialize.h"
#include "util/container.h"
diff --git a/src/keycode.cpp b/src/keycode.cpp
index d9fc88934..1ec325961 100644
--- a/src/keycode.cpp
+++ b/src/keycode.cpp
@@ -18,7 +18,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include "keycode.h"
-#include "main.h" // For g_settings
#include "exceptions.h"
#include "settings.h"
#include "log.h"
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 55578422e..51d9bdd4b 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -19,7 +19,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "localplayer.h"
-#include "main.h" // For g_settings
#include "event.h"
#include "collision.h"
#include "gamedef.h"
diff --git a/src/log.cpp b/src/log.cpp
index 398c89eb0..e6d80db34 100644
--- a/src/log.cpp
+++ b/src/log.cpp
@@ -30,6 +30,20 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "porting.h"
#include "config.h"
+// 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;
+
+#ifndef SERVER
+// Client
+std::ostream *dout_client_ptr = &infostream;
+std::ostream *derr_client_ptr = &errorstream;
+#endif
+
#ifdef __ANDROID__
unsigned int android_log_level_mapping[] = {
/* LMT_ERROR */ ANDROID_LOG_ERROR,
diff --git a/src/log.h b/src/log.h
index 6240e34ed..bd223927a 100644
--- a/src/log.h
+++ b/src/log.h
@@ -81,5 +81,22 @@ extern bool log_trace_level_enabled;
#define TRACESTREAM(x){ if(log_trace_level_enabled) verbosestream x; }
#define TRACEDO(x){ if(log_trace_level_enabled){ x ;} }
+extern std::ostream *dout_con_ptr;
+extern std::ostream *derr_con_ptr;
+extern std::ostream *dout_server_ptr;
+extern std::ostream *derr_server_ptr;
+#define dout_con (*dout_con_ptr)
+#define derr_con (*derr_con_ptr)
+#define dout_server (*dout_server_ptr)
+#define derr_server (*derr_server_ptr)
+
+#ifndef SERVER
+extern std::ostream *dout_client_ptr;
+extern std::ostream *derr_client_ptr;
+#define dout_client (*dout_client_ptr)
+#define derr_client (*derr_client_ptr)
+
+#endif
+
#endif
diff --git a/src/main.cpp b/src/main.cpp
index 3893b9a82..dc0a01f80 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -29,7 +29,6 @@ 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"
@@ -59,38 +58,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 +104,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
*/
diff --git a/src/main.h b/src/main.h
deleted file mode 100644
index 191b41887..000000000
--- a/src/main.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-Minetest
-Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation; either version 2.1 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
-
-#ifndef MAIN_HEADER
-#define MAIN_HEADER
-
-#include <string>
-
-// Settings
-class Settings;
-extern Settings *g_settings;
-extern std::string g_settings_path;
-
-// Global profiler
-class Profiler;
-extern Profiler *g_profiler;
-
-// Menu clouds
-class Clouds;
-extern Clouds *g_menuclouds;
-
-// Scene manager used for menu clouds
-namespace irr{namespace scene{class ISceneManager;}}
-extern irr::scene::ISceneManager *g_menucloudsmgr;
-
-// Debug streams
-
-#include <fstream>
-
-extern std::ostream *dout_con_ptr;
-extern std::ostream *derr_con_ptr;
-extern std::ostream *dout_client_ptr;
-extern std::ostream *derr_client_ptr;
-extern std::ostream *dout_server_ptr;
-extern std::ostream *derr_server_ptr;
-
-#define dout_con (*dout_con_ptr)
-#define derr_con (*derr_con_ptr)
-#define dout_client (*dout_client_ptr)
-#define derr_client (*derr_client_ptr)
-#define dout_server (*dout_server_ptr)
-#define derr_server (*derr_server_ptr)
-
-#endif
-
diff --git a/src/mainmenumanager.h b/src/mainmenumanager.h
index b14ca56e5..6f8aa9137 100644
--- a/src/mainmenumanager.h
+++ b/src/mainmenumanager.h
@@ -39,7 +39,7 @@ public:
virtual void signalKeyConfigChange() = 0;
};
-extern gui::IGUIEnvironment* guienv;
+extern gui::IGUIEnvironment *guienv;
extern gui::IGUIStaticText *guiroot;
// Handler for the modal menus
diff --git a/src/map.cpp b/src/map.cpp
index 899c80b27..9fead00c6 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -20,7 +20,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "map.h"
#include "mapsector.h"
#include "mapblock.h"
-#include "main.h"
#include "filesys.h"
#include "voxel.h"
#include "porting.h"
diff --git a/src/mapblock_mesh.cpp b/src/mapblock_mesh.cpp
index d1637891a..ab4b63f86 100644
--- a/src/mapblock_mesh.cpp
+++ b/src/mapblock_mesh.cpp
@@ -21,7 +21,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "light.h"
#include "mapblock.h"
#include "map.h"
-#include "main.h" // for g_profiler
#include "profiler.h"
#include "nodedef.h"
#include "gamedef.h"
diff --git a/src/mapgen.cpp b/src/mapgen.cpp
index fcde5bdb8..66937fb53 100644
--- a/src/mapgen.cpp
+++ b/src/mapgen.cpp
@@ -31,8 +31,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "content_mapnode.h" // For content_mapnode_get_new_name
#include "voxelalgorithms.h"
#include "profiler.h"
-#include "settings.h" // For g_settings
-#include "main.h" // For g_profiler
+#include "settings.h"
#include "treegen.h"
#include "serialization.h"
#include "util/serialize.h"
diff --git a/src/mapgen_v5.cpp b/src/mapgen_v5.cpp
index 7d74c80bd..59578eb49 100644
--- a/src/mapgen_v5.cpp
+++ b/src/mapgen_v5.cpp
@@ -29,7 +29,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "voxelalgorithms.h"
#include "profiler.h"
#include "settings.h" // For g_settings
-#include "main.h" // For g_profiler
#include "emerge.h"
#include "dungeongen.h"
#include "cavegen.h"
diff --git a/src/mapgen_v6.cpp b/src/mapgen_v6.cpp
index 8885c71e5..612ea82b4 100644
--- a/src/mapgen_v6.cpp
+++ b/src/mapgen_v6.cpp
@@ -30,7 +30,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "voxelalgorithms.h"
#include "profiler.h"
#include "settings.h" // For g_settings
-#include "main.h" // For g_profiler
#include "emerge.h"
#include "dungeongen.h"
#include "cavegen.h"
diff --git a/src/mapgen_v7.cpp b/src/mapgen_v7.cpp
index 3e7188a2c..f370a0fdb 100644
--- a/src/mapgen_v7.cpp
+++ b/src/mapgen_v7.cpp
@@ -29,7 +29,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "voxelalgorithms.h"
#include "profiler.h"
#include "settings.h" // For g_settings
-#include "main.h" // For g_profiler
#include "emerge.h"
#include "dungeongen.h"
#include "cavegen.h"
diff --git a/src/mapnode.cpp b/src/mapnode.cpp
index 0335755e9..4afa91983 100644
--- a/src/mapnode.cpp
+++ b/src/mapnode.cpp
@@ -20,7 +20,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "irrlichttypes_extrabloated.h"
#include "mapnode.h"
#include "porting.h"
-#include "main.h" // For g_settings
#include "nodedef.h"
#include "content_mapnode.h" // For mapnode_translate_*_internal
#include "serialization.h" // For ser_ver_supported
diff --git a/src/mg_biome.cpp b/src/mg_biome.cpp
index a8b150e53..75334544a 100644
--- a/src/mg_biome.cpp
+++ b/src/mg_biome.cpp
@@ -23,7 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "map.h" //for MMVManip
#include "log.h"
#include "util/numeric.h"
-#include "main.h"
#include "util/mathconstants.h"
#include "porting.h"
diff --git a/src/mods.cpp b/src/mods.cpp
index cb5a6b9fd..a81dd4604 100644
--- a/src/mods.cpp
+++ b/src/mods.cpp
@@ -17,15 +17,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include <cctype>
+#include <fstream>
#include "mods.h"
-#include "main.h"
#include "filesys.h"
#include "strfnd.h"
#include "log.h"
#include "subgame.h"
#include "settings.h"
#include "strfnd.h"
-#include <cctype>
#include "convert_json.h"
static bool parseDependsLine(std::istream &is,
diff --git a/src/network/connection.cpp b/src/network/connection.cpp
index dd69df5bb..6e8bbd6c3 100644
--- a/src/network/connection.cpp
+++ b/src/network/connection.cpp
@@ -20,7 +20,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <iomanip>
#include <errno.h>
#include "connection.h"
-#include "main.h"
#include "serialization.h"
#include "log.h"
#include "porting.h"
diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp
index e01aeaa55..30b378ac3 100644
--- a/src/network/serverpackethandler.cpp
+++ b/src/network/serverpackethandler.cpp
@@ -23,7 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "content_abm.h"
#include "content_sao.h"
#include "emerge.h"
-#include "main.h"
#include "nodedef.h"
#include "player.h"
#include "rollback_interface.h"
diff --git a/src/nodedef.cpp b/src/nodedef.cpp
index ce087f6b8..486a99350 100644
--- a/src/nodedef.cpp
+++ b/src/nodedef.cpp
@@ -19,7 +19,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "nodedef.h"
-#include "main.h" // For g_settings
#include "itemdef.h"
#ifndef SERVER
#include "client/tile.h"
diff --git a/src/particles.cpp b/src/particles.cpp
index e9268be27..b13e904b0 100644
--- a/src/particles.cpp
+++ b/src/particles.cpp
@@ -20,7 +20,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "particles.h"
#include "constants.h"
#include "debug.h"
-#include "main.h" // For g_profiler and g_settings
#include "settings.h"
#include "client/tile.h"
#include "gamedef.h"
diff --git a/src/porting.cpp b/src/porting.cpp
index 797a2cf39..86d5bf5da 100644
--- a/src/porting.cpp
+++ b/src/porting.cpp
@@ -51,7 +51,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "filesys.h"
#include "log.h"
#include "util/string.h"
-#include "main.h"
#include "settings.h"
#include <list>
diff --git a/src/profiler.cpp b/src/profiler.cpp
new file mode 100644
index 000000000..197e094f6
--- /dev/null
+++ b/src/profiler.cpp
@@ -0,0 +1,23 @@
+/*
+Minetest
+Copyright (C) 2015 celeron55, Perttu Ahola <celeron55@gmail.com>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
+#include "profiler.h"
+
+static Profiler main_profiler;
+Profiler *g_profiler = &main_profiler;
diff --git a/src/profiler.h b/src/profiler.h
index e5bb760c6..78d3b08e0 100644
--- a/src/profiler.h
+++ b/src/profiler.h
@@ -27,11 +27,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "jthread/jmutex.h"
#include "jthread/jmutexautolock.h"
#include "util/timetaker.h"
-#include "util/numeric.h" // paging()
-#include "debug.h" // assert()
+#include "util/numeric.h" // paging()
+#include "debug.h" // assert()
#define MAX_PROFILER_TEXT_ROWS 20
+// Global profiler
+class Profiler;
+extern Profiler *g_profiler;
+
/*
Time profiler
*/
diff --git a/src/script/common/c_internal.cpp b/src/script/common/c_internal.cpp
index 61248534c..fcab98dc6 100644
--- a/src/script/common/c_internal.cpp
+++ b/src/script/common/c_internal.cpp
@@ -20,7 +20,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "common/c_internal.h"
#include "debug.h"
#include "log.h"
-#include "main.h"
#include "settings.h"
std::string script_get_backtrace(lua_State *L)
diff --git a/src/script/lua_api/l_internal.h b/src/script/lua_api/l_internal.h
index 5936ac046..e8a029b86 100644
--- a/src/script/lua_api/l_internal.h
+++ b/src/script/lua_api/l_internal.h
@@ -36,7 +36,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#if (defined(WIN32) || defined(_WIN32_WCE))
#define NO_MAP_LOCK_REQUIRED
#else
-#include "main.h"
#include "profiler.h"
#define NO_MAP_LOCK_REQUIRED \
ScopeProfiler nolocktime(g_profiler,"Scriptapi: unlockable time",SPT_ADD)
diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp
index 2ad6ba360..b068040db 100644
--- a/src/script/lua_api/l_mainmenu.cpp
+++ b/src/script/lua_api/l_mainmenu.cpp
@@ -34,7 +34,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "emerge.h"
#include "sound.h"
#include "settings.h"
-#include "main.h" // for g_settings
#include "log.h"
#include "EDriverTypes.h"
diff --git a/src/script/lua_api/l_mapgen.cpp b/src/script/lua_api/l_mapgen.cpp
index ed0eaaaac..cbe3610c8 100644
--- a/src/script/lua_api/l_mapgen.cpp
+++ b/src/script/lua_api/l_mapgen.cpp
@@ -33,7 +33,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "mapgen_v5.h"
#include "mapgen_v7.h"
#include "settings.h"
-#include "main.h"
#include "log.h"
diff --git a/src/script/lua_api/l_util.cpp b/src/script/lua_api/l_util.cpp
index eb6c1835d..79a5b252a 100644
--- a/src/script/lua_api/l_util.cpp
+++ b/src/script/lua_api/l_util.cpp
@@ -30,7 +30,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "tool.h"
#include "filesys.h"
#include "settings.h"
-#include "main.h" //required for g_settings, g_settings_path
// debug(...)
// Writes a line to dstream
diff --git a/src/server.cpp b/src/server.cpp
index 144d933b1..a57d1f1aa 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -27,7 +27,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "environment.h"
#include "map.h"
#include "jthread/jmutexautolock.h"
-#include "main.h"
#include "constants.h"
#include "voxel.h"
#include "config.h"
diff --git a/src/serverlist.cpp b/src/serverlist.cpp
index 978175a2a..a33d1d6bf 100644
--- a/src/serverlist.cpp
+++ b/src/serverlist.cpp
@@ -17,12 +17,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include <fstream>
#include <iostream>
#include <sstream>
#include <algorithm>
#include "version.h"
-#include "main.h" // for g_settings
#include "settings.h"
#include "serverlist.h"
#include "filesys.h"
diff --git a/src/settings.cpp b/src/settings.cpp
index c1d70714f..9adcd1587 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -33,6 +33,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <cctype>
#include <algorithm>
+static Settings main_settings;
+Settings *g_settings = &main_settings;
+std::string g_settings_path;
Settings::~Settings()
{
diff --git a/src/settings.h b/src/settings.h
index 48708f6cc..d43ad6a20 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -31,6 +31,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
class Settings;
struct NoiseParams;
+// Global objects
+extern Settings *g_settings;
+extern std::string g_settings_path;
+
/** function type to register a changed callback */
typedef void (*setting_changed_callback)(const std::string, void*);
diff --git a/src/shader.cpp b/src/shader.cpp
index 8a5fd417b..ea2de3f1e 100644
--- a/src/shader.cpp
+++ b/src/shader.cpp
@@ -18,15 +18,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include <fstream>
+#include <iterator>
#include "shader.h"
#include "irrlichttypes_extrabloated.h"
#include "debug.h"
-#include "main.h" // for g_settings
#include "filesys.h"
#include "util/container.h"
#include "util/thread.h"
#include "settings.h"
-#include <iterator>
#include <ICameraSceneNode.h>
#include <IGPUProgrammingServices.h>
#include <IMaterialRenderer.h>
diff --git a/src/sky.cpp b/src/sky.cpp
index e40602914..01fb8ef86 100644
--- a/src/sky.cpp
+++ b/src/sky.cpp
@@ -4,13 +4,12 @@
#include "ICameraSceneNode.h"
#include "S3DVertex.h"
#include "client/tile.h"
-#include "noise.h" // easeCurve
-#include "main.h" // g_profiler
+#include "noise.h" // easeCurve
#include "profiler.h"
-#include "util/numeric.h" // MYMIN
+#include "util/numeric.h"
#include <cmath>
#include "settings.h"
-#include "camera.h" // CameraModes
+#include "camera.h" // CameraModes
//! constructor
Sky::Sky(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id,
diff --git a/src/socket.cpp b/src/socket.cpp
index df9c57c5f..c3b5fc564 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -32,7 +32,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "debug.h"
#include "settings.h"
#include "log.h"
-#include "main.h" // for g_settings
#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
diff --git a/src/subgame.cpp b/src/subgame.cpp
index 864732876..f736a78c6 100644
--- a/src/subgame.cpp
+++ b/src/subgame.cpp
@@ -21,16 +21,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "porting.h"
#include "filesys.h"
#include "settings.h"
-#include "main.h"
#include "log.h"
#include "strfnd.h"
#include "defaultsettings.h" // for override_default_settings
#include "mapgen.h" // for MapgenParams
-#include "main.h" // for g_settings
+#include "util/string.h"
+
#ifndef SERVER
-#include "client/tile.h" // getImagePath
+ #include "client/tile.h" // getImagePath
#endif
-#include "util/string.h"
bool getGameMinetestConfig(const std::string &game_path, Settings &conf)
{
diff --git a/src/test.cpp b/src/test.cpp
index 258093278..402bae95c 100644
--- a/src/test.cpp
+++ b/src/test.cpp
@@ -22,7 +22,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "debug.h"
#include "map.h"
#include "player.h"
-#include "main.h"
#include "socket.h"
#include "network/connection.h"
#include "serialization.h"
diff --git a/src/wieldmesh.cpp b/src/wieldmesh.cpp
index 23310ef27..b1d82b706 100644
--- a/src/wieldmesh.cpp
+++ b/src/wieldmesh.cpp
@@ -17,7 +17,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include "main.h"
#include "settings.h"
#include "wieldmesh.h"
#include "inventory.h"