summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-06-13 18:40:11 +0300
committerAndrei Karas <akaras@inbox.ru>2016-06-13 18:40:11 +0300
commit55b1de961489f99723288e162f9d3a062d593368 (patch)
tree8e0420837f222828070fd7df010ede11c2ec90ed /src
parentbcbcdde49b5ff85c5ff4b8356dad475698d28f4e (diff)
downloadmv-55b1de961489f99723288e162f9d3a062d593368.tar.gz
mv-55b1de961489f99723288e162f9d3a062d593368.tar.bz2
mv-55b1de961489f99723288e162f9d3a062d593368.tar.xz
mv-55b1de961489f99723288e162f9d3a062d593368.zip
Fix includes and update deheader ci script.
Diffstat (limited to 'src')
-rw-r--r--src/actions/actiondef.h3
-rw-r--r--src/actions/actions.cpp1
-rw-r--r--src/being/compoundsprite.cpp4
-rw-r--r--src/client.cpp7
-rw-r--r--src/client.h6
-rw-r--r--src/configuration.h1
-rw-r--r--src/dragdrop.h2
-rw-r--r--src/dyetool/client.cpp7
-rw-r--r--src/dyetool/client.h6
-rw-r--r--src/graphicsmanager.cpp2
-rw-r--r--src/graphicsmanager.h2
-rw-r--r--src/gui/models/updatelistmodel.h2
-rw-r--r--src/gui/palette.h6
-rw-r--r--src/gui/widgets/browserbox.cpp1
-rw-r--r--src/gui/widgets/desktop.cpp1
-rw-r--r--src/gui/widgets/tabs/setup_video.cpp7
-rw-r--r--src/gui/widgets/tabs/socialpartytab.h1
-rw-r--r--src/gui/widgets/tabs/socialtabbase.h4
-rw-r--r--src/gui/windowmanager.cpp1
-rw-r--r--src/gui/windows/serverdialog.cpp1
-rw-r--r--src/gui/windows/setupwindow.cpp1
-rw-r--r--src/gui/windows/updaterwindow.cpp1
-rw-r--r--src/gui/windows/whoisonline.cpp1
-rw-r--r--src/input/inputfunction.h2
-rw-r--r--src/input/keyboardconfig.h1
-rw-r--r--src/localconsts.h2
-rw-r--r--src/logger.cpp6
-rw-r--r--src/logger.h3
-rw-r--r--src/main.h2
-rw-r--r--src/net/bankhandler.h2
-rw-r--r--src/net/cashshophandler.h1
-rw-r--r--src/net/download.cpp1
-rw-r--r--src/net/ea/playerhandler.h2
-rw-r--r--src/net/ea/playerrecv.h2
-rw-r--r--src/net/eathena/protocolout.h2
-rw-r--r--src/net/eathena/updateprotocol.cpp2
-rw-r--r--src/net/elementalhandler.h2
-rw-r--r--src/net/familyhandler.h2
-rw-r--r--src/net/maphandler.h2
-rw-r--r--src/net/markethandler.h1
-rw-r--r--src/net/roulettehandler.h2
-rw-r--r--src/net/sdltcpnet.h1
-rw-r--r--src/net/searchstorehandler.h2
-rw-r--r--src/net/tmwa/protocolout.h2
-rw-r--r--src/net/tmwa/updateprotocol.cpp3
-rw-r--r--src/render/graphics.h1
-rw-r--r--src/render/imagegraphics.cpp2
-rw-r--r--src/render/mobileopengl2graphics.cpp2
-rw-r--r--src/render/mobileopengl2graphics.h1
-rw-r--r--src/render/mobileopenglgraphics.cpp2
-rw-r--r--src/render/mobileopenglgraphics.h1
-rw-r--r--src/render/modernopenglgraphics.cpp1
-rw-r--r--src/render/modernopenglgraphics.h1
-rw-r--r--src/render/normalopenglgraphics.cpp4
-rw-r--r--src/render/normalopenglgraphics.h1
-rw-r--r--src/render/nullopenglgraphics.cpp2
-rw-r--r--src/render/nullopenglgraphics.h1
-rw-r--r--src/render/opengl/mgl.cpp6
-rw-r--r--src/render/opengl/mgl.h5
-rw-r--r--src/render/opengl/mgl.hpp2
-rw-r--r--src/render/opengl/mglcheck.h1
-rw-r--r--src/render/opengl/mglfunctions.h2
-rw-r--r--src/render/opengl/mgltypes.h7
-rw-r--r--src/render/opengl/opengldebug.h2
-rw-r--r--src/render/openglx/mglx.cpp6
-rw-r--r--src/render/openglx/mglx.h4
-rw-r--r--src/render/openglx/mglx.hpp2
-rw-r--r--src/render/openglx/mglxinit.cpp4
-rw-r--r--src/render/openglx/mglxinit.h1
-rw-r--r--src/render/openglx/mglxtypes.h10
-rw-r--r--src/render/safeopenglgraphics.cpp2
-rw-r--r--src/render/sdlgraphics.cpp2
-rw-r--r--src/render/vertexes/imagecollection.h2
-rw-r--r--src/render/vertexes/openglgraphicsvertexes.h2
-rw-r--r--src/resources/atlas/atlasitem.h2
-rw-r--r--src/resources/atlas/atlasmanager.cpp4
-rw-r--r--src/resources/atlas/atlasmanager.h2
-rw-r--r--src/resources/atlas/atlasresource.cpp1
-rw-r--r--src/resources/atlas/textureatlas.h5
-rw-r--r--src/resources/beingcommon.h2
-rw-r--r--src/resources/fboinfo.h2
-rw-r--r--src/resources/mapreader.cpp1
-rw-r--r--src/resources/mobileopenglscreenshothelper.cpp2
-rw-r--r--src/resources/openglimagehelper.cpp1
-rw-r--r--src/resources/openglimagehelper.h1
-rw-r--r--src/resources/openglscreenshothelper.cpp1
-rw-r--r--src/resources/resourcemanager/resourcemanager.cpp6
-rw-r--r--src/resources/safeopenglimagehelper.cpp1
-rw-r--r--src/resources/safeopenglimagehelper.h1
-rw-r--r--src/resources/screenshothelper.h1
-rw-r--r--src/resources/sdlimagehelper.cpp1
-rw-r--r--src/resources/surfaceimagehelper.h1
-rw-r--r--src/soundmanager.h1
-rw-r--r--src/test/testlauncher.cpp3
-rw-r--r--src/test/testmain.cpp3
-rw-r--r--src/utils/booleanoptions.h2
-rw-r--r--src/utils/cpu.cpp5
-rw-r--r--src/utils/glxhelper.cpp4
-rw-r--r--src/utils/glxhelper.h2
-rw-r--r--src/utils/physfsrwops.h1
-rw-r--r--src/utils/sdlhelper.cpp1
-rw-r--r--src/utils/sdlhelper.h2
-rw-r--r--src/utils/xml.h2
-rw-r--r--src/utils/xml/libxml.h3
-rw-r--r--src/utils/xml/libxml.inc4
-rw-r--r--src/utils/xml/pugixml.h2
106 files changed, 107 insertions, 155 deletions
diff --git a/src/actions/actiondef.h b/src/actions/actiondef.h
index 10388b1dc..02dc6ab05 100644
--- a/src/actions/actiondef.h
+++ b/src/actions/actiondef.h
@@ -23,8 +23,11 @@
#include "gamemodifiers.h"
#include "settings.h"
+GAMEMODIFIERS_H
+SETTINGS_H
#include "input/inputmanager.h"
+INPUT_INPUTMANAGER_H
#define impHandler(name) bool name(InputEvent &event)
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp
index 8fddb015d..1bb65fbed 100644
--- a/src/actions/actions.cpp
+++ b/src/actions/actions.cpp
@@ -26,6 +26,7 @@
#ifdef USE_OPENGL
#include "graphicsmanager.h"
#endif
+#include "main.h"
#include "spellmanager.h"
#include "actions/actiondef.h"
diff --git a/src/being/compoundsprite.cpp b/src/being/compoundsprite.cpp
index 5f90c978a..7f0066fd8 100644
--- a/src/being/compoundsprite.cpp
+++ b/src/being/compoundsprite.cpp
@@ -23,10 +23,6 @@
#include "configuration.h"
-#ifdef USE_OPENGL
-#include "main.h"
-#endif // USE_OPENGL
-
#include "sdlshared.h"
#include "being/compounditem.h"
diff --git a/src/client.cpp b/src/client.cpp
index 4f7accd36..74fb70429 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -28,6 +28,7 @@
#include "eventsmanager.h"
#include "game.h"
#include "graphicsmanager.h"
+#include "main.h"
#include "party.h"
#include "settings.h"
#include "soundmanager.h"
@@ -172,6 +173,12 @@
#include "mumblemanager.h"
#endif
+#ifdef USE_SDL2
+#include <SDL2_framerate.h>
+#else
+#include <SDL_framerate.h>
+#endif
+
#include "debug.h"
std::string errorMessage;
diff --git a/src/client.h b/src/client.h
index 725cd724c..da08f322a 100644
--- a/src/client.h
+++ b/src/client.h
@@ -35,12 +35,6 @@
#include "net/serverinfo.h"
-#ifdef USE_SDL2
-#include <SDL2_framerate.h>
-#else
-#include <SDL_framerate.h>
-#endif
-
#include "localconsts.h"
class Button;
diff --git a/src/configuration.h b/src/configuration.h
index 1c91ae1b8..5cc0f88d7 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -25,7 +25,6 @@
#include "utils/stringutils.h"
#include "utils/xml.h"
-#include "utils/xmlwriter.h"
#include "defaults.h"
#include "localconsts.h"
diff --git a/src/dragdrop.h b/src/dragdrop.h
index 75d08d15f..4d5a02f68 100644
--- a/src/dragdrop.h
+++ b/src/dragdrop.h
@@ -28,8 +28,6 @@
#include "enums/dragdropsource.h"
-#include "enums/simpletypes/itemcolor.h"
-
#include "gui/widgets/skilldata.h"
#include "gui/widgets/skillinfo.h"
diff --git a/src/dyetool/client.cpp b/src/dyetool/client.cpp
index c9effa88c..b87f34aaa 100644
--- a/src/dyetool/client.cpp
+++ b/src/dyetool/client.cpp
@@ -26,6 +26,7 @@
#include "dirs.h"
#include "eventsmanager.h"
#include "graphicsmanager.h"
+#include "main.h"
#include "settings.h"
#include "soundmanager.h"
@@ -84,6 +85,12 @@
#endif
#endif
+#ifdef USE_SDL2
+#include <SDL2_framerate.h>
+#else
+#include <SDL_framerate.h>
+#endif
+
#include "debug.h"
std::string errorMessage;
diff --git a/src/dyetool/client.h b/src/dyetool/client.h
index 4a79a303e..39afce267 100644
--- a/src/dyetool/client.h
+++ b/src/dyetool/client.h
@@ -27,12 +27,6 @@
#include "listeners/actionlistener.h"
-#ifdef USE_SDL2
-#include <SDL2_framerate.h>
-#else
-#include <SDL_framerate.h>
-#endif
-
#include "localconsts.h"
class Button;
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index 9ce2b6302..4b0bae9a5 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -45,7 +45,6 @@
#include "settings.h"
#ifdef USE_OPENGL
-#include "logger.h"
#include "render/mobileopengl2graphics.h"
#include "render/mobileopenglgraphics.h"
@@ -60,7 +59,6 @@
#include "render/sdlgraphics.h"
#ifdef USE_OPENGL
-#include "resources/fboinfo.h"
#include "resources/openglimagehelper.h"
#include "resources/openglscreenshothelper.h"
#ifndef ANDROID
diff --git a/src/graphicsmanager.h b/src/graphicsmanager.h
index 3651bcc77..1e7675135 100644
--- a/src/graphicsmanager.h
+++ b/src/graphicsmanager.h
@@ -21,8 +21,6 @@
#ifndef GRAPHICSMANAGER_H
#define GRAPHICSMANAGER_H
-#include "main.h"
-
#ifdef USE_OPENGL
#ifdef ANDROID
diff --git a/src/gui/models/updatelistmodel.h b/src/gui/models/updatelistmodel.h
index e2424cb7b..a79a9b842 100644
--- a/src/gui/models/updatelistmodel.h
+++ b/src/gui/models/updatelistmodel.h
@@ -27,8 +27,6 @@
#include "net/serverinfo.h"
-#include "utils/stringvector.h"
-
#include "localconsts.h"
class UpdateListModel final : public ListModel
diff --git a/src/gui/palette.h b/src/gui/palette.h
index ebcc2936f..66dba9905 100644
--- a/src/gui/palette.h
+++ b/src/gui/palette.h
@@ -28,12 +28,6 @@
#include "gui/color.h"
-#if defined __native_client__
-#include <stdlib.h>
-#else
-#include <cstdlib>
-#endif
-
#include <map>
#include <set>
#include <string>
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index 5edc9384e..a6d83f4d5 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -24,6 +24,7 @@
#include "gui/widgets/browserbox.h"
#include "itemcolormanager.h"
+#include "main.h"
#include "settings.h"
#include "const/resources/item/cards.h"
diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp
index d1a7822a1..253dd58ab 100644
--- a/src/gui/widgets/desktop.cpp
+++ b/src/gui/widgets/desktop.cpp
@@ -22,6 +22,7 @@
#include "gui/widgets/desktop.h"
#include "configuration.h"
+#include "main.h"
#include "gui/skin.h"
diff --git a/src/gui/widgets/tabs/setup_video.cpp b/src/gui/widgets/tabs/setup_video.cpp
index 63d956cf2..a6abf6b3b 100644
--- a/src/gui/widgets/tabs/setup_video.cpp
+++ b/src/gui/widgets/tabs/setup_video.cpp
@@ -46,14 +46,11 @@
#include "test/testmain.h"
#endif // defined(USE_OPENGL) && !defined(ANDROID) && !defined(__APPLE__)
-
-#ifndef USE_OPENGL
-#include "render/renderers.h"
-#endif
-
#if defined(ANDROID) || defined(__APPLE__) || !defined(USE_OPENGL)
#include "configuration.h"
+#endif
+#if defined(ANDROID) || defined(__APPLE__)
#include "utils/stringutils.h"
#endif
diff --git a/src/gui/widgets/tabs/socialpartytab.h b/src/gui/widgets/tabs/socialpartytab.h
index 79e7b93d5..d38328728 100644
--- a/src/gui/widgets/tabs/socialpartytab.h
+++ b/src/gui/widgets/tabs/socialpartytab.h
@@ -28,7 +28,6 @@
#include "being/localplayer.h"
-#include "net/net.h"
#include "net/partyhandler.h"
#include "utils/delete2.h"
diff --git a/src/gui/widgets/tabs/socialtabbase.h b/src/gui/widgets/tabs/socialtabbase.h
index 81b4f8172..cc99dc4b9 100644
--- a/src/gui/widgets/tabs/socialtabbase.h
+++ b/src/gui/widgets/tabs/socialtabbase.h
@@ -23,8 +23,12 @@
#include "actormanager.h"
+ACTORMANAGER_H
+
#include "enums/resources/map/mapitemtype.h"
+ENUMS_RESOURCES_MAP_MAPITEMTYPE_H
+
#define addAvatars(mob, str, type) \
{\
ava = new Avatar(str);\
diff --git a/src/gui/windowmanager.cpp b/src/gui/windowmanager.cpp
index 9176c448a..8da30d648 100644
--- a/src/gui/windowmanager.cpp
+++ b/src/gui/windowmanager.cpp
@@ -25,6 +25,7 @@
#include "client.h"
#include "configuration.h"
#include "game.h"
+#include "main.h"
#include "settings.h"
#include "spellmanager.h"
diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp
index 93512e053..ea6511e37 100644
--- a/src/gui/windows/serverdialog.cpp
+++ b/src/gui/windows/serverdialog.cpp
@@ -25,6 +25,7 @@
#include "chatlogger.h"
#include "client.h"
#include "configuration.h"
+#include "main.h"
#include "settings.h"
#include "net/download.h"
diff --git a/src/gui/windows/setupwindow.cpp b/src/gui/windows/setupwindow.cpp
index 19c1e6c52..17211c1cd 100644
--- a/src/gui/windows/setupwindow.cpp
+++ b/src/gui/windows/setupwindow.cpp
@@ -24,6 +24,7 @@
#include "configuration.h"
#include "game.h"
+#include "main.h"
#include "gui/windows/chatwindow.h"
#include "gui/windows/statuswindow.h"
diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp
index 3d7e23fb3..8dd88f9c6 100644
--- a/src/gui/windows/updaterwindow.cpp
+++ b/src/gui/windows/updaterwindow.cpp
@@ -24,6 +24,7 @@
#include "client.h"
#include "configuration.h"
+#include "main.h"
#include "settings.h"
#include "gui/widgets/browserbox.h"
diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp
index 0bc7e3703..c644dc149 100644
--- a/src/gui/windows/whoisonline.cpp
+++ b/src/gui/windows/whoisonline.cpp
@@ -25,6 +25,7 @@
#include "actormanager.h"
#include "configuration.h"
#include "guild.h"
+#include "main.h"
#include "party.h"
#ifdef TMWA_SUPPORT
#include "settings.h"
diff --git a/src/input/inputfunction.h b/src/input/inputfunction.h
index 1907afdc3..1a785d098 100644
--- a/src/input/inputfunction.h
+++ b/src/input/inputfunction.h
@@ -23,8 +23,6 @@
#include "input/inputitem.h"
-#include <string>
-
#include "localconsts.h"
const size_t inputFunctionSize = 3U;
diff --git a/src/input/keyboardconfig.h b/src/input/keyboardconfig.h
index 6bd66f69f..6d7830ee7 100644
--- a/src/input/keyboardconfig.h
+++ b/src/input/keyboardconfig.h
@@ -28,6 +28,7 @@
#pragma GCC diagnostic ignored "-Wswitch-default"
#endif
#include <SDL_stdinc.h>
+_SDL_stdinc_h
#ifdef USE_SDL2
#pragma GCC diagnostic pop
#endif
diff --git a/src/localconsts.h b/src/localconsts.h
index 9033a854d..af97ff723 100644
--- a/src/localconsts.h
+++ b/src/localconsts.h
@@ -18,6 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#define ENABLEDEBUGLOG 1
+
#define CAST_8 static_cast<char>
#define CAST_S8 static_cast<int8_t>
#define CAST_U8 static_cast<uint8_t>
diff --git a/src/logger.cpp b/src/logger.cpp
index 97a3d7495..b0474c243 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -40,6 +40,7 @@
#include <sstream>
+#ifdef ENABLEDEBUGLOG
#if defined(__ANDROID__)
#include <android/log.h>
#ifdef SPECIAL_LOGGING
@@ -62,10 +63,11 @@
#define DSPECIALLOG(x) if (mDebugLog) \
std::cerr << x;
#endif // SPECIAL_LOGGING
-#else
+#else // defined(__ANDROID__)
#define SPECIALLOG(x)
#define DSPECIALLOG(x)
-#endif
+#endif // defined(__ANDROID__)
+#endif // ENABLEDEBUGLOG
#include "debug.h"
diff --git a/src/logger.h b/src/logger.h
index 76b073938..8a7bbbd8c 100644
--- a/src/logger.h
+++ b/src/logger.h
@@ -23,13 +23,12 @@
#ifndef LOGGER_H
#define LOGGER_H
-#include "main.h"
-
#ifdef USE_SDL2
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wswitch-default"
#endif
#include <SDL_stdinc.h>
+_SDL_stdinc_h
#ifdef USE_SDL2
#pragma GCC diagnostic pop
#endif
diff --git a/src/main.h b/src/main.h
index 003e69981..e4fce617a 100644
--- a/src/main.h
+++ b/src/main.h
@@ -129,8 +129,6 @@
#define PACKAGE_OS "Other"
#endif
-
-#define ENABLEDEBUGLOG 1
// define DEBUG_LEAKS 1
// define DEBUG_CONFIG 1
// define DEBUG_FONT 1
diff --git a/src/net/bankhandler.h b/src/net/bankhandler.h
index d6abfb5ed..5853e84c9 100644
--- a/src/net/bankhandler.h
+++ b/src/net/bankhandler.h
@@ -23,8 +23,6 @@
#ifdef EATHENA_SUPPORT
-#include <string>
-
#include "localconsts.h"
namespace Net
diff --git a/src/net/cashshophandler.h b/src/net/cashshophandler.h
index 73bd6f399..2c4df7073 100644
--- a/src/net/cashshophandler.h
+++ b/src/net/cashshophandler.h
@@ -25,7 +25,6 @@
#include "enums/simpletypes/itemcolor.h"
-#include <string>
#include <vector>
#include "localconsts.h"
diff --git a/src/net/download.cpp b/src/net/download.cpp
index 91d448899..69acb6895 100644
--- a/src/net/download.cpp
+++ b/src/net/download.cpp
@@ -23,6 +23,7 @@
#include "configuration.h"
#include "logger.h"
+#include "main.h"
#include "settings.h"
#include "utils/files.h"
diff --git a/src/net/ea/playerhandler.h b/src/net/ea/playerhandler.h
index 6b3b85073..2adb35d12 100644
--- a/src/net/ea/playerhandler.h
+++ b/src/net/ea/playerhandler.h
@@ -25,8 +25,6 @@
#include "net/playerhandler.h"
-#include <climits>
-
namespace Ea
{
diff --git a/src/net/ea/playerrecv.h b/src/net/ea/playerrecv.h
index e87a04ff9..f1a369f93 100644
--- a/src/net/ea/playerrecv.h
+++ b/src/net/ea/playerrecv.h
@@ -23,8 +23,6 @@
#ifndef NET_EA_PLAYERRECV_H
#define NET_EA_PLAYERRECV_H
-#include <climits>
-
namespace Net
{
class MessageIn;
diff --git a/src/net/eathena/protocolout.h b/src/net/eathena/protocolout.h
index fa8319c92..a6ca11a78 100644
--- a/src/net/eathena/protocolout.h
+++ b/src/net/eathena/protocolout.h
@@ -28,11 +28,13 @@
namespace EAthena
{
#include "net/eathena/packetsout.inc"
+PACKETSOUT_VOID
} // namespace EAthena
#undef packet
#undef packet2
#undef startCondition
#undef endCondition
+#undef PACKETSOUT_VOID
#endif // NET_EATHENA_PROTOCOLOUT_H
diff --git a/src/net/eathena/updateprotocol.cpp b/src/net/eathena/updateprotocol.cpp
index a23ea51bb..2e7dc8cb9 100644
--- a/src/net/eathena/updateprotocol.cpp
+++ b/src/net/eathena/updateprotocol.cpp
@@ -30,8 +30,6 @@
extern int packetVersion;
extern int serverVersion;
-PACKETSOUT_VOID
-#undef PACKETSOUT_VOID
namespace EAthena
{
diff --git a/src/net/elementalhandler.h b/src/net/elementalhandler.h
index 5c506e4c0..93558830d 100644
--- a/src/net/elementalhandler.h
+++ b/src/net/elementalhandler.h
@@ -23,8 +23,6 @@
#ifdef EATHENA_SUPPORT
-#include <string>
-
#include "localconsts.h"
namespace Net
diff --git a/src/net/familyhandler.h b/src/net/familyhandler.h
index e7e47be3b..32ef030b4 100644
--- a/src/net/familyhandler.h
+++ b/src/net/familyhandler.h
@@ -23,8 +23,6 @@
#ifdef EATHENA_SUPPORT
-#include <string>
-
#include "localconsts.h"
class Being;
diff --git a/src/net/maphandler.h b/src/net/maphandler.h
index 7d7b82949..61d47bf82 100644
--- a/src/net/maphandler.h
+++ b/src/net/maphandler.h
@@ -23,8 +23,6 @@
#ifdef EATHENA_SUPPORT
-#include <string>
-
#include "localconsts.h"
namespace Net
diff --git a/src/net/markethandler.h b/src/net/markethandler.h
index f571237a8..4ebbb6e61 100644
--- a/src/net/markethandler.h
+++ b/src/net/markethandler.h
@@ -27,7 +27,6 @@
#include "enums/simpletypes/itemcolor.h"
-#include <string>
#include <vector>
#include "localconsts.h"
diff --git a/src/net/roulettehandler.h b/src/net/roulettehandler.h
index 4cd43eabb..66bda0b1d 100644
--- a/src/net/roulettehandler.h
+++ b/src/net/roulettehandler.h
@@ -23,8 +23,6 @@
#ifdef EATHENA_SUPPORT
-#include <string>
-
#include "localconsts.h"
namespace Net
diff --git a/src/net/sdltcpnet.h b/src/net/sdltcpnet.h
index 94855485d..37b78e146 100644
--- a/src/net/sdltcpnet.h
+++ b/src/net/sdltcpnet.h
@@ -26,6 +26,7 @@
#pragma GCC diagnostic ignored "-Wswitch-default"
#endif
#include <SDL_stdinc.h>
+_SDL_stdinc_h
#ifdef USE_SDL2
#pragma GCC diagnostic pop
#endif
diff --git a/src/net/searchstorehandler.h b/src/net/searchstorehandler.h
index 5c01f22c2..1b903793d 100644
--- a/src/net/searchstorehandler.h
+++ b/src/net/searchstorehandler.h
@@ -23,8 +23,6 @@
#ifdef EATHENA_SUPPORT
-#include <string>
-
#include "enums/net/storesearchtype.h"
#include "localconsts.h"
diff --git a/src/net/tmwa/protocolout.h b/src/net/tmwa/protocolout.h
index 2686cd9f5..037d70f7b 100644
--- a/src/net/tmwa/protocolout.h
+++ b/src/net/tmwa/protocolout.h
@@ -28,11 +28,13 @@
namespace TmwAthena
{
#include "net/tmwa/packetsout.inc"
+PACKETSOUT_VOID
} // namespace TmwAthena
#undef packet
#undef packet2
#undef startCondition
#undef endCondition
+#undef PACKETSOUT_VOID
#endif // NET_TMWA_PROTOCOLOUT_H
diff --git a/src/net/tmwa/updateprotocol.cpp b/src/net/tmwa/updateprotocol.cpp
index 7d5622acd..b7aeae2d8 100644
--- a/src/net/tmwa/updateprotocol.cpp
+++ b/src/net/tmwa/updateprotocol.cpp
@@ -25,9 +25,6 @@
#include "debug.h"
-PACKETSOUT_VOID
-#undef PACKETSOUT_VOID
-
namespace TmwAthena
{
diff --git a/src/render/graphics.h b/src/render/graphics.h
index dda3363e6..8fb13c804 100644
--- a/src/render/graphics.h
+++ b/src/render/graphics.h
@@ -67,7 +67,6 @@
#define RENDER_GRAPHICS_H
#include "sdlshared.h"
-#include "main.h"
#include "enums/render/rendertype.h"
diff --git a/src/render/imagegraphics.cpp b/src/render/imagegraphics.cpp
index 569adee44..96c44dd7f 100644
--- a/src/render/imagegraphics.cpp
+++ b/src/render/imagegraphics.cpp
@@ -24,8 +24,6 @@
#include "render/imagegraphics.h"
-#include "main.h"
-
#include "debug.h"
ImegeGraphics::ImegeGraphics() :
diff --git a/src/render/mobileopengl2graphics.cpp b/src/render/mobileopengl2graphics.cpp
index 20951d4e4..163185bb6 100644
--- a/src/render/mobileopengl2graphics.cpp
+++ b/src/render/mobileopengl2graphics.cpp
@@ -25,7 +25,6 @@
#include "render/mobileopengl2graphics.h"
#include "graphicsmanager.h"
-#include "logger.h"
#include "render/opengl/mgl.h"
#ifdef __native_client__
@@ -43,7 +42,6 @@
#include "utils/delete2.h"
#include "utils/sdlcheckutils.h"
-#include "utils/sdlhelper.h"
#include "debug.h"
diff --git a/src/render/mobileopengl2graphics.h b/src/render/mobileopengl2graphics.h
index d1b5b96a5..51a5d57ca 100644
--- a/src/render/mobileopengl2graphics.h
+++ b/src/render/mobileopengl2graphics.h
@@ -26,6 +26,7 @@
#if defined USE_OPENGL && !defined ANDROID
#include "localconsts.h"
+
#include "render/graphics.h"
#include "resources/fboinfo.h"
diff --git a/src/render/mobileopenglgraphics.cpp b/src/render/mobileopenglgraphics.cpp
index dac566822..64f01b8b3 100644
--- a/src/render/mobileopenglgraphics.cpp
+++ b/src/render/mobileopenglgraphics.cpp
@@ -24,8 +24,6 @@
#include "render/mobileopenglgraphics.h"
-#include "logger.h"
-
#include "render/opengl/mgl.h"
#ifdef __native_client__
#include "render/opengl/naclglfunctions.h"
diff --git a/src/render/mobileopenglgraphics.h b/src/render/mobileopenglgraphics.h
index 7f14fc6f8..8a9341208 100644
--- a/src/render/mobileopenglgraphics.h
+++ b/src/render/mobileopenglgraphics.h
@@ -26,6 +26,7 @@
#if defined(USE_OPENGL) && !defined(__native_client__)
#include "localconsts.h"
+
#include "render/graphics.h"
#include "resources/fboinfo.h"
diff --git a/src/render/modernopenglgraphics.cpp b/src/render/modernopenglgraphics.cpp
index 6eb98601a..458a9a9f7 100644
--- a/src/render/modernopenglgraphics.cpp
+++ b/src/render/modernopenglgraphics.cpp
@@ -25,7 +25,6 @@
#include "render/modernopenglgraphics.h"
#include "graphicsmanager.h"
-#include "logger.h"
#include "render/opengl/mgl.h"
#ifdef __native_client__
diff --git a/src/render/modernopenglgraphics.h b/src/render/modernopenglgraphics.h
index 2776cc1fb..430f90249 100644
--- a/src/render/modernopenglgraphics.h
+++ b/src/render/modernopenglgraphics.h
@@ -26,6 +26,7 @@
#if defined(USE_OPENGL) && !defined(ANDROID) && !defined(__native_client__)
#include "localconsts.h"
+
#include "render/graphics.h"
#include "resources/fboinfo.h"
diff --git a/src/render/normalopenglgraphics.cpp b/src/render/normalopenglgraphics.cpp
index 22aef9cda..3a2bfde49 100644
--- a/src/render/normalopenglgraphics.cpp
+++ b/src/render/normalopenglgraphics.cpp
@@ -24,9 +24,9 @@
#include "render/normalopenglgraphics.h"
-#include "logger.h"
-
+#ifdef DEBUG_OPENGL
#include "render/opengl/mgl.h"
+#endif // DEBUG_OPENGL
#include "render/vertexes/imagecollection.h"
diff --git a/src/render/normalopenglgraphics.h b/src/render/normalopenglgraphics.h
index 3c2e0baf9..4bd02de51 100644
--- a/src/render/normalopenglgraphics.h
+++ b/src/render/normalopenglgraphics.h
@@ -26,6 +26,7 @@
#if defined USE_OPENGL && !defined ANDROID && !defined(__native_client__)
#include "localconsts.h"
+
#include "render/graphics.h"
#include "resources/fboinfo.h"
diff --git a/src/render/nullopenglgraphics.cpp b/src/render/nullopenglgraphics.cpp
index 6d4795e94..ad37f70f7 100644
--- a/src/render/nullopenglgraphics.cpp
+++ b/src/render/nullopenglgraphics.cpp
@@ -24,8 +24,6 @@
#include "render/nullopenglgraphics.h"
-#include "graphicsmanager.h"
-
#ifdef DEBUG_BIND_TEXTURE
#include "logger.h"
#endif
diff --git a/src/render/nullopenglgraphics.h b/src/render/nullopenglgraphics.h
index 9d5229674..20b0e1a16 100644
--- a/src/render/nullopenglgraphics.h
+++ b/src/render/nullopenglgraphics.h
@@ -26,6 +26,7 @@
#if defined USE_OPENGL
#include "localconsts.h"
+
#include "render/graphics.h"
#include "resources/fboinfo.h"
diff --git a/src/render/opengl/mgl.cpp b/src/render/opengl/mgl.cpp
index d65ac3ec6..cdcd5808b 100644
--- a/src/render/opengl/mgl.cpp
+++ b/src/render/opengl/mgl.cpp
@@ -18,10 +18,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "render/opengl/mgl.h"
-
#ifdef USE_OPENGL
+#include "render/opengl/mgl.h"
+
#include "debug.h"
#define defName(name) name##_t m##name = nullptr
@@ -29,4 +29,6 @@
// include function defines
#include "render/opengl/mgl.hpp"
+MGL_DEFINE
+
#endif
diff --git a/src/render/opengl/mgl.h b/src/render/opengl/mgl.h
index 07c5b7cf7..9c67687c8 100644
--- a/src/render/opengl/mgl.h
+++ b/src/render/opengl/mgl.h
@@ -21,8 +21,6 @@
#ifndef RENDER_OPENGL_MGL_H
#define RENDER_OPENGL_MGL_H
-#include "main.h"
-
#ifdef USE_OPENGL
#include "render/opengl/mgltypes.h"
@@ -32,7 +30,10 @@
#include "render/opengl/mgl.hpp"
+MGL_DEFINE
+
#undef defName
+#undef MGL_DEFINE
#endif // USE_OPENGL
#endif // RENDER_OPENGL_MGL_H
diff --git a/src/render/opengl/mgl.hpp b/src/render/opengl/mgl.hpp
index 7bc2fa5e8..b6b6a8508 100644
--- a/src/render/opengl/mgl.hpp
+++ b/src/render/opengl/mgl.hpp
@@ -18,6 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#define MGL_DEFINE
+
defName(glGenRenderbuffers);
defName(glBindRenderbuffer);
defName(glRenderbufferStorage);
diff --git a/src/render/opengl/mglcheck.h b/src/render/opengl/mglcheck.h
index b98eed846..478ea25ba 100644
--- a/src/render/opengl/mglcheck.h
+++ b/src/render/opengl/mglcheck.h
@@ -21,7 +21,6 @@
#ifndef RENDER_OPENGL_MGLCHECK_H
#define RENDER_OPENGL_MGLCHECK_H
-#include "main.h"
#ifdef USE_OPENGL
#define isGLNull(func) (!(func))
diff --git a/src/render/opengl/mglfunctions.h b/src/render/opengl/mglfunctions.h
index db0f3bc95..de445c06b 100644
--- a/src/render/opengl/mglfunctions.h
+++ b/src/render/opengl/mglfunctions.h
@@ -25,6 +25,8 @@
#include "logger.h"
+LOGGER_H
+
#ifdef WIN32
#define getFunction(name) wglGetProcAddress(name)
#elif defined ANDROID
diff --git a/src/render/opengl/mgltypes.h b/src/render/opengl/mgltypes.h
index 2d02979d4..2e85a5719 100644
--- a/src/render/opengl/mgltypes.h
+++ b/src/render/opengl/mgltypes.h
@@ -21,11 +21,8 @@
#ifndef RENDER_OPENGL_MGLTYPES_H
#define RENDER_OPENGL_MGLTYPES_H
-#include "main.h"
-
#ifdef USE_OPENGL
-
#ifdef ANDROID
#include <GLES/gl.h>
#include <GLES/glext.h>
@@ -42,11 +39,15 @@
#include <OpenGL/glext.h>
#else // defined(__APPLE__)
#include <GL/glext.h>
+#ifndef __glext_h_
+#error missing include <GL/glext.h>
+#endif // __glext_h_
#endif // defined(__APPLE__)
#endif
#endif
#include "render/opengl/mgldefines.h"
+RENDER_OPENGL_MGLDEFINES_H
#if defined(__GXX_EXPERIMENTAL_CXX0X__)
#include <cstdint>
diff --git a/src/render/opengl/opengldebug.h b/src/render/opengl/opengldebug.h
index 6ff7da0a8..8d2f19e18 100644
--- a/src/render/opengl/opengldebug.h
+++ b/src/render/opengl/opengldebug.h
@@ -23,6 +23,8 @@
#include "render/opengl/mgl.h"
+RENDER_OPENGL_MGL_H
+
#if defined(DEBUG_OPENGL) && defined(USE_OPENGL)
#define GLDEBUG_START(text) if (mglPushGroupMarker) \
mglPushGroupMarker(sizeof(text), text);
diff --git a/src/render/openglx/mglx.cpp b/src/render/openglx/mglx.cpp
index 8a2e2947b..4fdc85838 100644
--- a/src/render/openglx/mglx.cpp
+++ b/src/render/openglx/mglx.cpp
@@ -18,10 +18,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "render/openglx/mglx.h"
-
#if defined(USE_OPENGL) && defined(USE_X11)
+#include "render/openglx/mglx.h"
+
#include "debug.h"
#define defName(name) name##_t m##name = nullptr
@@ -29,4 +29,6 @@
// include function defines
#include "render/openglx/mglx.hpp"
+MGLX_DEFINE
+
#endif
diff --git a/src/render/openglx/mglx.h b/src/render/openglx/mglx.h
index 1b95b0f90..b522f29b9 100644
--- a/src/render/openglx/mglx.h
+++ b/src/render/openglx/mglx.h
@@ -21,15 +21,15 @@
#ifndef RENDER_OPENGLX_MGLX_H
#define RENDER_OPENGLX_MGLX_H
-#include "main.h"
-
#if defined(USE_OPENGL) && defined(USE_X11)
#include "render/openglx/mglxtypes.h"
#define defName(name) extern name##_t m##name
#include "render/openglx/mglx.hpp"
+MGLX_DEFINE
#undef defName
+#undef MGLX_DEFINE
#endif // defined(USE_OPENGL) && defined(USE_X11)
#endif // RENDER_OPENGLX_MGLX_H
diff --git a/src/render/openglx/mglx.hpp b/src/render/openglx/mglx.hpp
index 21d5092e3..f663e4679 100644
--- a/src/render/openglx/mglx.hpp
+++ b/src/render/openglx/mglx.hpp
@@ -18,6 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#define MGLX_DEFINE
+
defName(glXCreateContext);
defName(glXGetCurrentContext);
defName(glXCreateContextAttribs);
diff --git a/src/render/openglx/mglxinit.cpp b/src/render/openglx/mglxinit.cpp
index cb2652a07..ce40a6534 100644
--- a/src/render/openglx/mglxinit.cpp
+++ b/src/render/openglx/mglxinit.cpp
@@ -18,10 +18,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "render/openglx/mglxinit.h"
-
#if defined(USE_OPENGL) && defined(USE_X11)
+#include "render/openglx/mglxinit.h"
+
#include "render/opengl/mglfunctions.h"
#include "render/openglx/mglx.h"
diff --git a/src/render/openglx/mglxinit.h b/src/render/openglx/mglxinit.h
index 553106445..de8e1086a 100644
--- a/src/render/openglx/mglxinit.h
+++ b/src/render/openglx/mglxinit.h
@@ -21,7 +21,6 @@
#ifndef RENDER_OPENGLX_MGLXINIT_H
#define RENDER_OPENGLX_MGLXINIT_H
-#include "main.h"
#if defined(USE_OPENGL) && defined(USE_X11)
namespace Glx
diff --git a/src/render/openglx/mglxtypes.h b/src/render/openglx/mglxtypes.h
index febb9eb5b..1d4064967 100644
--- a/src/render/openglx/mglxtypes.h
+++ b/src/render/openglx/mglxtypes.h
@@ -21,20 +21,10 @@
#ifndef RENDER_OPENGLX_MGLXTYPES_H
#define RENDER_OPENGLX_MGLXTYPES_H
-#include "main.h"
-
#if defined(USE_OPENGL) && defined(USE_X11)
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
#include <GL/glx.h>
-#if defined(__GXX_EXPERIMENTAL_CXX0X__)
-#include <cstdint>
-#else
-#include <stdint.h>
-#endif
-
typedef void *(*glXCreateContext_t) (Display *dpy, XVisualInfo *vis,
void *shareList, bool direct);
typedef void *(*glXGetCurrentContext_t) (void);
diff --git a/src/render/safeopenglgraphics.cpp b/src/render/safeopenglgraphics.cpp
index 079ea9d31..50364590d 100644
--- a/src/render/safeopenglgraphics.cpp
+++ b/src/render/safeopenglgraphics.cpp
@@ -23,7 +23,9 @@
#if defined USE_OPENGL && !defined ANDROID
#include "render/safeopenglgraphics.h"
+#ifdef DEBUG_OPENGL
#include "render/opengl/mgl.h"
+#endif // DEBUG_OPENGL
#include "resources/imagerect.h"
#include "resources/safeopenglimagehelper.h"
diff --git a/src/render/sdlgraphics.cpp b/src/render/sdlgraphics.cpp
index b8c770bf4..9cd734f30 100644
--- a/src/render/sdlgraphics.cpp
+++ b/src/render/sdlgraphics.cpp
@@ -24,8 +24,6 @@
#include "render/sdlgraphics.h"
-#include "main.h"
-
#include "graphicsmanager.h"
#include "utils/sdlcheckutils.h"
diff --git a/src/render/vertexes/imagecollection.h b/src/render/vertexes/imagecollection.h
index 071499dbf..922fb6bd5 100644
--- a/src/render/vertexes/imagecollection.h
+++ b/src/render/vertexes/imagecollection.h
@@ -21,8 +21,6 @@
#ifndef RENDER_VERTEXES_IMAGECOLLECTION_H
#define RENDER_VERTEXES_IMAGECOLLECTION_H
-#include "main.h"
-
#include "render/vertexes/imagevertexes.h"
#include "localconsts.h"
diff --git a/src/render/vertexes/openglgraphicsvertexes.h b/src/render/vertexes/openglgraphicsvertexes.h
index c5d7e3014..6df146e2c 100644
--- a/src/render/vertexes/openglgraphicsvertexes.h
+++ b/src/render/vertexes/openglgraphicsvertexes.h
@@ -23,8 +23,6 @@
#ifdef USE_OPENGL
-#include "main.h"
-
#ifdef ANDROID
#include <GLES/gl.h>
#else
diff --git a/src/resources/atlas/atlasitem.h b/src/resources/atlas/atlasitem.h
index ae0c0d206..d6037f056 100644
--- a/src/resources/atlas/atlasitem.h
+++ b/src/resources/atlas/atlasitem.h
@@ -23,8 +23,6 @@
#ifdef USE_OPENGL
-#include "resources/memorycounter.h"
-
#include "resources/image/image.h"
#include <string>
diff --git a/src/resources/atlas/atlasmanager.cpp b/src/resources/atlas/atlasmanager.cpp
index 353818d68..bc1bf8224 100644
--- a/src/resources/atlas/atlasmanager.cpp
+++ b/src/resources/atlas/atlasmanager.cpp
@@ -33,10 +33,8 @@
#include "utils/physfsrwops.h"
#include "utils/sdlcheckutils.h"
-#include "resources/imagehelper.h"
#include "resources/openglimagehelper.h"
-#include "resources/atlas/atlasitem.h"
#include "resources/atlas/atlasresource.h"
#include "resources/atlas/textureatlas.h"
@@ -44,6 +42,8 @@
#include "resources/resourcemanager/resourcemanager.h"
+#include <SDL_endian.h>
+
#include "debug.h"
#ifndef SDL_BYTEORDER
diff --git a/src/resources/atlas/atlasmanager.h b/src/resources/atlas/atlasmanager.h
index 76fca7223..fdee09ecf 100644
--- a/src/resources/atlas/atlasmanager.h
+++ b/src/resources/atlas/atlasmanager.h
@@ -27,8 +27,6 @@
#include "utils/stringvector.h"
-#include <SDL.h>
-
class AtlasResource;
struct AtlasItem;
diff --git a/src/resources/atlas/atlasresource.cpp b/src/resources/atlas/atlasresource.cpp
index 5f2e24160..915d33f33 100644
--- a/src/resources/atlas/atlasresource.cpp
+++ b/src/resources/atlas/atlasresource.cpp
@@ -22,7 +22,6 @@
#include "resources/atlas/atlasresource.h"
-#include "resources/atlas/atlasitem.h"
#include "resources/atlas/atlasmanager.h"
#include "resources/atlas/textureatlas.h"
diff --git a/src/resources/atlas/textureatlas.h b/src/resources/atlas/textureatlas.h
index 78819fa00..98665d5a2 100644
--- a/src/resources/atlas/textureatlas.h
+++ b/src/resources/atlas/textureatlas.h
@@ -25,13 +25,8 @@
#include "utils/stringvector.h"
-#include "resources/memorycounter.h"
-
#include "resources/atlas/atlasitem.h"
-#include <vector>
-#include <SDL.h>
-
#include "localconsts.h"
class AtlasResource;
diff --git a/src/resources/beingcommon.h b/src/resources/beingcommon.h
index f86aba06b..d9de6b783 100644
--- a/src/resources/beingcommon.h
+++ b/src/resources/beingcommon.h
@@ -24,8 +24,6 @@
#include "utils/files.h"
#include "utils/xml.h"
-#include "utils/stringvector.h"
-
#include "localconsts.h"
class BeingInfo;
diff --git a/src/resources/fboinfo.h b/src/resources/fboinfo.h
index c97e4eee8..612077188 100644
--- a/src/resources/fboinfo.h
+++ b/src/resources/fboinfo.h
@@ -23,8 +23,6 @@
#ifdef USE_OPENGL
-#include "render/graphics.h"
-
#ifdef ANDROID
#include <GLES/gl.h>
#include <GLES/glext.h>
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 05fee875a..d538f9a3a 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -27,6 +27,7 @@
#include "graphicsmanager.h"
#endif
#include "logger.h"
+#include "main.h"
#include "const/resources/map/map.h"
diff --git a/src/resources/mobileopenglscreenshothelper.cpp b/src/resources/mobileopenglscreenshothelper.cpp
index 2614c6a38..e6da43e95 100644
--- a/src/resources/mobileopenglscreenshothelper.cpp
+++ b/src/resources/mobileopenglscreenshothelper.cpp
@@ -27,6 +27,8 @@
#include "configuration.h"
#include "graphicsmanager.h"
+#include "render/graphics.h"
+
#include "render/opengl/mgl.h"
#ifdef __native_client__
#include "render/opengl/naclglfunctions.h"
diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp
index b29e3b3b9..e63295c8c 100644
--- a/src/resources/openglimagehelper.cpp
+++ b/src/resources/openglimagehelper.cpp
@@ -25,7 +25,6 @@
#ifdef USE_OPENGL
#include "graphicsmanager.h"
-#include "logger.h"
#include "render/mobileopengl2graphics.h"
#include "render/mobileopenglgraphics.h"
diff --git a/src/resources/openglimagehelper.h b/src/resources/openglimagehelper.h
index 889b76abf..99929bb02 100644
--- a/src/resources/openglimagehelper.h
+++ b/src/resources/openglimagehelper.h
@@ -24,7 +24,6 @@
#define RESOURCES_OPENGLIMAGEHELPER_H
#include "localconsts.h"
-#include "main.h"
#ifdef USE_OPENGL
diff --git a/src/resources/openglscreenshothelper.cpp b/src/resources/openglscreenshothelper.cpp
index a3446d86d..d9ba241a3 100644
--- a/src/resources/openglscreenshothelper.cpp
+++ b/src/resources/openglscreenshothelper.cpp
@@ -27,6 +27,7 @@
#include "configuration.h"
#include "graphicsmanager.h"
+#include "render/graphics.h"
#include "render/opengl/mgl.h"
#ifdef __native_client__
#include "render/opengl/naclglfunctions.h"
diff --git a/src/resources/resourcemanager/resourcemanager.cpp b/src/resources/resourcemanager/resourcemanager.cpp
index 5fcc35477..9d915e30e 100644
--- a/src/resources/resourcemanager/resourcemanager.cpp
+++ b/src/resources/resourcemanager/resourcemanager.cpp
@@ -39,12 +39,6 @@
#include "utils/delete2.h"
#include "utils/physfsrwops.h"
-#ifdef USE_OPENGL
-#include "render/shaders/shader.h"
-#include "render/shaders/shaderprogram.h"
-#include "render/shaders/shadersmanager.h"
-#endif
-
#include <SDL_image.h>
#include <sstream>
diff --git a/src/resources/safeopenglimagehelper.cpp b/src/resources/safeopenglimagehelper.cpp
index 60c71d12e..8376ae0c8 100644
--- a/src/resources/safeopenglimagehelper.cpp
+++ b/src/resources/safeopenglimagehelper.cpp
@@ -25,7 +25,6 @@
#if defined(USE_OPENGL) && !defined(ANDROID)
#include "graphicsmanager.h"
-#include "logger.h"
#include "render/mobileopengl2graphics.h"
#include "render/mobileopenglgraphics.h"
diff --git a/src/resources/safeopenglimagehelper.h b/src/resources/safeopenglimagehelper.h
index 2a26c2400..691924cfe 100644
--- a/src/resources/safeopenglimagehelper.h
+++ b/src/resources/safeopenglimagehelper.h
@@ -24,7 +24,6 @@
#define RESOURCES_SAFEOPENGLIMAGEHELPER_H
#include "localconsts.h"
-#include "main.h"
#if defined(USE_OPENGL) && !defined(ANDROID)
diff --git a/src/resources/screenshothelper.h b/src/resources/screenshothelper.h
index 6982c681a..bccce863e 100644
--- a/src/resources/screenshothelper.h
+++ b/src/resources/screenshothelper.h
@@ -31,6 +31,7 @@
#ifdef USE_SDL2
#pragma GCC diagnostic pop
#endif
+_SDL_stdinc_h
#include <SDL_video.h>
#include "localconsts.h"
diff --git a/src/resources/sdlimagehelper.cpp b/src/resources/sdlimagehelper.cpp
index f8b8fb96d..4a8c4eb62 100644
--- a/src/resources/sdlimagehelper.cpp
+++ b/src/resources/sdlimagehelper.cpp
@@ -25,7 +25,6 @@
#include "resources/sdlimagehelper.h"
#include "logger.h"
-#include "main.h"
#include "resources/dye/dye.h"
#include "resources/dye/dyepalette.h"
diff --git a/src/resources/surfaceimagehelper.h b/src/resources/surfaceimagehelper.h
index 9b3692946..6100b3437 100644
--- a/src/resources/surfaceimagehelper.h
+++ b/src/resources/surfaceimagehelper.h
@@ -25,6 +25,7 @@
#ifndef USE_SDL2
#include "resources/sdlimagehelper.h"
+RESOURCES_SDLIMAGEHELPER_H
#else
diff --git a/src/soundmanager.h b/src/soundmanager.h
index fa30d3aeb..474b38b41 100644
--- a/src/soundmanager.h
+++ b/src/soundmanager.h
@@ -28,6 +28,7 @@
#pragma GCC diagnostic ignored "-Wswitch-default"
#endif
#include <SDL_stdinc.h>
+_SDL_stdinc_h
#ifdef USE_SDL2
#pragma GCC diagnostic pop
#endif
diff --git a/src/test/testlauncher.cpp b/src/test/testlauncher.cpp
index 2afee7f43..ba9cfc267 100644
--- a/src/test/testlauncher.cpp
+++ b/src/test/testlauncher.cpp
@@ -29,8 +29,6 @@
#include "gui/skin.h"
#include "gui/theme.h"
-#include "gui/cliprect.h"
-
#include "gui/fonts/font.h"
#include "utils/physfscheckutils.h"
@@ -41,7 +39,6 @@
#include "render/vertexes/imagecollection.h"
#include "resources/imagewriter.h"
-#include "resources/mstack.h"
#include "resources/openglimagehelper.h"
#include "resources/screenshothelper.h"
#include "resources/surfaceimagehelper.h"
diff --git a/src/test/testmain.cpp b/src/test/testmain.cpp
index 50723a0a8..a242b89bd 100644
--- a/src/test/testmain.cpp
+++ b/src/test/testmain.cpp
@@ -18,7 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
#include "test/testmain.h"
#ifdef USE_OPENGL
@@ -30,8 +29,6 @@
#include "utils/paths.h"
#include "utils/process.h"
-#include <iostream>
-
#include "debug.h"
std::string fileName;
diff --git a/src/utils/booleanoptions.h b/src/utils/booleanoptions.h
index 9b54eee58..b3ba113b8 100644
--- a/src/utils/booleanoptions.h
+++ b/src/utils/booleanoptions.h
@@ -23,6 +23,8 @@
#include "utils/gettext.h"
+UTILS_GETTEXT_H
+
// TRANSLATORS: chat option changed message
#define BOOLEAN_OPTIONS _("Options to /%s are \"yes\", \"no\", \"true\", "\
"\"false\", \"1\", \"0\".")
diff --git a/src/utils/cpu.cpp b/src/utils/cpu.cpp
index 5fb0195a6..672cc115f 100644
--- a/src/utils/cpu.cpp
+++ b/src/utils/cpu.cpp
@@ -22,7 +22,10 @@
#include "logger.h"
-#if defined(__linux__) || defined(__linux)
+#if (defined(__amd64__) || defined(__i386__)) && defined(__GNUC__) \
+ && (GCC_VERSION >= 40800) && !defined(ANDROID)
+// nothing
+#elif defined(__linux__) || defined(__linux)
#include "utils/stringutils.h"
#endif
diff --git a/src/utils/glxhelper.cpp b/src/utils/glxhelper.cpp
index 65cca1166..eb78ddead 100644
--- a/src/utils/glxhelper.cpp
+++ b/src/utils/glxhelper.cpp
@@ -25,12 +25,8 @@
#include "logger.h"
#include "render/opengl/mglcheck.h"
-#include "render/opengl/mgldefines.h"
#include "render/openglx/mglx.h"
-#include "render/openglx/mglxtypes.h"
-
-#include "utils/stringutils.h"
#include "debug.h"
diff --git a/src/utils/glxhelper.h b/src/utils/glxhelper.h
index 5ac35af96..f0aa9022c 100644
--- a/src/utils/glxhelper.h
+++ b/src/utils/glxhelper.h
@@ -21,8 +21,6 @@
#ifndef UTILS_GLXHELPER_H
#define UTILS_GLXHELPER_H
-#include "main.h"
-
#if defined(USE_OPENGL) && defined(USE_X11)
#include "localconsts.h"
diff --git a/src/utils/physfsrwops.h b/src/utils/physfsrwops.h
index e1226f3b4..1a03b7a2f 100644
--- a/src/utils/physfsrwops.h
+++ b/src/utils/physfsrwops.h
@@ -30,6 +30,7 @@
#pragma GCC diagnostic ignored "-Wswitch-default"
#endif
#include <SDL_stdinc.h>
+_SDL_stdinc_h
#ifdef USE_SDL2
#pragma GCC diagnostic pop
#endif
diff --git a/src/utils/sdlhelper.cpp b/src/utils/sdlhelper.cpp
index bc5e75a56..bdb6dbd4e 100644
--- a/src/utils/sdlhelper.cpp
+++ b/src/utils/sdlhelper.cpp
@@ -23,7 +23,6 @@
#include "utils/sdlhelper.h"
#include "logger.h"
-#include "main.h"
#include "utils/stringutils.h"
diff --git a/src/utils/sdlhelper.h b/src/utils/sdlhelper.h
index 081494953..89cd3f789 100644
--- a/src/utils/sdlhelper.h
+++ b/src/utils/sdlhelper.h
@@ -21,8 +21,6 @@
#ifndef UTILS_SDLHELPER_H
#define UTILS_SDLHELPER_H
-#include "main.h"
-
#ifdef USE_SDL2
#include "utils/sdl2helper.h"
diff --git a/src/utils/xml.h b/src/utils/xml.h
index 556455f7b..748bec0e0 100644
--- a/src/utils/xml.h
+++ b/src/utils/xml.h
@@ -27,4 +27,6 @@
#include "utils/xml/libxml.h"
#endif // ENABLE_PUGIXML
+XML_INCLUDE_DEFINE
+
#endif // UTILS_XML_H
diff --git a/src/utils/xml/libxml.h b/src/utils/xml/libxml.h
index 49968123e..1f5233ea0 100644
--- a/src/utils/xml/libxml.h
+++ b/src/utils/xml/libxml.h
@@ -25,13 +25,14 @@
#ifdef ENABLE_LIBXML
+#define XML_INCLUDE_DEFINE
+
#include "enums/simpletypes/skiperror.h"
#include "enums/simpletypes/useresman.h"
#include "utils/xml/libxml.inc"
#include <libxml/tree.h>
-#include <libxml/xmlwriter.h>
#include <string>
diff --git a/src/utils/xml/libxml.inc b/src/utils/xml/libxml.inc
index 238eafec9..ea847b88f 100644
--- a/src/utils/xml/libxml.inc
+++ b/src/utils/xml/libxml.inc
@@ -23,6 +23,10 @@
#ifdef ENABLE_LIBXML
+#include <libxml/xmlwriter.h>
+
+__XML_XMLWRITER_H__
+
#define XmlNodePtr xmlNodePtr
#define XmlNodePtrConst xmlNode *const
#define XmlStrEqual(str1, str2) xmlStrEqual(str1, \
diff --git a/src/utils/xml/pugixml.h b/src/utils/xml/pugixml.h
index ed4456bb7..ef7b3e798 100644
--- a/src/utils/xml/pugixml.h
+++ b/src/utils/xml/pugixml.h
@@ -25,6 +25,8 @@
#ifdef ENABLE_PUGIXML
+#define XML_INCLUDE_DEFINE
+
#include "enums/simpletypes/skiperror.h"
#include "enums/simpletypes/useresman.h"