summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/being/compoundsprite.cpp4
-rw-r--r--src/dyetool/client.cpp2
-rw-r--r--src/graphicsmanager.cpp6
-rw-r--r--src/gui/sdlinput.cpp1
-rw-r--r--src/gui/widgets/tabs/setup_video.cpp4
-rw-r--r--src/gui/windowmanager.cpp8
-rw-r--r--src/localconsts.h2
-rw-r--r--src/maingui.cpp8
-rw-r--r--src/net/download.cpp2
-rw-r--r--src/net/ea/network.cpp4
-rw-r--r--src/net/eathena/maptypeproperty2.h2
-rw-r--r--src/net/eathena/messagein.cpp4
-rw-r--r--src/net/eathena/messageout.cpp6
-rw-r--r--src/net/eathena/network.cpp1
-rw-r--r--src/net/eathena/packetsout.inc2
-rw-r--r--src/net/eathena/protocolout.cpp3
-rw-r--r--src/net/eathena/protocolout.h2
-rw-r--r--src/net/eathena/recvpackets.inc2
-rw-r--r--src/net/eathena/updateprotocol.cpp6
-rw-r--r--src/net/net.cpp2
-rw-r--r--src/net/protocoloutdefine.h1
-rw-r--r--src/net/protocoloutupdate.h1
-rw-r--r--src/net/tmwa/messagein.cpp4
-rw-r--r--src/net/tmwa/messageout.cpp6
-rw-r--r--src/net/tmwa/network.cpp1
-rw-r--r--src/net/tmwa/packetsout.inc2
-rw-r--r--src/net/tmwa/protocolout.cpp3
-rw-r--r--src/net/tmwa/protocolout.h2
-rw-r--r--src/net/tmwa/recvpackets.inc2
-rw-r--r--src/net/tmwa/updateprotocol.cpp7
-rw-r--r--src/render/sdl2softwaregraphics.cpp4
-rw-r--r--src/render/sdlgraphics.cpp4
-rw-r--r--src/resources/atlas/atlasmanager.cpp4
-rw-r--r--src/resources/dye/dye.cpp4
-rw-r--r--src/resources/dye/dyepalette.cpp4
-rw-r--r--src/resources/imagehelper.cpp4
-rw-r--r--src/resources/openglimagehelper.cpp4
-rw-r--r--src/resources/resourcemanager/resourcemanager.cpp1
-rw-r--r--src/resources/safeopenglimagehelper.cpp4
-rw-r--r--src/resources/sdl2softwarescreenshothelper.cpp4
-rw-r--r--src/resources/sdlimagehelper.cpp4
-rw-r--r--src/resources/sdlscreenshothelper.cpp4
-rw-r--r--src/resources/sprite/spritedisplay.h2
-rw-r--r--src/resources/updatefile.h2
-rw-r--r--src/utils/copynpaste.cpp31
-rw-r--r--src/utils/paths.cpp3
46 files changed, 138 insertions, 45 deletions
diff --git a/src/being/compoundsprite.cpp b/src/being/compoundsprite.cpp
index ef97b973d..cd0ee8d62 100644
--- a/src/being/compoundsprite.cpp
+++ b/src/being/compoundsprite.cpp
@@ -50,6 +50,10 @@
#include "debug.h"
+#ifndef SDL_BYTEORDER
+#error missing SDL_endian.h
+#endif
+
#ifndef USE_SDL2
static const int BUFFER_WIDTH = 100;
static const int BUFFER_HEIGHT = 100;
diff --git a/src/dyetool/client.cpp b/src/dyetool/client.cpp
index 1b78ed1bb..c9effa88c 100644
--- a/src/dyetool/client.cpp
+++ b/src/dyetool/client.cpp
@@ -84,8 +84,6 @@
#endif
#endif
-#include <sys/stat.h>
-
#include "debug.h"
std::string errorMessage;
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index 4c05a50d3..f3b712724 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -42,12 +42,11 @@
#endif // WIN32
#endif // USE_OPENGL
-#include "configuration.h"
-#include "logger.h"
-
#include "settings.h"
#ifdef USE_OPENGL
+#include "logger.h"
+
#include "render/mobileopengl2graphics.h"
#include "render/mobileopenglgraphics.h"
#include "render/modernopenglgraphics.h"
@@ -58,7 +57,6 @@
#include "render/opengl/mglcheck.h"
#include "render/opengl/mglemu.h"
#endif
-#include "render/renderers.h"
#include "render/sdlgraphics.h"
#ifdef USE_OPENGL
diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp
index 3dfa5d6d6..9f4ce0c93 100644
--- a/src/gui/sdlinput.cpp
+++ b/src/gui/sdlinput.cpp
@@ -90,7 +90,6 @@
#include "gui/gui.h"
#endif
-#include <SDL_keyboard.h>
#include <SDL_timer.h>
#include "debug.h"
diff --git a/src/gui/widgets/tabs/setup_video.cpp b/src/gui/widgets/tabs/setup_video.cpp
index 591093bc8..3c38466a7 100644
--- a/src/gui/widgets/tabs/setup_video.cpp
+++ b/src/gui/widgets/tabs/setup_video.cpp
@@ -22,8 +22,6 @@
#include "gui/widgets/tabs/setup_video.h"
-#include "configuration.h"
-
#include "gui/windowmanager.h"
#include "gui/windows/okdialog.h"
@@ -51,8 +49,6 @@
#include "gui/models/modelistmodel.h"
#include "gui/models/opengllistmodel.h"
-#include "render/renderers.h"
-
#include <sstream>
#include "debug.h"
diff --git a/src/gui/windowmanager.cpp b/src/gui/windowmanager.cpp
index 479c8d2ca..9176c448a 100644
--- a/src/gui/windowmanager.cpp
+++ b/src/gui/windowmanager.cpp
@@ -35,7 +35,9 @@
#include "gui/popups/textpopup.h"
-#ifndef DYECMD
+#ifdef DYECMD
+#include "render/graphics.h"
+#else // DYECMD
#include "gui/popups/beingpopup.h"
#include "gui/popups/itempopup.h"
#include "gui/popups/popupmenu.h"
@@ -46,7 +48,7 @@
#include "gui/windows/didyouknowwindow.h"
#include "gui/windows/helpwindow.h"
#include "gui/windows/setupwindow.h"
-#endif
+#endif // DYECMD
#include "gui/widgets/createwidget.h"
#include "gui/widgets/desktop.h"
@@ -61,8 +63,6 @@
#include "utils/naclmessages.h"
#endif // __native_client__
-#include "render/graphics.h"
-
#ifdef ANDROID
#ifndef USE_SDL2
#include <SDL_screenkeyboard.h>
diff --git a/src/localconsts.h b/src/localconsts.h
index e39102f86..9033a854d 100644
--- a/src/localconsts.h
+++ b/src/localconsts.h
@@ -313,7 +313,7 @@
#undef USE_FUZZER
#endif
#include "utils/perfomance.h"
-
+UTILS_PERFOMANCE_H // guard for protect previous include
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
diff --git a/src/maingui.cpp b/src/maingui.cpp
index 065c07365..528ccf3a9 100644
--- a/src/maingui.cpp
+++ b/src/maingui.cpp
@@ -22,8 +22,6 @@
#include "maingui.h"
-#include "main.h"
-
#include "client.h"
#include "commandline.h"
#include "settings.h"
@@ -43,11 +41,13 @@
#endif
#include <iostream>
-#include <unistd.h>
#include <SDL_image.h>
#include <SDL_mixer.h>
-#include <SDL_version.h>
+
+#ifndef SDL_VERSIONNUM
+#error missing <SDL_version.h>
+#endif
#define SDL_IMAGE_COMPILEDVERSION \
SDL_VERSIONNUM(SDL_IMAGE_MAJOR_VERSION, \
diff --git a/src/net/download.cpp b/src/net/download.cpp
index 96b330aec..91d448899 100644
--- a/src/net/download.cpp
+++ b/src/net/download.cpp
@@ -30,8 +30,6 @@
#include <curl/curl.h>
-#include <SDL_thread.h>
-
#include <zlib.h>
#define CURLVERSION_ATLEAST(a, b, c) ((LIBCURL_VERSION_MAJOR > (a)) || \
diff --git a/src/net/ea/network.cpp b/src/net/ea/network.cpp
index ea6587421..15a45fde0 100644
--- a/src/net/ea/network.cpp
+++ b/src/net/ea/network.cpp
@@ -35,6 +35,10 @@
#include "debug.h"
+#ifndef SDL_BYTEORDER
+#error missing SDL_endian.h
+#endif
+
extern unsigned int mLastHost;
namespace Ea
diff --git a/src/net/eathena/maptypeproperty2.h b/src/net/eathena/maptypeproperty2.h
index da069ac96..e8602ffbe 100644
--- a/src/net/eathena/maptypeproperty2.h
+++ b/src/net/eathena/maptypeproperty2.h
@@ -21,6 +21,8 @@
#ifndef NET_EATHENA_MAPTYPEPROPERTY2_H
#define NET_EATHENA_MAPTYPEPROPERTY2_H
+#include "localconsts.h"
+
#if defined(__GXX_EXPERIMENTAL_CXX0X__)
#include <cstdint>
#else
diff --git a/src/net/eathena/messagein.cpp b/src/net/eathena/messagein.cpp
index 34edbe39d..7137b468b 100644
--- a/src/net/eathena/messagein.cpp
+++ b/src/net/eathena/messagein.cpp
@@ -31,6 +31,10 @@
#include "debug.h"
+#ifndef SDL_BYTEORDER
+#error missing SDL_endian.h
+#endif
+
namespace EAthena
{
diff --git a/src/net/eathena/messageout.cpp b/src/net/eathena/messageout.cpp
index a20d924c9..83fc381c5 100644
--- a/src/net/eathena/messageout.cpp
+++ b/src/net/eathena/messageout.cpp
@@ -28,10 +28,12 @@
#include "logger.h"
-#include <SDL_endian.h>
-
#include "debug.h"
+#ifndef SDL_BYTEORDER
+#error missing SDL_endian.h
+#endif
+
namespace EAthena
{
diff --git a/src/net/eathena/network.cpp b/src/net/eathena/network.cpp
index 2511f8e57..c5f0adad5 100644
--- a/src/net/eathena/network.cpp
+++ b/src/net/eathena/network.cpp
@@ -108,6 +108,7 @@ Network::~Network()
void Network::registerHandlers()
{
#include "net/eathena/recvpackets.inc"
+RECVPACKETS_VOID
}
void Network::clearHandlers()
diff --git a/src/net/eathena/packetsout.inc b/src/net/eathena/packetsout.inc
index 603a62f22..1cf5f2780 100644
--- a/src/net/eathena/packetsout.inc
+++ b/src/net/eathena/packetsout.inc
@@ -20,6 +20,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#define PACKETSOUT_VOID
+
// 0
packet(CMSG_SERVER_VERSION_REQUEST, 0x7530, 0, nullptr);
diff --git a/src/net/eathena/protocolout.cpp b/src/net/eathena/protocolout.cpp
index 44e5477d6..00f455aca 100644
--- a/src/net/eathena/protocolout.cpp
+++ b/src/net/eathena/protocolout.cpp
@@ -23,7 +23,8 @@ namespace EAthena
#include "net/protocoloutdefine.h"
#include "net/eathena/packetsout.inc"
#undef packet
-
+PROTOCOLOUT_VOID
+PACKETSOUT_VOID
} // namespace EAthena
#include "debug.h"
diff --git a/src/net/eathena/protocolout.h b/src/net/eathena/protocolout.h
index 4f4572050..fa8319c92 100644
--- a/src/net/eathena/protocolout.h
+++ b/src/net/eathena/protocolout.h
@@ -23,6 +23,8 @@
#include "net/protocoloutinclude.h"
+#define PROTOCOLOUT_VOID
+
namespace EAthena
{
#include "net/eathena/packetsout.inc"
diff --git a/src/net/eathena/recvpackets.inc b/src/net/eathena/recvpackets.inc
index 29e3d433d..9dbe9d3f6 100644
--- a/src/net/eathena/recvpackets.inc
+++ b/src/net/eathena/recvpackets.inc
@@ -21,6 +21,8 @@
#ifndef NET_EATHENA_RECVPACKETS_H
#define NET_EATHENA_RECVPACKETS_H
+#define RECVPACKETS_VOID
+
#include "net/recvpacketdefine.h"
#include "net/eathena/packetsin.inc"
diff --git a/src/net/eathena/updateprotocol.cpp b/src/net/eathena/updateprotocol.cpp
index b14c4b89a..a23ea51bb 100644
--- a/src/net/eathena/updateprotocol.cpp
+++ b/src/net/eathena/updateprotocol.cpp
@@ -30,6 +30,8 @@
extern int packetVersion;
extern int serverVersion;
+PACKETSOUT_VOID
+#undef PACKETSOUT_VOID
namespace EAthena
{
@@ -48,4 +50,8 @@ void updateProtocol()
}
}
+PACKETSOUT_VOID
+PROTOCOLOUTUPDATE_VOID
+PROTOCOLOUT_VOID
+
} // namespace EAthena
diff --git a/src/net/net.cpp b/src/net/net.cpp
index 49ce1321f..ca2d07838 100644
--- a/src/net/net.cpp
+++ b/src/net/net.cpp
@@ -20,8 +20,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "main.h"
-
#include "net/net.h"
#include "configuration.h"
diff --git a/src/net/protocoloutdefine.h b/src/net/protocoloutdefine.h
index bbf2ea20e..006168bf5 100644
--- a/src/net/protocoloutdefine.h
+++ b/src/net/protocoloutdefine.h
@@ -22,5 +22,6 @@
#define NET_PROTOCOLOUTDEFINE_H
#define packet(name, id, sz, comment) int name = id
+#define PROTOCOLOUT_VOID
#endif // NET_PROTOCOLOUTDEFINE_H
diff --git a/src/net/protocoloutupdate.h b/src/net/protocoloutupdate.h
index 550831940..042e264d2 100644
--- a/src/net/protocoloutupdate.h
+++ b/src/net/protocoloutupdate.h
@@ -22,5 +22,6 @@
#define NET_PROTOCOLOUTUPDATE_H
#define packet(name, id, sz, comment) name = id
+#define PROTOCOLOUTUPDATE_VOID
#endif // NET_PROTOCOLOUTUPDATE_H
diff --git a/src/net/tmwa/messagein.cpp b/src/net/tmwa/messagein.cpp
index a5fac5ac9..095ee91bf 100644
--- a/src/net/tmwa/messagein.cpp
+++ b/src/net/tmwa/messagein.cpp
@@ -31,6 +31,10 @@
#include "debug.h"
+#ifndef SDL_BYTEORDER
+#error missing SDL_endian.h
+#endif
+
namespace TmwAthena
{
diff --git a/src/net/tmwa/messageout.cpp b/src/net/tmwa/messageout.cpp
index 82a67e924..237d4f185 100644
--- a/src/net/tmwa/messageout.cpp
+++ b/src/net/tmwa/messageout.cpp
@@ -28,10 +28,12 @@
#include "logger.h"
-#include <SDL_endian.h>
-
#include "debug.h"
+#ifndef SDL_BYTEORDER
+#error missing SDL_endian.h
+#endif
+
namespace TmwAthena
{
diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp
index 66bf166e1..bf574b567 100644
--- a/src/net/tmwa/network.cpp
+++ b/src/net/tmwa/network.cpp
@@ -86,6 +86,7 @@ Network::~Network()
void Network::registerHandlers()
{
#include "net/tmwa/recvpackets.inc"
+RECVPACKETS_VOID
}
void Network::clearHandlers()
diff --git a/src/net/tmwa/packetsout.inc b/src/net/tmwa/packetsout.inc
index 339863cf0..f789791df 100644
--- a/src/net/tmwa/packetsout.inc
+++ b/src/net/tmwa/packetsout.inc
@@ -20,6 +20,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#define PACKETSOUT_VOID
+
packet(CMSG_SERVER_VERSION_REQUEST, 0x7530, 0, nullptr);
packet(CMSG_LOGIN_REGISTER, 0x0064, 0, nullptr);
diff --git a/src/net/tmwa/protocolout.cpp b/src/net/tmwa/protocolout.cpp
index 8332ceb8d..d8d123eee 100644
--- a/src/net/tmwa/protocolout.cpp
+++ b/src/net/tmwa/protocolout.cpp
@@ -23,7 +23,8 @@ namespace TmwAthena
#include "net/protocoloutdefine.h"
#include "net/tmwa/packetsout.inc"
#undef packet
-
+PROTOCOLOUT_VOID
+PACKETSOUT_VOID
} // namesspace TmwAthena
#include "debug.h"
diff --git a/src/net/tmwa/protocolout.h b/src/net/tmwa/protocolout.h
index 413e458ef..2686cd9f5 100644
--- a/src/net/tmwa/protocolout.h
+++ b/src/net/tmwa/protocolout.h
@@ -23,6 +23,8 @@
#include "net/protocoloutinclude.h"
+#define PROTOCOLOUT_VOID
+
namespace TmwAthena
{
#include "net/tmwa/packetsout.inc"
diff --git a/src/net/tmwa/recvpackets.inc b/src/net/tmwa/recvpackets.inc
index 8c1a59253..3afbf07bb 100644
--- a/src/net/tmwa/recvpackets.inc
+++ b/src/net/tmwa/recvpackets.inc
@@ -21,6 +21,8 @@
#ifndef NET_TMWA_RECVPACKETS_H
#define NET_TMWA_RECVPACKETS_H
+#define RECVPACKETS_VOID
+
#include "net/recvpacketdefine.h"
#include "net/tmwa/packetsin.inc"
diff --git a/src/net/tmwa/updateprotocol.cpp b/src/net/tmwa/updateprotocol.cpp
index a07ccc319..7d5622acd 100644
--- a/src/net/tmwa/updateprotocol.cpp
+++ b/src/net/tmwa/updateprotocol.cpp
@@ -25,6 +25,9 @@
#include "debug.h"
+PACKETSOUT_VOID
+#undef PACKETSOUT_VOID
+
namespace TmwAthena
{
@@ -42,4 +45,8 @@ void updateProtocol()
}
}
+PACKETSOUT_VOID
+PROTOCOLOUTUPDATE_VOID
+PROTOCOLOUT_VOID
+
} // namespace TmwAthena
diff --git a/src/render/sdl2softwaregraphics.cpp b/src/render/sdl2softwaregraphics.cpp
index 8ba667faa..125ba8847 100644
--- a/src/render/sdl2softwaregraphics.cpp
+++ b/src/render/sdl2softwaregraphics.cpp
@@ -43,6 +43,10 @@
#include "debug.h"
+#ifndef SDL_BYTEORDER
+#error missing SDL_endian.h
+#endif
+
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
static unsigned int *cR = nullptr;
static unsigned int *cG = nullptr;
diff --git a/src/render/sdlgraphics.cpp b/src/render/sdlgraphics.cpp
index 6972b03da..40978f2d6 100644
--- a/src/render/sdlgraphics.cpp
+++ b/src/render/sdlgraphics.cpp
@@ -39,6 +39,10 @@
#include "debug.h"
+#ifndef SDL_BYTEORDER
+#error missing SDL_endian.h
+#endif
+
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
static unsigned int *cR = nullptr;
static unsigned int *cG = nullptr;
diff --git a/src/resources/atlas/atlasmanager.cpp b/src/resources/atlas/atlasmanager.cpp
index 46f161e6a..4e1b0e96c 100644
--- a/src/resources/atlas/atlasmanager.cpp
+++ b/src/resources/atlas/atlasmanager.cpp
@@ -46,6 +46,10 @@
#include "debug.h"
+#ifndef SDL_BYTEORDER
+#error missing SDL_endian.h
+#endif
+
AtlasManager::AtlasManager()
{
}
diff --git a/src/resources/dye/dye.cpp b/src/resources/dye/dye.cpp
index a5dd44221..3aa42d7e7 100644
--- a/src/resources/dye/dye.cpp
+++ b/src/resources/dye/dye.cpp
@@ -34,6 +34,10 @@
#include "debug.h"
+#ifndef SDL_BYTEORDER
+#error missing SDL_endian.h
+#endif
+
Dye::Dye(const std::string &restrict description)
{
for (int i = 0; i < dyePalateSize; ++i)
diff --git a/src/resources/dye/dyepalette.cpp b/src/resources/dye/dyepalette.cpp
index 5884554ed..930f23723 100644
--- a/src/resources/dye/dyepalette.cpp
+++ b/src/resources/dye/dyepalette.cpp
@@ -36,6 +36,10 @@
#include "debug.h"
+#ifndef SDL_BYTEORDER
+#error missing SDL_endian.h
+#endif
+
DyePalette::DyePalette(const std::string &restrict description,
const uint8_t blockSize) :
mColors()
diff --git a/src/resources/imagehelper.cpp b/src/resources/imagehelper.cpp
index 1067058b2..737e43aaa 100644
--- a/src/resources/imagehelper.cpp
+++ b/src/resources/imagehelper.cpp
@@ -33,6 +33,10 @@
#include "debug.h"
+#ifndef SDL_BYTEORDER
+#error missing SDL_endian.h
+#endif
+
ImageHelper *imageHelper = nullptr;
ImageHelper *surfaceImageHelper = nullptr;
diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp
index 9e3e5dc2d..7ce48556d 100644
--- a/src/resources/openglimagehelper.cpp
+++ b/src/resources/openglimagehelper.cpp
@@ -50,6 +50,10 @@
#include "debug.h"
+#ifndef SDL_BYTEORDER
+#error missing SDL_endian.h
+#endif
+
int OpenGLImageHelper::mTextureType = 0;
int OpenGLImageHelper::mInternalTextureType = GL_RGBA8;
int OpenGLImageHelper::mTextureSize = 0;
diff --git a/src/resources/resourcemanager/resourcemanager.cpp b/src/resources/resourcemanager/resourcemanager.cpp
index e2aa08baa..993d011b7 100644
--- a/src/resources/resourcemanager/resourcemanager.cpp
+++ b/src/resources/resourcemanager/resourcemanager.cpp
@@ -38,7 +38,6 @@
#include "utils/checkutils.h"
#include "utils/delete2.h"
#include "utils/physfsrwops.h"
-#include "utils/physfstools.h"
#ifdef USE_OPENGL
#include "render/shaders/shader.h"
diff --git a/src/resources/safeopenglimagehelper.cpp b/src/resources/safeopenglimagehelper.cpp
index c57e2a104..8a929f214 100644
--- a/src/resources/safeopenglimagehelper.cpp
+++ b/src/resources/safeopenglimagehelper.cpp
@@ -47,6 +47,10 @@
#include "debug.h"
+#ifndef SDL_BYTEORDER
+#error missing SDL_endian.h
+#endif
+
int SafeOpenGLImageHelper::mTextureType = 0;
int SafeOpenGLImageHelper::mInternalTextureType = GL_RGBA8;
int SafeOpenGLImageHelper::mTextureSize = 0;
diff --git a/src/resources/sdl2softwarescreenshothelper.cpp b/src/resources/sdl2softwarescreenshothelper.cpp
index 45e784385..9b76c9472 100644
--- a/src/resources/sdl2softwarescreenshothelper.cpp
+++ b/src/resources/sdl2softwarescreenshothelper.cpp
@@ -33,6 +33,10 @@
#include "debug.h"
+#ifndef SDL_BYTEORDER
+#error missing SDL_endian.h
+#endif
+
Sdl2SoftwareScreenshotHelper::Sdl2SoftwareScreenshotHelper() :
ScreenshotHelper()
{
diff --git a/src/resources/sdlimagehelper.cpp b/src/resources/sdlimagehelper.cpp
index ad046221f..d97a51fc6 100644
--- a/src/resources/sdlimagehelper.cpp
+++ b/src/resources/sdlimagehelper.cpp
@@ -39,6 +39,10 @@
#include "debug.h"
+#ifndef SDL_BYTEORDER
+#error missing SDL_endian.h
+#endif
+
bool SDLImageHelper::mEnableAlphaCache = false;
Image *SDLImageHelper::load(SDL_RWops *const rw, Dye const &dye)
diff --git a/src/resources/sdlscreenshothelper.cpp b/src/resources/sdlscreenshothelper.cpp
index dd4689f08..a7375d919 100644
--- a/src/resources/sdlscreenshothelper.cpp
+++ b/src/resources/sdlscreenshothelper.cpp
@@ -30,6 +30,10 @@
#include "debug.h"
+#ifndef SDL_BYTEORDER
+#error missing SDL_endian.h
+#endif
+
SdlScreenshotHelper::SdlScreenshotHelper() :
ScreenshotHelper()
{
diff --git a/src/resources/sprite/spritedisplay.h b/src/resources/sprite/spritedisplay.h
index 424e8adc2..931c6a532 100644
--- a/src/resources/sprite/spritedisplay.h
+++ b/src/resources/sprite/spritedisplay.h
@@ -25,6 +25,8 @@
#include "utils/stringvector.h"
+#include "localconsts.h"
+
struct SpriteReference;
struct SpriteDisplay final
diff --git a/src/resources/updatefile.h b/src/resources/updatefile.h
index a92ec8e84..27e89fe9d 100644
--- a/src/resources/updatefile.h
+++ b/src/resources/updatefile.h
@@ -23,6 +23,8 @@
#ifndef RESOURCES_UPDATEFILE_H
#define RESOURCES_UPDATEFILE_H
+#include "localconsts.h"
+
#include <string>
struct UpdateFile final
diff --git a/src/utils/copynpaste.cpp b/src/utils/copynpaste.cpp
index 8bce3a4c0..b27768422 100644
--- a/src/utils/copynpaste.cpp
+++ b/src/utils/copynpaste.cpp
@@ -35,17 +35,32 @@
#include "utils/copynpaste.h"
+#include "debug.h"
+
+#ifdef USE_SDL2
+#include <SDL_clipboard.h>
+
+#else // USE_SDL2
+
+#if defined(__APPLE__)
+#ifdef Status
+#undef Status
+#endif
+#include <Carbon/Carbon.h>
+#elif defined USE_X11
#include "render/graphics.h"
#include "utils/sdlhelper.h"
#include <SDL_syswm.h>
+#include <unistd.h>
+#elif defined __native_client__
+#include "utils/naclmessages.h"
+#endif
-#include "debug.h"
+#endif // USE_SDL2
#ifdef USE_SDL2
-#include <SDL_clipboard.h>
-
bool retrieveBuffer(std::string& text, size_t& pos)
{
char *buf = SDL_GetClipboardText();
@@ -155,12 +170,6 @@ bool sendBuffer(const std::string &restrict text)
#elif defined(__APPLE__)
-#ifdef Status
-#undef Status
-#endif
-
-#include <Carbon/Carbon.h>
-
// Sorry for the very long code, all nicer OS X APIs are coded in
// Objective C and not C!
// Also it does very thorough error handling
@@ -300,8 +309,6 @@ bool sendBuffer(const std::string &restrict text)
#elif defined USE_X11
-#include <unistd.h>
-
static char* getSelection2(Display *const dpy, Window us, Atom selection,
Atom request_target)
{
@@ -472,8 +479,6 @@ static bool runxsel(const std::string &text, const char *p1, const char *p2)
#elif defined __native_client__
-#include "utils/naclmessages.h"
-
bool retrieveBuffer(std::string& text, size_t& pos)
{
NaclMessageHandle *handle = naclRegisterMessageHandler("clipboard-paste");
diff --git a/src/utils/paths.cpp b/src/utils/paths.cpp
index 2490c853d..e5d098a42 100644
--- a/src/utils/paths.cpp
+++ b/src/utils/paths.cpp
@@ -26,11 +26,12 @@
#include "utils/paths.h"
-#include "utils/files.h"
#include "utils/physfstools.h"
#include "utils/stringutils.h"
#ifdef USE_X11
+#include "utils/files.h"
+
#include "resources/resourcemanager/resourcemanager.h"
#endif