summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-03-15 22:03:17 +0300
committerAndrei Karas <akaras@inbox.ru>2015-03-16 13:50:43 +0300
commit23034a47937c109590eb60e4ee0efa32a8c9e45e (patch)
tree844c716da20752dcbb0aead649011f54d8062635
parent4638f969d4206ba8dd857eb6d2758106cc5268df (diff)
downloadplus-23034a47937c109590eb60e4ee0efa32a8c9e45e.tar.gz
plus-23034a47937c109590eb60e4ee0efa32a8c9e45e.tar.bz2
plus-23034a47937c109590eb60e4ee0efa32a8c9e45e.tar.xz
plus-23034a47937c109590eb60e4ee0efa32a8c9e45e.zip
Remove useless includes from cpp files
-rw-r--r--src/Makefile.am5
-rw-r--r--src/actions/actions.cpp9
-rw-r--r--src/actions/chat.cpp6
-rw-r--r--src/actions/pets.cpp6
-rw-r--r--src/actions/windows.cpp7
-rw-r--r--src/actormanager.cpp4
-rw-r--r--src/being/actorsprite.cpp2
-rw-r--r--src/being/being.cpp1
-rw-r--r--src/being/localplayer.cpp7
-rw-r--r--src/being/playerinfo.cpp19
-rw-r--r--src/being/playerinfo.h2
-rw-r--r--src/being/playerrelations.cpp2
-rw-r--r--src/client.cpp16
-rw-r--r--src/dyetool/dyemain.cpp1
-rw-r--r--src/eventsmanager.cpp1
-rw-r--r--src/game.cpp9
-rw-r--r--src/graphicsmanager.cpp24
-rw-r--r--src/graphicsvertexes.cpp2
-rw-r--r--src/gui/dialogsmanager.cpp2
-rw-r--r--src/gui/gui.cpp8
-rw-r--r--src/gui/models/skillmodel.cpp2
-rw-r--r--src/gui/popups/popupmenu.cpp7
-rw-r--r--src/gui/widgets/avatarlistbox.cpp1
-rw-r--r--src/gui/widgets/browserbox.cpp4
-rw-r--r--src/gui/widgets/button.cpp1
-rw-r--r--src/gui/widgets/desktop.cpp1
-rw-r--r--src/gui/widgets/dropdown.cpp3
-rw-r--r--src/gui/widgets/extendedlistbox.cpp4
-rw-r--r--src/gui/widgets/itemcontainer.cpp5
-rw-r--r--src/gui/widgets/itemlinkhandler.cpp2
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp5
-rw-r--r--src/gui/widgets/layoutarray.cpp2
-rw-r--r--src/gui/widgets/playerbox.cpp2
-rw-r--r--src/gui/widgets/setupitem.cpp1
-rw-r--r--src/gui/widgets/shoplistbox.cpp2
-rw-r--r--src/gui/widgets/spellshortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/tabs/chat/guildtab.cpp1
-rw-r--r--src/gui/widgets/tabs/debugwindowtabs.cpp3
-rw-r--r--src/gui/widgets/tabs/setup_audio.cpp2
-rw-r--r--src/gui/widgets/tabs/setup_colors.cpp1
-rw-r--r--src/gui/widgets/tabs/setup_theme.cpp1
-rw-r--r--src/gui/widgets/tabs/setup_touch.cpp1
-rw-r--r--src/gui/widgets/tabs/setup_video.cpp9
-rw-r--r--src/gui/widgets/virtshortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/widget.cpp2
-rw-r--r--src/gui/widgets/window.cpp3
-rw-r--r--src/gui/windowmenu.cpp2
-rw-r--r--src/gui/windows/botcheckerwindow.cpp2
-rw-r--r--src/gui/windows/buydialog.cpp1
-rw-r--r--src/gui/windows/changeemaildialog.cpp4
-rw-r--r--src/gui/windows/changepassworddialog.cpp4
-rw-r--r--src/gui/windows/charcreatedialog.cpp2
-rw-r--r--src/gui/windows/charselectdialog.cpp3
-rw-r--r--src/gui/windows/chatwindow.cpp5
-rw-r--r--src/gui/windows/equipmentwindow.cpp3
-rw-r--r--src/gui/windows/inventorywindow.cpp3
-rw-r--r--src/gui/windows/itemamountwindow.cpp2
-rw-r--r--src/gui/windows/minimap.cpp1
-rw-r--r--src/gui/windows/ministatuswindow.cpp1
-rw-r--r--src/gui/windows/npcdialog.cpp1
-rw-r--r--src/gui/windows/outfitwindow.cpp5
-rw-r--r--src/gui/windows/registerdialog.cpp1
-rw-r--r--src/gui/windows/serverdialog.cpp10
-rw-r--r--src/gui/windows/setupwindow.cpp1
-rw-r--r--src/gui/windows/shopwindow.cpp39
-rw-r--r--src/gui/windows/skilldialog.cpp4
-rw-r--r--src/gui/windows/socialwindow.cpp10
-rw-r--r--src/gui/windows/statuswindow.cpp4
-rw-r--r--src/gui/windows/textcommandeditor.cpp1
-rw-r--r--src/gui/windows/tradewindow.cpp1
-rw-r--r--src/gui/windows/unregisterdialog.cpp4
-rw-r--r--src/gui/windows/updaterwindow.cpp2
-rw-r--r--src/gui/windows/whoisonline.cpp8
-rw-r--r--src/input/keyboardconfig.cpp2
-rw-r--r--src/inventory.cpp3
-rw-r--r--src/item.cpp1
-rw-r--r--src/itemshortcut.cpp1
-rw-r--r--src/listeners/guitableactionlistener.cpp1
-rw-r--r--src/logger.cpp1
-rw-r--r--src/main.cpp1
-rw-r--r--src/net/download.cpp1
-rw-r--r--src/net/ea/adminhandler.cpp2
-rw-r--r--src/net/ea/chathandler.cpp6
-rw-r--r--src/net/ea/loginhandler.cpp1
-rw-r--r--src/net/ea/network.cpp2
-rw-r--r--src/net/ea/tradehandler.cpp2
-rw-r--r--src/net/eathena/adminhandler.cpp2
-rw-r--r--src/net/eathena/charserverhandler.cpp2
-rw-r--r--src/net/eathena/loginhandler.cpp1
-rw-r--r--src/net/eathena/messageout.cpp3
-rw-r--r--src/net/eathena/npchandler.cpp1
-rw-r--r--src/net/eathena/tradehandler.cpp2
-rw-r--r--src/net/ipc.cpp2
-rw-r--r--src/net/messageout.cpp3
-rw-r--r--src/net/tmwa/adminhandler.cpp2
-rw-r--r--src/net/tmwa/charserverhandler.cpp1
-rw-r--r--src/net/tmwa/generalhandler.cpp2
-rw-r--r--src/net/tmwa/messageout.cpp3
-rw-r--r--src/net/tmwa/tradehandler.cpp2
-rw-r--r--src/notifymanager.cpp4
-rw-r--r--src/particle/particle.cpp2
-rw-r--r--src/particle/particleemitter.cpp2
-rw-r--r--src/particle/rotationalparticle.cpp2
-rw-r--r--src/particle/textparticle.cpp2
-rw-r--r--src/render/graphics.cpp10
-rw-r--r--src/render/mobileopenglgraphics.cpp2
-rw-r--r--src/render/modernopenglgraphics.cpp2
-rw-r--r--src/render/normalopenglgraphics.cpp1
-rw-r--r--src/render/nullopenglgraphics.cpp1
-rw-r--r--src/render/safeopenglgraphics.cpp2
-rw-r--r--src/render/surfacegraphics.cpp2
-rw-r--r--src/resources/atlasmanager.cpp2
-rw-r--r--src/resources/atlasresource.cpp2
-rw-r--r--src/resources/db/colordb.cpp2
-rw-r--r--src/resources/image.cpp3
-rw-r--r--src/resources/imagehelper.cpp1
-rw-r--r--src/resources/imagewriter.cpp2
-rw-r--r--src/resources/iteminfo.cpp2
-rw-r--r--src/resources/map/map.cpp4
-rw-r--r--src/resources/map/maplayer.cpp4
-rw-r--r--src/resources/mapreader.cpp7
-rw-r--r--src/resources/resourcemanager.cpp4
-rw-r--r--src/resources/wallpaper.cpp2
-rw-r--r--src/spellmanager.cpp1
-rw-r--r--src/statuseffect.cpp3
-rw-r--r--src/touchmanager.cpp1
-rw-r--r--src/units.cpp6
-rw-r--r--src/utils/base64.cpp2
-rw-r--r--src/utils/chatutils.cpp3
-rw-r--r--src/utils/mkdir.cpp2
-rw-r--r--src/utils/process.cpp3
-rw-r--r--src/utils/stringutils.cpp6
-rw-r--r--src/utils/translation/podict.cpp2
-rw-r--r--src/utils/xml.cpp2
134 files changed, 127 insertions, 347 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 7ceb56bcc..ec8126771 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -5,6 +5,9 @@ bin_PROGRAMS = manaplus dyecmd
manaplus_CXXFLAGS = -DPKG_DATADIR=\""$(pkgdatadir)/"\" \
-DLOCALEDIR=\""$(localedir)"\" \
-Wall
+dyecmd_CXXFLAGS = -DPKG_DATADIR=\""$(pkgdatadir)/"\" \
+ -DLOCALEDIR=\""$(localedir)"\" \
+ -Wall
if ENABLE_PORTABLE
manaplus_CXXFLAGS += -DENABLE_PORTABLE
@@ -25,7 +28,7 @@ else
manaplus_SOURCES =
endif
-dyecmd_CXXFLAGS = -DDYECMD
+dyecmd_CXXFLAGS += -DDYECMD
dyecmd_SOURCES = gui/cliprect.cpp \
gui/color.cpp \
gui/rect.cpp \
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp
index 7d8e18591..516fa8a36 100644
--- a/src/actions/actions.cpp
+++ b/src/actions/actions.cpp
@@ -25,15 +25,15 @@
#include "dropshortcut.h"
#include "emoteshortcut.h"
#include "game.h"
+#ifdef USE_OPENGL
#include "graphicsmanager.h"
-#include "inventory.h"
+#endif
#include "itemshortcut.h"
#include "spellmanager.h"
#include "actions/actiondef.h"
#include "being/localplayer.h"
-#include "being/playerinfo.h"
#include "enums/being/attributes.h"
@@ -64,14 +64,15 @@
#include "gui/widgets/tabs/chat/chattab.h"
-#include "render/graphics.h"
#if defined USE_OPENGL
#include "render/normalopenglgraphics.h"
#endif
#include "net/adminhandler.h"
#include "net/beinghandler.h"
+#ifdef EATHENA_SUPPORT
#include "net/buyingstorehandler.h"
+#endif
#include "net/buysellhandler.h"
#include "net/chathandler.h"
#include "net/download.h"
@@ -92,8 +93,6 @@
#include "resources/resourcemanager.h"
#include "resources/skillconsts.h"
-#include "resources/db/itemdb.h"
-
#include "utils/chatutils.h"
#include "utils/delete2.h"
#include "utils/gettext.h"
diff --git a/src/actions/chat.cpp b/src/actions/chat.cpp
index 2ac6ec0f1..3f54d0dc4 100644
--- a/src/actions/chat.cpp
+++ b/src/actions/chat.cpp
@@ -21,7 +21,9 @@
#include "actions/chat.h"
#include "configuration.h"
+#ifdef TMWA_SUPPORT
#include "guildmanager.h"
+#endif
#include "actions/actiondef.h"
@@ -31,9 +33,6 @@
#include "gui/windows/chatwindow.h"
-#include "gui/widgets/tabs/chat/chattab.h"
-#include "gui/widgets/tabs/chat/chattabtype.h"
-
#include "net/chathandler.h"
#include "net/guildhandler.h"
#include "net/partyhandler.h"
@@ -41,7 +40,6 @@
#include "utils/booleanoptions.h"
#include "utils/chatutils.h"
-#include "utils/stringutils.h"
#include "debug.h"
diff --git a/src/actions/pets.cpp b/src/actions/pets.cpp
index 7e046758c..8f6d8833c 100644
--- a/src/actions/pets.cpp
+++ b/src/actions/pets.cpp
@@ -34,7 +34,9 @@
#include "listeners/inputactionreplaylistener.h"
#include "net/chathandler.h"
+#ifdef TMWA_SUPPORT
#include "net/net.h"
+#endif
#include "net/pethandler.h"
#include "net/serverfeatures.h"
@@ -61,10 +63,14 @@ static const Being *getPet()
return *pets.begin();
}
#endif
+#ifdef EATHENA_SUPPORT
const int id = PlayerInfo::getPetBeingId();
if (!id)
return nullptr;
return actorManager->findBeing(id);
+#else
+ return nullptr;
+#endif
}
impHandler(commandEmotePet)
diff --git a/src/actions/windows.cpp b/src/actions/windows.cpp
index eccc21d1d..6b359ff8d 100644
--- a/src/actions/windows.cpp
+++ b/src/actions/windows.cpp
@@ -22,11 +22,15 @@
#include "actions/actiondef.h"
+#ifdef EATHENA_SUPPORT
#include "being/localplayer.h"
+#endif
#include "gui/dialogsmanager.h"
+#ifdef EATHENA_SUPPORT
#include "gui/windows/bankwindow.h"
+#endif
#include "gui/windows/skilldialog.h"
#include "gui/windows/socialwindow.h"
#include "gui/windows/statuswindow.h"
@@ -48,9 +52,10 @@
#include "gui/windows/updaterwindow.h"
#include "gui/widgets/tabs/chat/chattab.h"
-#include "gui/widgets/tabs/chat/chattabtype.h"
+#ifdef EATHENA_SUPPORT
#include "net/serverfeatures.h"
+#endif
#include "debug.h"
diff --git a/src/actormanager.cpp b/src/actormanager.cpp
index 8222726f6..29548fb22 100644
--- a/src/actormanager.cpp
+++ b/src/actormanager.cpp
@@ -24,10 +24,7 @@
#include "configuration.h"
#include "settings.h"
-#include "main.h"
-#include "being/localplayer.h"
-#include "being/playerinfo.h"
#include "being/playerrelations.h"
#include "enums/being/attributes.h"
@@ -60,7 +57,6 @@
#include "resources/db/itemdb.h"
#include <algorithm>
-#include <list>
#include "debug.h"
diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp
index 9f21d4996..31e8ce7be 100644
--- a/src/being/actorsprite.cpp
+++ b/src/being/actorsprite.cpp
@@ -30,8 +30,6 @@
#include "gui/theme.h"
-#include "listeners/actorspritelistener.h"
-
#include "particle/particle.h"
#include "resources/resourcemanager.h"
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 9e9316417..468e2b066 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -42,7 +42,6 @@
#include "enums/net/packettypes.h"
-#include "particle/particle.h"
#include "particle/particleinfo.h"
#include "gui/gui.h"
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index cd9b642f0..a588246a2 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -25,10 +25,8 @@
#include "actormanager.h"
#include "animatedsprite.h"
#include "configuration.h"
-#include "dropshortcut.h"
#include "gamemodifiers.h"
#include "guild.h"
-#include "item.h"
#include "party.h"
#include "settings.h"
#include "soundconsts.h"
@@ -38,7 +36,6 @@
#include "being/beingflag.h"
#include "being/crazymoves.h"
-#include "being/playerinfo.h"
#include "being/playerrelations.h"
#include "enums/being/attributes.h"
@@ -69,7 +66,6 @@
#include "net/chathandler.h"
#include "net/inventoryhandler.h"
#include "net/packetlimiter.h"
-#include "net/pethandler.h"
#include "net/playerhandler.h"
#include "net/serverfeatures.h"
@@ -77,7 +73,6 @@
#include "resources/itemslot.h"
#include "resources/mapitemtype.h"
-#include "resources/db/emotedb.h"
#include "resources/db/weaponsdb.h"
#include "resources/map/map.h"
@@ -94,8 +89,6 @@
#include "mumblemanager.h"
#endif
-#include <climits>
-
#include "debug.h"
static const int16_t awayLimitTimer = 60;
diff --git a/src/being/playerinfo.cpp b/src/being/playerinfo.cpp
index dc7eb3732..ff4efb79d 100644
--- a/src/being/playerinfo.cpp
+++ b/src/being/playerinfo.cpp
@@ -21,17 +21,16 @@
#include "being/playerinfo.h"
-#include "client.h"
#include "configuration.h"
-#include "inventory.h"
#include "itemsoundmanager.h"
-#include "being/homunculusinfo.h"
#include "being/localplayer.h"
+
+#ifdef EATHENA_SUPPORT
+#include "being/homunculusinfo.h"
#include "being/mercenaryinfo.h"
#include "being/petinfo.h"
-
-#include "enums/inventorytype.h"
+#endif
#include "enums/being/attributes.h"
@@ -46,8 +45,6 @@
#include "utils/delete2.h"
-#include "listeners/statlistener.h"
-
#include "debug.h"
namespace PlayerInfo
@@ -59,11 +56,11 @@ int mCharId = 0;
Inventory *mInventory = nullptr;
#ifdef EATHENA_SUPPORT
Inventory *mCartInventory = nullptr;
-#endif
-Equipment *mEquipment = nullptr;
MercenaryInfo *mMercenary = nullptr;
HomunculusInfo *mHomunculus = nullptr;
PetInfo *mPet = nullptr;
+#endif
+Equipment *mEquipment = nullptr;
int mPetBeingId = 0;
GuildPositionFlags::Type mGuildPositionFlags = GuildPositionFlags::None;
@@ -394,7 +391,9 @@ void init()
void deinit()
{
clearInventory();
+#ifdef EATHENA_SUPPORT
delete2(mMercenary);
+#endif
mPetBeingId = 0;
}
@@ -477,6 +476,7 @@ bool isItemProtected(const int id)
return mProtectedItems.find(id) != mProtectedItems.end();
}
+#ifdef EATHENA_SUPPORT
void setMercenary(MercenaryInfo *const info)
{
if (mMercenary)
@@ -559,7 +559,6 @@ int getMercenaryId()
return mMercenary ? mMercenary->id : 0;
}
-#ifdef EATHENA_SUPPORT
void updateMoveAI()
{
if (mMercenary)
diff --git a/src/being/playerinfo.h b/src/being/playerinfo.h
index 49f4d54e5..20da29e44 100644
--- a/src/being/playerinfo.h
+++ b/src/being/playerinfo.h
@@ -239,6 +239,7 @@ namespace PlayerInfo
bool isItemProtected(const int id);
+#ifdef EATHENA_SUPPORT
MercenaryInfo *getMercenary();
void setMercenary(MercenaryInfo *const info);
@@ -263,7 +264,6 @@ namespace PlayerInfo
int getMercenaryId();
-#ifdef EATHENA_SUPPORT
void updateMoveAI();
void updateAttackAi(const int targetId, const bool keep);
diff --git a/src/being/playerrelations.cpp b/src/being/playerrelations.cpp
index f0d635561..22f685044 100644
--- a/src/being/playerrelations.cpp
+++ b/src/being/playerrelations.cpp
@@ -33,8 +33,6 @@
#include "listeners/playerrelationslistener.h"
-#include <algorithm>
-
#include "debug.h"
typedef std::map<std::string, PlayerRelation *> PlayerRelations;
diff --git a/src/client.cpp b/src/client.cpp
index 0d44fcbff..3fe4424b4 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -20,20 +20,20 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "main.h"
-
#include "client.h"
#include "chatlogger.h"
-#include "configmanager.h"
#include "configuration.h"
+#include "configmanager.h"
+#include "defaults.h"
#include "dirs.h"
#include "dropshortcut.h"
#include "emoteshortcut.h"
#include "eventsmanager.h"
#include "game.h"
-#include "guild.h"
+#ifdef TMWA_SUPPORT
#include "guildmanager.h"
+#endif
#include "graphicsmanager.h"
#include "itemshortcut.h"
#include "party.h"
@@ -57,7 +57,6 @@
#include "gui/gui.h"
#include "gui/skin.h"
#include "gui/popupmanager.h"
-#include "gui/theme.h"
#include "gui/windowmanager.h"
#include "gui/windows/changeemaildialog.h"
@@ -106,7 +105,6 @@
#include "resources/db/homunculusdb.h"
#include "resources/db/horsedb.h"
#include "resources/db/sounddb.h"
-#include "resources/db/itemdb.h"
#include "resources/db/mapdb.h"
#include "resources/db/mercenarydb.h"
#include "resources/db/moddb.h"
@@ -132,8 +130,10 @@
#include "listeners/errorlistener.h"
+#ifdef USE_OPENGL
#include "test/testlauncher.h"
#include "test/testmain.h"
+#endif
#ifdef __APPLE__
#include <CoreFoundation/CFBundle.h>
@@ -148,14 +148,12 @@
#ifdef ANDROID
#ifndef USE_SDL2
#include <SDL_screenkeyboard.h>
+#include <fstream>
#endif
#endif
#include <sys/stat.h>
-#include <climits>
-#include <fstream>
-
#ifdef USE_MUMBLE
#include "mumblemanager.h"
#endif
diff --git a/src/dyetool/dyemain.cpp b/src/dyetool/dyemain.cpp
index c9b21bcd0..9d20e1df6 100644
--- a/src/dyetool/dyemain.cpp
+++ b/src/dyetool/dyemain.cpp
@@ -24,7 +24,6 @@
#include "sdlshared.h"
#include "resources/image.h"
-#include "resources/imagehelper.h"
#include "resources/imagewriter.h"
#include "resources/resourcemanager.h"
#include "resources/sdlimagehelper.h"
diff --git a/src/eventsmanager.cpp b/src/eventsmanager.cpp
index a6ae45e9c..bf1bedc1d 100644
--- a/src/eventsmanager.cpp
+++ b/src/eventsmanager.cpp
@@ -23,7 +23,6 @@
#include "configuration.h"
#include "client.h"
#include "game.h"
-#include "logger.h"
#ifdef USE_MUMBLE
#include "mumblemanager.h"
#endif
diff --git a/src/game.cpp b/src/game.cpp
index a44c793c8..e3360ac77 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -22,8 +22,6 @@
#include "game.h"
-#include "main.h"
-
#include "actormanager.h"
#include "animatedsprite.h"
#include "client.h"
@@ -33,7 +31,9 @@
#include "emoteshortcut.h"
#include "eventsmanager.h"
#include "gamemodifiers.h"
+#ifdef TMWA_SUPPORT
#include "guildmanager.h"
+#endif
#include "itemshortcut.h"
#include "soundmanager.h"
#include "settings.h"
@@ -62,7 +62,9 @@
#include "gui/popups/popupmenu.h"
+#ifdef EATHENA_SUPPORT
#include "gui/windows/bankwindow.h"
+#endif
#include "gui/windows/botcheckerwindow.h"
#include "gui/windows/chatwindow.h"
#include "gui/windows/debugwindow.h"
@@ -120,9 +122,6 @@
#include "listeners/errorlistener.h"
-#include <sstream>
-#include <string>
-
#ifdef USE_MUMBLE
#include "mumblemanager.h"
#endif
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index 1d59a4a64..13a224ba4 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -21,44 +21,51 @@
#include "graphicsmanager.h"
#ifdef USE_OPENGL
-
#ifndef WIN32
#ifdef ANDROID
#include <GLES2/gl2.h>
#include <GLES/glext.h>
#include <EGL/egl.h>
+
#ifndef USE_SDL2
#include <SDL_android.h>
#endif // USE_SDL2
#else // ANDROID
#include <GL/glx.h>
#endif // ANDROID
-#else // WIN32
-#endif
+#endif // WIN32
#endif // USE_OPENGL
#include "configuration.h"
#include "logger.h"
+
+#ifdef DYECMD
+#include "configuration.h"
+#endif
+
#include "settings.h"
-#include "render/graphics.h"
+#ifdef USE_OPENGL
#include "render/mglcheck.h"
#include "render/mgl.h"
#include "render/mglemu.h"
#include "render/mobileopenglgraphics.h"
#include "render/modernopenglgraphics.h"
#include "render/normalopenglgraphics.h"
-#include "render/renderers.h"
#include "render/safeopenglgraphics.h"
+#endif
+#include "render/renderers.h"
#include "render/sdlgraphics.h"
+#ifdef USE_OPENGL
#include "resources/fboinfo.h"
-#include "resources/imagehelper.h"
#include "resources/openglimagehelper.h"
-#include "resources/sdlimagehelper.h"
#include "render/mglfunctions.h"
+#endif
+
+#include "resources/sdlimagehelper.h"
#ifdef USE_SDL2
#include "render/sdl2softwaregraphics.h"
@@ -69,9 +76,10 @@
#include "utils/delete2.h"
#include "utils/sdlhelper.h"
-#include "utils/stringutils.h"
+#ifdef USE_OPENGL
#include "test/testmain.h"
+#endif
#include <SDL_syswm.h>
diff --git a/src/graphicsvertexes.cpp b/src/graphicsvertexes.cpp
index 0f927ac84..9b30f52c5 100644
--- a/src/graphicsvertexes.cpp
+++ b/src/graphicsvertexes.cpp
@@ -20,7 +20,9 @@
#include "graphicsvertexes.h"
+#ifdef USE_OPENGL
#include "render/graphics.h"
+#endif
#include "utils/dtor.h"
diff --git a/src/gui/dialogsmanager.cpp b/src/gui/dialogsmanager.cpp
index f415e2cd2..5081ed124 100644
--- a/src/gui/dialogsmanager.cpp
+++ b/src/gui/dialogsmanager.cpp
@@ -34,8 +34,6 @@
#include "gui/windows/confirmdialog.h"
#include "gui/windows/buyselldialog.h"
#include "gui/windows/buydialog.h"
-#include "gui/windows/npcdialog.h"
-#include "gui/windows/okdialog.h"
#include "gui/windows/updaterwindow.h"
#include "listeners/playerpostdeathlistener.h"
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 0578b188b..b5b1ab414 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -66,16 +66,13 @@
#include "gui/gui.h"
#include "gui/focushandler.h"
-#include "gui/palette.h"
#include "gui/sdlinput.h"
-#include "gui/theme.h"
#include "gui/viewport.h"
#include "gui/fonts/font.h"
#include "gui/widgets/window.h"
-#include "configuration.h"
#include "dragdrop.h"
#include "settings.h"
#include "touchmanager.h"
@@ -83,14 +80,9 @@
#include "listeners/focuslistener.h"
#include "listeners/guiconfiglistener.h"
#include "listeners/keylistener.h"
-#include "listeners/mouselistener.h"
#include "input/inputmanager.h"
-#include "input/keyinput.h"
-#include "input/mouseinput.h"
-#include "resources/cursor.h"
-#include "resources/image.h"
#include "resources/imageset.h"
#include "resources/resourcemanager.h"
diff --git a/src/gui/models/skillmodel.cpp b/src/gui/models/skillmodel.cpp
index 9827b78c2..8bb1bdbf8 100644
--- a/src/gui/models/skillmodel.cpp
+++ b/src/gui/models/skillmodel.cpp
@@ -24,8 +24,6 @@
#include "gui/widgets/skilldata.h"
-#include <string>
-
#include "debug.h"
SkillModel::SkillModel() :
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index f6e848ce5..bc6c1fac8 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -25,8 +25,9 @@
#include "actormanager.h"
#include "configuration.h"
#include "gamemodifiers.h"
-#include "guild.h"
+#ifdef TMWA_SUPPORT
#include "guildmanager.h"
+#endif
#include "item.h"
#include "party.h"
#include "spellmanager.h"
@@ -54,12 +55,10 @@
#include "gui/windowmenu.h"
#include "gui/widgets/button.h"
-#include "gui/widgets/browserbox.h"
#include "gui/widgets/progressbar.h"
#include "gui/widgets/scrollarea.h"
#include "gui/widgets/textfield.h"
-#include "gui/widgets/tabs/chat/chattab.h"
#include "gui/widgets/tabs/chat/whispertab.h"
#include "net/adminhandler.h"
@@ -87,8 +86,6 @@
#include "utils/gettext.h"
#include "utils/process.h"
-#include "gui/models/listmodel.h"
-
#include "debug.h"
std::string tradePartnerName;
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index 0b41cad40..a508897d3 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -40,7 +40,6 @@
#include "gui/windows/chatwindow.h"
-#include "resources/image.h"
#include "resources/mapitemtype.h"
#include "resources/map/map.h"
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index 1657968df..4862e07a3 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -45,10 +45,6 @@
#include "utils/timer.h"
#include "utils/translation/podict.h"
-#include "gui/cliprect.h"
-
-#include "render/graphics.h"
-
#include <algorithm>
#include "debug.h"
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp
index f228df029..39b09ae0b 100644
--- a/src/gui/widgets/button.cpp
+++ b/src/gui/widgets/button.cpp
@@ -76,7 +76,6 @@
#include "gui/gui.h"
#include "gui/skin.h"
-#include "gui/rect.h"
#include "gui/fonts/font.h"
diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp
index 3f79d1531..291c77852 100644
--- a/src/gui/widgets/desktop.cpp
+++ b/src/gui/widgets/desktop.cpp
@@ -22,7 +22,6 @@
#include "gui/widgets/desktop.h"
#include "configuration.h"
-#include "main.h"
#include "gui/skin.h"
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index b9d6f096c..3977931b6 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -35,11 +35,8 @@
#include "gui/widgets/popuplist.h"
-#include "resources/image.h"
#include "resources/imagerect.h"
-#include <algorithm>
-
#include "debug.h"
int DropDown::instances = 0;
diff --git a/src/gui/widgets/extendedlistbox.cpp b/src/gui/widgets/extendedlistbox.cpp
index b9a9abf32..41400c1a6 100644
--- a/src/gui/widgets/extendedlistbox.cpp
+++ b/src/gui/widgets/extendedlistbox.cpp
@@ -26,10 +26,6 @@
#include "gui/fonts/font.h"
-#include "gui/models/listmodel.h"
-
-#include "render/graphics.h"
-
#include "debug.h"
ExtendedListBox::ExtendedListBox(const Widget2 *const widget,
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 0bb8c50f3..9728c0e7f 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -23,8 +23,6 @@
#include "gui/widgets/itemcontainer.h"
#include "dragdrop.h"
-#include "inventory.h"
-#include "item.h"
#include "itemshortcut.h"
#include "being/playerinfo.h"
@@ -47,11 +45,8 @@
#include "utils/gettext.h"
#include "utils/stringutils.h"
-#include "resources/image.h"
#include "resources/iteminfo.h"
-#include "listeners/selectionlistener.h"
-
#include <algorithm>
#include "debug.h"
diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp
index 19088782b..4cb998c69 100644
--- a/src/gui/widgets/itemlinkhandler.cpp
+++ b/src/gui/widgets/itemlinkhandler.cpp
@@ -37,8 +37,6 @@
#include "listeners/openurllistener.h"
-#include <string>
-
#include "debug.h"
namespace
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index c11a83f8c..775062ce1 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -23,8 +23,6 @@
#include "gui/widgets/itemshortcutcontainer.h"
#include "dragdrop.h"
-#include "inventory.h"
-#include "item.h"
#include "itemshortcut.h"
#include "settings.h"
#include "spellshortcut.h"
@@ -44,9 +42,6 @@
#include "gui/windows/inventorywindow.h"
#include "gui/windows/skilldialog.h"
-#include "gui/widgets/skillinfo.h"
-
-#include "resources/image.h"
#include "resources/skillconsts.h"
#include "utils/stringutils.h"
diff --git a/src/gui/widgets/layoutarray.cpp b/src/gui/widgets/layoutarray.cpp
index 92af206fb..f025769e8 100644
--- a/src/gui/widgets/layoutarray.cpp
+++ b/src/gui/widgets/layoutarray.cpp
@@ -22,8 +22,6 @@
#include "gui/widgets/layoutarray.h"
-#include "logger.h"
-
#include "gui/widgets/layoutcell.h"
#include "gui/widgets/layouttype.h"
#include "gui/widgets/widget.h"
diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp
index 4775e266f..2d07460c4 100644
--- a/src/gui/widgets/playerbox.cpp
+++ b/src/gui/widgets/playerbox.cpp
@@ -29,8 +29,6 @@
#include "gui/gui.h"
#include "gui/skin.h"
-#include "resources/image.h"
-
#include "debug.h"
PlayerBox::PlayerBox(Widget2 *const widget,
diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp
index ff1370c0b..98dadd046 100644
--- a/src/gui/widgets/setupitem.cpp
+++ b/src/gui/widgets/setupitem.cpp
@@ -21,7 +21,6 @@
#include "gui/widgets/setupitem.h"
#include "configuration.h"
-#include "main.h"
#include "soundmanager.h"
#include "gui/gui.h"
diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp
index 97ace4181..b4799a218 100644
--- a/src/gui/widgets/shoplistbox.cpp
+++ b/src/gui/widgets/shoplistbox.cpp
@@ -38,8 +38,6 @@
#include "resources/image.h"
-#include "gui/models/listmodel.h"
-
#include "debug.h"
const int ITEM_ICON_SIZE = 32;
diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp
index 211dd6b4e..a22cb7f6e 100644
--- a/src/gui/widgets/spellshortcutcontainer.cpp
+++ b/src/gui/widgets/spellshortcutcontainer.cpp
@@ -36,8 +36,6 @@
#include "gui/windows/shortcutwindow.h"
-#include "resources/image.h"
-
#include "debug.h"
SpellShortcutContainer::SpellShortcutContainer(Widget2 *const widget,
diff --git a/src/gui/widgets/tabs/chat/guildtab.cpp b/src/gui/widgets/tabs/chat/guildtab.cpp
index 341513852..0b220594a 100644
--- a/src/gui/widgets/tabs/chat/guildtab.cpp
+++ b/src/gui/widgets/tabs/chat/guildtab.cpp
@@ -23,7 +23,6 @@
#include "gui/widgets/tabs/chat/guildtab.h"
#include "configuration.h"
-#include "guild.h"
#include "soundconsts.h"
#include "soundmanager.h"
diff --git a/src/gui/widgets/tabs/debugwindowtabs.cpp b/src/gui/widgets/tabs/debugwindowtabs.cpp
index 7c5adcd66..faccf9b2e 100644
--- a/src/gui/widgets/tabs/debugwindowtabs.cpp
+++ b/src/gui/widgets/tabs/debugwindowtabs.cpp
@@ -32,10 +32,11 @@
#include "gui/widgets/containerplacer.h"
#include "gui/widgets/label.h"
-#include "gui/widgets/layoutcell.h"
#include "gui/widgets/layouthelper.h"
+#ifdef USE_OPENGL
#include "resources/imagehelper.h"
+#endif
#include "resources/map/map.h"
diff --git a/src/gui/widgets/tabs/setup_audio.cpp b/src/gui/widgets/tabs/setup_audio.cpp
index cf278b76e..e913f611c 100644
--- a/src/gui/widgets/tabs/setup_audio.cpp
+++ b/src/gui/widgets/tabs/setup_audio.cpp
@@ -22,8 +22,6 @@
#include "gui/widgets/tabs/setup_audio.h"
-#include "main.h"
-
#include "resources/map/map.h"
#include "configuration.h"
diff --git a/src/gui/widgets/tabs/setup_colors.cpp b/src/gui/widgets/tabs/setup_colors.cpp
index b93cf3ed5..28d52db0b 100644
--- a/src/gui/widgets/tabs/setup_colors.cpp
+++ b/src/gui/widgets/tabs/setup_colors.cpp
@@ -40,7 +40,6 @@
#include "utils/gettext.h"
#include "utils/stringutils.h"
-#include <string>
#include <cmath>
#include "debug.h"
diff --git a/src/gui/widgets/tabs/setup_theme.cpp b/src/gui/widgets/tabs/setup_theme.cpp
index 47d985a3e..de4990e5c 100644
--- a/src/gui/widgets/tabs/setup_theme.cpp
+++ b/src/gui/widgets/tabs/setup_theme.cpp
@@ -43,7 +43,6 @@
#include "configuration.h"
#include "utils/delete2.h"
-#include "utils/gettext.h"
#include "debug.h"
diff --git a/src/gui/widgets/tabs/setup_touch.cpp b/src/gui/widgets/tabs/setup_touch.cpp
index bd0f17411..0a0b97728 100644
--- a/src/gui/widgets/tabs/setup_touch.cpp
+++ b/src/gui/widgets/tabs/setup_touch.cpp
@@ -20,7 +20,6 @@
#include "gui/widgets/tabs/setup_touch.h"
-#include "gui/models/namesmodel.h"
#include "gui/models/touchactionmodel.h"
#include "gui/widgets/containerplacer.h"
diff --git a/src/gui/widgets/tabs/setup_video.cpp b/src/gui/widgets/tabs/setup_video.cpp
index 696927b6b..3f88316c8 100644
--- a/src/gui/widgets/tabs/setup_video.cpp
+++ b/src/gui/widgets/tabs/setup_video.cpp
@@ -24,8 +24,6 @@
#include "configuration.h"
-#include "graphicsmanager.h"
-
#include "enums/gui/dialogtype.h"
#include "gui/windowmanager.h"
@@ -43,12 +41,13 @@
#include "gui/widgets/slider.h"
#include "gui/widgets/dropdown.h"
-#include "render/rendererslistsdl.h"
-
#include "utils/delete2.h"
-#include "utils/gettext.h"
+
+#if defined(USE_OPENGL) && !defined(ANDROID) && !defined(__APPLE__)
+#include "graphicsmanager.h"
#include "test/testmain.h"
+#endif
#include "gui/models/modelistmodel.h"
#include "gui/models/opengllistmodel.h"
diff --git a/src/gui/widgets/virtshortcutcontainer.cpp b/src/gui/widgets/virtshortcutcontainer.cpp
index b735f962e..4b03d8890 100644
--- a/src/gui/widgets/virtshortcutcontainer.cpp
+++ b/src/gui/widgets/virtshortcutcontainer.cpp
@@ -37,8 +37,6 @@
#include "gui/windows/inventorywindow.h"
-#include "resources/image.h"
-
#include "utils/stringutils.h"
#include "debug.h"
diff --git a/src/gui/widgets/widget.cpp b/src/gui/widgets/widget.cpp
index 7079f054f..667f88655 100644
--- a/src/gui/widgets/widget.cpp
+++ b/src/gui/widgets/widget.cpp
@@ -67,8 +67,6 @@
#include "gui/widgets/widget.h"
-#include "events/actionevent.h"
-
#include "gui/focushandler.h"
#include "listeners/actionlistener.h"
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index d16ce9853..82cd77a0d 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -87,9 +87,6 @@
#include "gui/widgets/containerplacer.h"
#include "gui/widgets/layout.h"
-#include "resources/cursor.h"
-#include "resources/image.h"
-
#include "utils/delete2.h"
#include "debug.h"
diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp
index 1c2b21d89..7fc8be84c 100644
--- a/src/gui/windowmenu.cpp
+++ b/src/gui/windowmenu.cpp
@@ -41,8 +41,6 @@
#include "utils/dtor.h"
#include "utils/gettext.h"
-#include <string>
-
#include "debug.h"
WindowMenu *windowMenu = nullptr;
diff --git a/src/gui/windows/botcheckerwindow.cpp b/src/gui/windows/botcheckerwindow.cpp
index 8627b147f..a7fd4ea44 100644
--- a/src/gui/windows/botcheckerwindow.cpp
+++ b/src/gui/windows/botcheckerwindow.cpp
@@ -24,9 +24,7 @@
#include "gui/windows/setupwindow.h"
-#include "gui/widgets/button.h"
#include "gui/widgets/scrollarea.h"
-#include "gui/widgets/label.h"
#include "gui/widgets/guitable.h"
#include "gui/models/userstablemodel.h"
diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp
index ce6775637..b885cc8a6 100644
--- a/src/gui/windows/buydialog.cpp
+++ b/src/gui/windows/buydialog.cpp
@@ -26,7 +26,6 @@
#include "actormanager.h"
#endif
#include "configuration.h"
-#include "shopitem.h"
#include "units.h"
#include "gui/windows/setupwindow.h"
diff --git a/src/gui/windows/changeemaildialog.cpp b/src/gui/windows/changeemaildialog.cpp
index 550e3c941..822947c22 100644
--- a/src/gui/windows/changeemaildialog.cpp
+++ b/src/gui/windows/changeemaildialog.cpp
@@ -34,15 +34,11 @@
#include "listeners/wrongdatanoticelistener.h"
-#include "net/logindata.h"
#include "net/loginhandler.h"
#include "utils/delete2.h"
#include "utils/gettext.h"
-#include <string>
-#include <sstream>
-
#include "debug.h"
ChangeEmailDialog::ChangeEmailDialog(LoginData *const data) :
diff --git a/src/gui/windows/changepassworddialog.cpp b/src/gui/windows/changepassworddialog.cpp
index 9c2abef21..049f00a5e 100644
--- a/src/gui/windows/changepassworddialog.cpp
+++ b/src/gui/windows/changepassworddialog.cpp
@@ -35,15 +35,11 @@
#include "listeners/wrongdatanoticelistener.h"
-#include "net/logindata.h"
#include "net/loginhandler.h"
#include "utils/delete2.h"
#include "utils/gettext.h"
-#include <string>
-#include <sstream>
-
#include "debug.h"
ChangePasswordDialog::ChangePasswordDialog(LoginData *const data) :
diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp
index 1452433d6..cb2caed4b 100644
--- a/src/gui/windows/charcreatedialog.cpp
+++ b/src/gui/windows/charcreatedialog.cpp
@@ -23,7 +23,6 @@
#include "gui/windows/charcreatedialog.h"
#include "configuration.h"
-#include "main.h"
#include "input/inputaction.h"
@@ -49,7 +48,6 @@
#include "utils/delete2.h"
#include "utils/gettext.h"
-#include "utils/stringutils.h"
#include "debug.h"
diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp
index adfb46d63..85a23ed64 100644
--- a/src/gui/windows/charselectdialog.cpp
+++ b/src/gui/windows/charselectdialog.cpp
@@ -31,7 +31,9 @@
#include "input/inputaction.h"
#include "listeners/charrenamelistener.h"
+#ifdef EATHENA_SUPPORT
#include "listeners/pincodelistener.h"
+#endif
#include "enums/gui/dialogtype.h"
@@ -49,7 +51,6 @@
#include "gui/widgets/containerplacer.h"
#include "net/character.h"
-#include "net/logindata.h"
#include "net/loginhandler.h"
#include "net/registrationoptions.h"
#include "net/serverfeatures.h"
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index b1c0f6982..748114b10 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -23,7 +23,6 @@
#include "gui/windows/chatwindow.h"
#include "actormanager.h"
-#include "configuration.h"
#include "game.h"
#include "guild.h"
#include "party.h"
@@ -48,7 +47,6 @@
#include "gui/popups/popupmenu.h"
-#include "gui/windows/emotewindow.h"
#include "gui/windows/setupwindow.h"
#include "gui/windows/whoisonline.h"
@@ -74,9 +72,6 @@
#include "utils/copynpaste.h"
#include "utils/delete2.h"
#include "utils/files.h"
-#include "utils/gettext.h"
-
-#include <sstream>
#include <sys/stat.h>
diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp
index f26a877cf..0b5fe10f1 100644
--- a/src/gui/windows/equipmentwindow.cpp
+++ b/src/gui/windows/equipmentwindow.cpp
@@ -25,10 +25,7 @@
#include "configuration.h"
#include "dragdrop.h"
#include "graphicsvertexes.h"
-#include "inventory.h"
-#include "item.h"
-#include "being/being.h"
#include "being/localplayer.h"
#include "being/playerinfo.h"
diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp
index a47d2a931..bf3077c1d 100644
--- a/src/gui/windows/inventorywindow.cpp
+++ b/src/gui/windows/inventorywindow.cpp
@@ -23,7 +23,6 @@
#include "gui/windows/inventorywindow.h"
#include "configuration.h"
-#include "item.h"
#include "units.h"
#include "being/playerinfo.h"
@@ -64,8 +63,6 @@
#include "utils/delete2.h"
-#include <string>
-
#include "debug.h"
InventoryWindow *inventoryWindow = nullptr;
diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp
index 1369a0686..01289a4c3 100644
--- a/src/gui/windows/itemamountwindow.cpp
+++ b/src/gui/windows/itemamountwindow.cpp
@@ -22,8 +22,6 @@
#include "gui/windows/itemamountwindow.h"
-#include "item.h"
-
#include "being/playerinfo.h"
#include "input/keyboardconfig.h"
diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp
index 8fcb175ef..965f1d71c 100644
--- a/src/gui/windows/minimap.cpp
+++ b/src/gui/windows/minimap.cpp
@@ -37,7 +37,6 @@
#include "gui/windows/setupwindow.h"
-#include "resources/image.h"
#include "resources/imagehelper.h"
#include "resources/resourcemanager.h"
diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp
index ec2cf05b2..7051465c6 100644
--- a/src/gui/windows/ministatuswindow.cpp
+++ b/src/gui/windows/ministatuswindow.cpp
@@ -27,7 +27,6 @@
#include "inventory.h"
#include "being/localplayer.h"
-#include "being/playerinfo.h"
#include "enums/being/attributes.h"
diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp
index 096ab1c39..6207a9bd7 100644
--- a/src/gui/windows/npcdialog.cpp
+++ b/src/gui/windows/npcdialog.cpp
@@ -24,7 +24,6 @@
#include "actormanager.h"
#include "configuration.h"
-#include "inventory.h"
#include "item.h"
#include "settings.h"
#include "soundconsts.h"
diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp
index 3a0f26d64..59734edca 100644
--- a/src/gui/windows/outfitwindow.cpp
+++ b/src/gui/windows/outfitwindow.cpp
@@ -27,7 +27,6 @@
#include "emoteshortcutconsts.h"
#include "game.h"
#include "inventory.h"
-#include "item.h"
#include "being/playerinfo.h"
@@ -45,12 +44,8 @@
#include "gui/widgets/layout.h"
#include "gui/widgets/layouttype.h"
-#include "resources/image.h"
-
#include "utils/gettext.h"
-#include <vector>
-
#include "debug.h"
OutfitWindow *outfitWindow = nullptr;
diff --git a/src/gui/windows/registerdialog.cpp b/src/gui/windows/registerdialog.cpp
index fdddfec6f..8d7d84480 100644
--- a/src/gui/windows/registerdialog.cpp
+++ b/src/gui/windows/registerdialog.cpp
@@ -39,7 +39,6 @@
#include "gui/widgets/passwordfield.h"
#include "gui/widgets/radiobutton.h"
-#include "net/logindata.h"
#include "net/loginhandler.h"
#include "net/registrationoptions.h"
#include "net/serverfeatures.h"
diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp
index 8afbf0e54..a5f8efb95 100644
--- a/src/gui/windows/serverdialog.cpp
+++ b/src/gui/windows/serverdialog.cpp
@@ -25,19 +25,12 @@
#include "chatlogger.h"
#include "client.h"
#include "configuration.h"
-#include "main.h"
#include "settings.h"
#include "input/inputaction.h"
#include "net/download.h"
-#include "gui/gui.h"
-
-#include "gui/fonts/font.h"
-
-#include "gui/models/serverslistmodel.h"
-
#include "gui/widgets/checkbox.h"
#include "gui/widgets/desktop.h"
#include "gui/windows/editserverdialog.h"
@@ -46,7 +39,6 @@
#include "gui/widgets/button.h"
#include "gui/widgets/label.h"
#include "gui/widgets/layout.h"
-#include "gui/widgets/listbox.h"
#include "gui/widgets/serverslistbox.h"
#include "gui/widgets/scrollarea.h"
@@ -54,8 +46,6 @@
#include "utils/gettext.h"
#include "utils/langs.h"
-#include <string>
-
#include "debug.h"
static const int MAX_SERVERLIST = 15;
diff --git a/src/gui/windows/setupwindow.cpp b/src/gui/windows/setupwindow.cpp
index 8e5c61e02..3f04d0e69 100644
--- a/src/gui/windows/setupwindow.cpp
+++ b/src/gui/windows/setupwindow.cpp
@@ -24,7 +24,6 @@
#include "configuration.h"
#include "game.h"
-#include "main.h"
#include "touchmanager.h"
#include "gui/windows/chatwindow.h"
diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp
index 4cb922519..9a4fd7729 100644
--- a/src/gui/windows/shopwindow.cpp
+++ b/src/gui/windows/shopwindow.cpp
@@ -22,16 +22,24 @@
#include "gui/windows/shopwindow.h"
-#include "gui/chatconsts.h"
+#include "enums/being/attributes.h"
+#ifdef TMWA_SUPPORT
#include "gui/windows/buydialog.h"
#include "gui/windows/chatwindow.h"
#include "gui/windows/confirmdialog.h"
+#include "gui/windows/shopselldialog.h"
+#include "gui/windows/tradewindow.h"
+
+#include "gui/chatconsts.h"
+#endif
+
+#ifdef EATHENA_SUPPORT
#include "gui/windows/editdialog.h"
+#endif
+
#include "gui/windows/itemamountwindow.h"
-#include "gui/windows/shopselldialog.h"
#include "gui/windows/setupwindow.h"
-#include "gui/windows/tradewindow.h"
#include "gui/models/shopitems.h"
@@ -44,34 +52,41 @@
#include "gui/widgets/shoplistbox.h"
#include "gui/widgets/tabstrip.h"
+#ifdef EATHENA_SUPPORT
#include "listeners/shoprenamelistener.h"
+#endif
+#ifdef TMWA_SUPPORT
#include "actormanager.h"
+#include "soundmanager.h"
+#endif
#include "configuration.h"
#include "inventory.h"
-#include "item.h"
#include "settings.h"
#include "shopitem.h"
-#include "soundmanager.h"
#include "being/localplayer.h"
#include "being/playerinfo.h"
-#include "being/playerrelations.h"
-
-#include "enums/being/attributes.h"
+#ifdef TMWA_SUPPORT
+#include "being/playerrelations.h"
#include "net/chathandler.h"
+#endif
+#ifdef EATHENA_SUPPORT
#include "net/buyingstorehandler.h"
+#include "net/vendinghandler.h"
+#endif
#include "net/serverfeatures.h"
+#ifdef TMWA_SUPPORT
#include "net/tradehandler.h"
-#include "net/vendinghandler.h"
-
-#include "resources/iteminfo.h"
+#endif
#include "utils/delete2.h"
#include "utils/gettext.h"
-#include <sstream>
+#ifdef TMWA_SUPPORT
+#include "resources/iteminfo.h"
+#endif
#include <sys/stat.h>
diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp
index 681ed348f..48ab6bba4 100644
--- a/src/gui/windows/skilldialog.cpp
+++ b/src/gui/windows/skilldialog.cpp
@@ -31,13 +31,10 @@
#include "enums/being/attributes.h"
-#include "gui/models/skillmodel.h"
-
#include "gui/windows/setupwindow.h"
#include "gui/windows/shortcutwindow.h"
#include "gui/widgets/button.h"
-#include "gui/widgets/skilllistbox.h"
#include "gui/widgets/label.h"
#include "gui/widgets/scrollarea.h"
#include "gui/widgets/tabbedarea.h"
@@ -52,7 +49,6 @@
#include "utils/timer.h"
#include "resources/beingcommon.h"
-#include "resources/skillconsts.h"
#include "debug.h"
diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp
index b359bc775..ad1745287 100644
--- a/src/gui/windows/socialwindow.cpp
+++ b/src/gui/windows/socialwindow.cpp
@@ -21,23 +21,17 @@
#include "gui/windows/socialwindow.h"
-#include "configuration.h"
-#include "guild.h"
+#ifdef TMWA_SUPPORT
#include "guildmanager.h"
-
-#include "being/localplayer.h"
-#include "being/playerrelations.h"
+#endif
#include "enums/gui/dialogtype.h"
-#include "gui/windows/confirmdialog.h"
#include "gui/windows/okdialog.h"
#include "gui/windows/setupwindow.h"
-#include "gui/windows/textdialog.h"
#include "gui/widgets/button.h"
#include "gui/widgets/label.h"
-#include "gui/widgets/scrollarea.h"
#include "gui/widgets/tabbedarea.h"
#include "gui/widgets/tabs/socialattacktab.h"
diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp
index d16262cc1..2c66884ae 100644
--- a/src/gui/windows/statuswindow.cpp
+++ b/src/gui/windows/statuswindow.cpp
@@ -24,15 +24,12 @@
#include "configuration.h"
#include "gamemodifiers.h"
-#include "inventory.h"
-#include "item.h"
#include "settings.h"
#include "units.h"
#include "gui/windows/chatwindow.h"
#include "being/localplayer.h"
-#include "being/playerinfo.h"
#include "enums/being/attributes.h"
@@ -41,7 +38,6 @@
#include "gui/widgets/button.h"
#include "gui/widgets/containerplacer.h"
-#include "gui/widgets/label.h"
#include "gui/widgets/layouthelper.h"
#include "gui/widgets/layouttype.h"
#include "gui/widgets/progressbar.h"
diff --git a/src/gui/windows/textcommandeditor.cpp b/src/gui/windows/textcommandeditor.cpp
index 641df6f3f..e5dbb26b7 100644
--- a/src/gui/windows/textcommandeditor.cpp
+++ b/src/gui/windows/textcommandeditor.cpp
@@ -22,7 +22,6 @@
#include "gui/windows/textcommandeditor.h"
-#include "main.h"
#include "spellmanager.h"
#include "input/keyboardconfig.h"
diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp
index ef2897ccd..5d95c0a4f 100644
--- a/src/gui/windows/tradewindow.cpp
+++ b/src/gui/windows/tradewindow.cpp
@@ -23,7 +23,6 @@
#include "gui/windows/tradewindow.h"
#include "configuration.h"
-#include "inventory.h"
#include "item.h"
#include "units.h"
diff --git a/src/gui/windows/unregisterdialog.cpp b/src/gui/windows/unregisterdialog.cpp
index 9174a0a65..5dc99f720 100644
--- a/src/gui/windows/unregisterdialog.cpp
+++ b/src/gui/windows/unregisterdialog.cpp
@@ -34,15 +34,11 @@
#include "listeners/wrongdatanoticelistener.h"
-#include "net/logindata.h"
#include "net/loginhandler.h"
#include "utils/delete2.h"
#include "utils/gettext.h"
-#include <string>
-#include <sstream>
-
#include "debug.h"
UnRegisterDialog::UnRegisterDialog(LoginData *const data) :
diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp
index 59034cd80..5ea107f35 100644
--- a/src/gui/windows/updaterwindow.cpp
+++ b/src/gui/windows/updaterwindow.cpp
@@ -53,8 +53,6 @@
#include "utils/paths.h"
#include "utils/process.h"
-#include <fstream>
-
#include <sys/stat.h>
#include "debug.h"
diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp
index 7772f04b3..88e4441be 100644
--- a/src/gui/windows/whoisonline.cpp
+++ b/src/gui/windows/whoisonline.cpp
@@ -26,7 +26,9 @@
#include "configuration.h"
#include "guild.h"
#include "party.h"
+#ifdef TMWA_SUPPORT
#include "settings.h"
+#endif
#include "gui/onlineplayer.h"
#include "gui/popupmanager.h"
@@ -48,7 +50,9 @@
#include "enums/net/packettypes.h"
+#ifdef TMWA_SUPPORT
#include "net/download.h"
+#endif
#include "net/packetlimiter.h"
#include "net/playerhandler.h"
#include "net/serverfeatures.h"
@@ -56,10 +60,6 @@
#include "utils/gettext.h"
#include "utils/sdlhelper.h"
-#include <SDL_thread.h>
-#include <vector>
-#include <algorithm>
-
// Curl should be included after Guichan to avoid Windows redefinitions
#include <curl/curl.h>
diff --git a/src/input/keyboardconfig.cpp b/src/input/keyboardconfig.cpp
index 319d6d8ed..9229d4184 100644
--- a/src/input/keyboardconfig.cpp
+++ b/src/input/keyboardconfig.cpp
@@ -29,8 +29,6 @@
#include "utils/gettext.h"
-#include <SDL_events.h>
-
#include "debug.h"
extern volatile int tick_time;
diff --git a/src/inventory.cpp b/src/inventory.cpp
index fea581446..0129e7593 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -22,7 +22,6 @@
#include "inventory.h"
-#include "item.h"
#include "logger.h"
#include "net/inventoryhandler.h"
@@ -36,8 +35,6 @@
#include "utils/stringutils.h"
#include <algorithm>
-#include <functional>
-#include <string>
#include "debug.h"
diff --git a/src/item.cpp b/src/item.cpp
index 276a2f49a..d42a11859 100644
--- a/src/item.cpp
+++ b/src/item.cpp
@@ -26,7 +26,6 @@
#include "gui/theme.h"
-#include "resources/image.h"
#include "resources/iteminfo.h"
#include "resources/resourcemanager.h"
#include "configuration.h"
diff --git a/src/itemshortcut.cpp b/src/itemshortcut.cpp
index 4e0e53f36..10a05824d 100644
--- a/src/itemshortcut.cpp
+++ b/src/itemshortcut.cpp
@@ -25,7 +25,6 @@
#include "configuration.h"
#include "inventory.h"
#include "item.h"
-#include "logger.h"
#include "spellmanager.h"
#include "being/playerinfo.h"
diff --git a/src/listeners/guitableactionlistener.cpp b/src/listeners/guitableactionlistener.cpp
index 288eee00a..d08e4c9f8 100644
--- a/src/listeners/guitableactionlistener.cpp
+++ b/src/listeners/guitableactionlistener.cpp
@@ -23,7 +23,6 @@
#include "listeners/guitableactionlistener.h"
#include "gui/widgets/guitable.h"
-#include "gui/widgets/widget.h"
#include "debug.h"
diff --git a/src/logger.cpp b/src/logger.cpp
index 54357e828..d5d1c3e3b 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -29,7 +29,6 @@
#include "utils/stringutils.h"
#include <iostream>
-#include <sstream>
#ifdef WIN32
#include <windows.h>
diff --git a/src/main.cpp b/src/main.cpp
index 1d1be8fff..a17c4302b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -33,7 +33,6 @@
#endif
#include "utils/paths.h"
#include "utils/physfscheckutils.h"
-#include "utils/physfstools.h"
#include "utils/physfsrwops.h"
#include "utils/process.h"
#include "utils/xml.h"
diff --git a/src/net/download.cpp b/src/net/download.cpp
index 8df51c48e..9e86d5ea1 100644
--- a/src/net/download.cpp
+++ b/src/net/download.cpp
@@ -23,7 +23,6 @@
#include "configuration.h"
#include "logger.h"
-#include "main.h"
#include "settings.h"
#include "utils/files.h"
diff --git a/src/net/ea/adminhandler.cpp b/src/net/ea/adminhandler.cpp
index 3db91296a..6158d5d42 100644
--- a/src/net/ea/adminhandler.cpp
+++ b/src/net/ea/adminhandler.cpp
@@ -34,8 +34,6 @@
#include "resources/notifytypes.h"
-#include <string>
-
#include "debug.h"
namespace Ea
diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp
index 68a9fdbdf..95d05bf1e 100644
--- a/src/net/ea/chathandler.cpp
+++ b/src/net/ea/chathandler.cpp
@@ -27,23 +27,17 @@
#include "notifymanager.h"
#include "being/being.h"
-#include "being/playerrelations.h"
#include "gui/windows/chatwindow.h"
#include "gui/widgets/tabs/chat/gmtab.h"
#include "net/messagein.h"
-#include "net/serverfeatures.h"
-
-#include "net/ea/eaprotocol.h"
#include "resources/notifytypes.h"
#include "utils/gettext.h"
-#include <string>
-
#include "debug.h"
namespace Ea
diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp
index 670daf1a0..c182d7065 100644
--- a/src/net/ea/loginhandler.cpp
+++ b/src/net/ea/loginhandler.cpp
@@ -24,7 +24,6 @@
#include "client.h"
#include "configuration.h"
-#include "logger.h"
#include "settings.h"
#include "being/being.h"
diff --git a/src/net/ea/network.cpp b/src/net/ea/network.cpp
index a214cc4e5..fd39e218b 100644
--- a/src/net/ea/network.cpp
+++ b/src/net/ea/network.cpp
@@ -28,8 +28,6 @@
#include "utils/gettext.h"
#include "utils/sdlhelper.h"
-#include <sstream>
-
#include "debug.h"
extern unsigned int mLastHost;
diff --git a/src/net/ea/tradehandler.cpp b/src/net/ea/tradehandler.cpp
index 9bcbf8548..683654d61 100644
--- a/src/net/ea/tradehandler.cpp
+++ b/src/net/ea/tradehandler.cpp
@@ -25,9 +25,7 @@
#include "notifymanager.h"
#include "being/playerinfo.h"
-#include "being/playerrelations.h"
-#include "gui/windows/confirmdialog.h"
#include "gui/windows/tradewindow.h"
#include "net/messagein.h"
diff --git a/src/net/eathena/adminhandler.cpp b/src/net/eathena/adminhandler.cpp
index 1eb0b6eac..1e394d300 100644
--- a/src/net/eathena/adminhandler.cpp
+++ b/src/net/eathena/adminhandler.cpp
@@ -27,8 +27,6 @@
#include "net/eathena/messageout.h"
#include "net/eathena/protocol.h"
-#include <string>
-
#include "debug.h"
extern Net::AdminHandler *adminHandler;
diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp
index 5096fb3aa..b4d3a6382 100644
--- a/src/net/eathena/charserverhandler.cpp
+++ b/src/net/eathena/charserverhandler.cpp
@@ -24,7 +24,6 @@
#include "client.h"
#include "configuration.h"
-#include "logger.h"
#include "settings.h"
#include "enums/being/attributes.h"
@@ -36,7 +35,6 @@
#include "gui/windows/okdialog.h"
#include "net/character.h"
-#include "net/logindata.h"
#include "net/serverfeatures.h"
#include "net/eathena/gamehandler.h"
diff --git a/src/net/eathena/loginhandler.cpp b/src/net/eathena/loginhandler.cpp
index 8a02635b0..8c0b80438 100644
--- a/src/net/eathena/loginhandler.cpp
+++ b/src/net/eathena/loginhandler.cpp
@@ -23,7 +23,6 @@
#include "net/eathena/loginhandler.h"
#include "client.h"
-#include "logger.h"
#include "gui/windows/logindialog.h"
diff --git a/src/net/eathena/messageout.cpp b/src/net/eathena/messageout.cpp
index adf9d17f7..084db9418 100644
--- a/src/net/eathena/messageout.cpp
+++ b/src/net/eathena/messageout.cpp
@@ -30,9 +30,6 @@
#include <SDL_endian.h>
-#include <cstring>
-#include <string>
-
#include "debug.h"
namespace EAthena
diff --git a/src/net/eathena/npchandler.cpp b/src/net/eathena/npchandler.cpp
index 790d498c6..b7bd51844 100644
--- a/src/net/eathena/npchandler.cpp
+++ b/src/net/eathena/npchandler.cpp
@@ -23,7 +23,6 @@
#include "net/eathena/npchandler.h"
#include "actormanager.h"
-#include "logger.h"
#include "being/localplayer.h"
diff --git a/src/net/eathena/tradehandler.cpp b/src/net/eathena/tradehandler.cpp
index 5f9a60e47..65951d1e8 100644
--- a/src/net/eathena/tradehandler.cpp
+++ b/src/net/eathena/tradehandler.cpp
@@ -28,8 +28,6 @@
#include "being/playerinfo.h"
-#include "enums/simpletypes.h"
-
#include "gui/windows/tradewindow.h"
#include "net/eathena/messageout.h"
diff --git a/src/net/ipc.cpp b/src/net/ipc.cpp
index c03a8bfaa..f6df452ac 100644
--- a/src/net/ipc.cpp
+++ b/src/net/ipc.cpp
@@ -20,8 +20,6 @@
#include "net/ipc.h"
-#include "logger.h"
-
#include "gui/windows/chatwindow.h"
#include "utils/delete2.h"
diff --git a/src/net/messageout.cpp b/src/net/messageout.cpp
index 8b1792e17..691ef583c 100644
--- a/src/net/messageout.cpp
+++ b/src/net/messageout.cpp
@@ -27,9 +27,6 @@
#include "logger.h"
-#include <cstring>
-#include <string>
-
#include "debug.h"
namespace Net
diff --git a/src/net/tmwa/adminhandler.cpp b/src/net/tmwa/adminhandler.cpp
index 62421b831..216a33cb7 100644
--- a/src/net/tmwa/adminhandler.cpp
+++ b/src/net/tmwa/adminhandler.cpp
@@ -31,8 +31,6 @@
#include "utils/stringutils.h"
-#include <string>
-
#include "debug.h"
extern Net::AdminHandler *adminHandler;
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp
index 1b77b950d..26b24f07a 100644
--- a/src/net/tmwa/charserverhandler.cpp
+++ b/src/net/tmwa/charserverhandler.cpp
@@ -34,7 +34,6 @@
#include "gui/windows/okdialog.h"
#include "net/character.h"
-#include "net/logindata.h"
#include "net/serverfeatures.h"
#include "net/tmwa/gamehandler.h"
diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp
index 867f9e10e..6145b2b79 100644
--- a/src/net/tmwa/generalhandler.cpp
+++ b/src/net/tmwa/generalhandler.cpp
@@ -24,11 +24,9 @@
#include "client.h"
#include "configuration.h"
-#include "logger.h"
#include "enums/being/attributes.h"
-#include "gui/windows/inventorywindow.h"
#include "gui/windows/skilldialog.h"
#include "gui/windows/socialwindow.h"
#include "gui/windows/statuswindow.h"
diff --git a/src/net/tmwa/messageout.cpp b/src/net/tmwa/messageout.cpp
index 1cad0657c..66379ffda 100644
--- a/src/net/tmwa/messageout.cpp
+++ b/src/net/tmwa/messageout.cpp
@@ -30,9 +30,6 @@
#include <SDL_endian.h>
-#include <cstring>
-#include <string>
-
#include "debug.h"
namespace TmwAthena
diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp
index 2ec2c90d7..574c30bf1 100644
--- a/src/net/tmwa/tradehandler.cpp
+++ b/src/net/tmwa/tradehandler.cpp
@@ -29,8 +29,6 @@
#include "being/playerinfo.h"
#include "being/playerrelations.h"
-#include "enums/simpletypes.h"
-
#include "gui/windows/confirmdialog.h"
#include "gui/windows/tradewindow.h"
diff --git a/src/notifymanager.cpp b/src/notifymanager.cpp
index 9c86be769..7ea4259e9 100644
--- a/src/notifymanager.cpp
+++ b/src/notifymanager.cpp
@@ -20,13 +20,13 @@
#include "notifymanager.h"
+#ifdef TMWA_SUPPORT
#include "guildmanager.h"
+#endif
#include "soundmanager.h"
#include "being/localplayer.h"
-#include "gui/widgets/tabs/chat/chattab.h"
-
#include "net/guildhandler.h"
#include "net/partyhandler.h"
diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp
index b75b8973b..2d22dc262 100644
--- a/src/particle/particle.cpp
+++ b/src/particle/particle.cpp
@@ -36,8 +36,6 @@
#include "utils/dtor.h"
#include "utils/mathutils.h"
-#include <cmath>
-
#include "debug.h"
Particle *particleEngine = nullptr;
diff --git a/src/particle/particleemitter.cpp b/src/particle/particleemitter.cpp
index 78f1af61b..1e227be1f 100644
--- a/src/particle/particleemitter.cpp
+++ b/src/particle/particleemitter.cpp
@@ -34,8 +34,6 @@
#include "resources/imageset.h"
#include "resources/resourcemanager.h"
-#include <cmath>
-
#include "debug.h"
static const float SIN45 = 0.707106781F;
diff --git a/src/particle/rotationalparticle.cpp b/src/particle/rotationalparticle.cpp
index ddadbefd6..dc3206601 100644
--- a/src/particle/rotationalparticle.cpp
+++ b/src/particle/rotationalparticle.cpp
@@ -26,8 +26,6 @@
#include "utils/delete2.h"
-#include <cmath>
-
#include "debug.h"
static const double PI = M_PI;
diff --git a/src/particle/textparticle.cpp b/src/particle/textparticle.cpp
index 834857c36..ab07c33a5 100644
--- a/src/particle/textparticle.cpp
+++ b/src/particle/textparticle.cpp
@@ -22,8 +22,6 @@
#include "particle/textparticle.h"
-#include "render/graphics.h"
-
#include "gui/theme.h"
#include "gui/fonts/font.h"
diff --git a/src/render/graphics.cpp b/src/render/graphics.cpp
index 921e8334f..17f8a6d2e 100644
--- a/src/render/graphics.cpp
+++ b/src/render/graphics.cpp
@@ -65,16 +65,20 @@
#include "render/graphics.h"
-#include "main.h"
-
+#ifdef USE_OPENGL
#include "configuration.h"
#include "graphicsmanager.h"
+#endif
#include "logger.h"
+#if defined(USE_OPENGL) && defined(USE_X11)
#include "render/mglxinit.h"
+#endif
#include "resources/imagehelper.h"
+#ifdef USE_OPENGL
#include "resources/openglimagehelper.h"
+#endif
#ifdef USE_OPENGL
#ifdef __APPLE__
@@ -261,7 +265,7 @@ bool Graphics::setOpenGLMode()
return false;
}
-#if defined(USE_OPENGL) && defined(USE_X11)
+#if defined(USE_X11)
Glx::initFunctions();
#endif
#ifdef USE_SDL2
diff --git a/src/render/mobileopenglgraphics.cpp b/src/render/mobileopenglgraphics.cpp
index a0543a2ea..2c337c294 100644
--- a/src/render/mobileopenglgraphics.cpp
+++ b/src/render/mobileopenglgraphics.cpp
@@ -20,8 +20,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "main.h"
-
#ifdef USE_OPENGL
#include "render/mobileopenglgraphics.h"
diff --git a/src/render/modernopenglgraphics.cpp b/src/render/modernopenglgraphics.cpp
index e4e9b7f5b..87145d673 100644
--- a/src/render/modernopenglgraphics.cpp
+++ b/src/render/modernopenglgraphics.cpp
@@ -20,8 +20,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "main.h"
-
#if defined USE_OPENGL && !defined ANDROID
#include "render/modernopenglgraphics.h"
diff --git a/src/render/normalopenglgraphics.cpp b/src/render/normalopenglgraphics.cpp
index 4ba78bb58..dd4fe3002 100644
--- a/src/render/normalopenglgraphics.cpp
+++ b/src/render/normalopenglgraphics.cpp
@@ -20,7 +20,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "main.h"
#if defined USE_OPENGL && !defined ANDROID
#include "render/normalopenglgraphics.h"
diff --git a/src/render/nullopenglgraphics.cpp b/src/render/nullopenglgraphics.cpp
index cb952eab4..dba15449a 100644
--- a/src/render/nullopenglgraphics.cpp
+++ b/src/render/nullopenglgraphics.cpp
@@ -20,7 +20,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "main.h"
#if defined USE_OPENGL
#include "render/nullopenglgraphics.h"
diff --git a/src/render/safeopenglgraphics.cpp b/src/render/safeopenglgraphics.cpp
index 415f7f9b4..191a95531 100644
--- a/src/render/safeopenglgraphics.cpp
+++ b/src/render/safeopenglgraphics.cpp
@@ -20,8 +20,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "main.h"
-
#if defined USE_OPENGL && !defined ANDROID
#include "render/safeopenglgraphics.h"
diff --git a/src/render/surfacegraphics.cpp b/src/render/surfacegraphics.cpp
index ba2d69f1b..c74351b92 100644
--- a/src/render/surfacegraphics.cpp
+++ b/src/render/surfacegraphics.cpp
@@ -22,8 +22,6 @@
#include "render/surfacegraphics.h"
-#include "main.h"
-
#include "resources/image.h"
#include "resources/surfaceimagehelper.h"
diff --git a/src/resources/atlasmanager.cpp b/src/resources/atlasmanager.cpp
index bd882e4fd..f7afab0f6 100644
--- a/src/resources/atlasmanager.cpp
+++ b/src/resources/atlasmanager.cpp
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "main.h"
-
#ifdef USE_OPENGL
#include "resources/atlasmanager.h"
diff --git a/src/resources/atlasresource.cpp b/src/resources/atlasresource.cpp
index 0b244b049..0ec211979 100644
--- a/src/resources/atlasresource.cpp
+++ b/src/resources/atlasresource.cpp
@@ -18,8 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "main.h"
-
#ifdef USE_OPENGL
#include "resources/atlasresource.h"
diff --git a/src/resources/db/colordb.cpp b/src/resources/db/colordb.cpp
index 77024d290..bf8c06986 100644
--- a/src/resources/db/colordb.cpp
+++ b/src/resources/db/colordb.cpp
@@ -24,8 +24,6 @@
#include "configuration.h"
#include "logger.h"
-#include "utils/xml.h"
-
#include "resources/beingcommon.h"
#include "debug.h"
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index 943f5b55f..cd615c030 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -26,8 +26,9 @@
#include "logger.h"
-#include "resources/imagehelper.h"
+#ifdef USE_OPENGL
#include "resources/openglimagehelper.h"
+#endif
#include "resources/sdlimagehelper.h"
#include "resources/subimage.h"
diff --git a/src/resources/imagehelper.cpp b/src/resources/imagehelper.cpp
index 2ac5d8819..20697cfd6 100644
--- a/src/resources/imagehelper.cpp
+++ b/src/resources/imagehelper.cpp
@@ -23,7 +23,6 @@
#include "resources/imagehelper.h"
#include "logger.h"
-#include "main.h"
#include "resources/dye.h"
#include "resources/dyepalette.h"
diff --git a/src/resources/imagewriter.cpp b/src/resources/imagewriter.cpp
index 210688843..f73c91857 100644
--- a/src/resources/imagewriter.cpp
+++ b/src/resources/imagewriter.cpp
@@ -24,10 +24,8 @@
#include "logger.h"
-#include <cstdlib>
#include <png.h>
#include <SDL_video.h>
-#include <string>
#include "debug.h"
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index c115320cb..c68762728 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -34,8 +34,6 @@
#include "utils/dtor.h"
-#include <map>
-
#include "debug.h"
ItemInfo::ItemInfo() :
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp
index 0152daff5..a1a9d446b 100644
--- a/src/resources/map/map.cpp
+++ b/src/resources/map/map.cpp
@@ -40,7 +40,6 @@
#include "particle/particle.h"
#include "resources/ambientlayer.h"
-#include "resources/image.h"
#include "resources/mapitemtype.h"
#include "resources/notifytypes.h"
#include "resources/resourcemanager.h"
@@ -50,7 +49,9 @@
#include "resources/map/mapobjectlist.h"
#include "resources/map/tileanimation.h"
+#ifdef USE_OPENGL
#include "render/renderers.h"
+#endif
#include "utils/delete2.h"
#include "utils/dtor.h"
@@ -58,7 +59,6 @@
#include "utils/physfstools.h"
#include "utils/timer.h"
-#include <climits>
#include <queue>
#include <sys/stat.h>
diff --git a/src/resources/map/maplayer.cpp b/src/resources/map/maplayer.cpp
index ed9c1a766..2c0f050b5 100644
--- a/src/resources/map/maplayer.cpp
+++ b/src/resources/map/maplayer.cpp
@@ -23,7 +23,6 @@
#include "resources/map/maplayer.h"
#include "configuration.h"
-#include "graphicsvertexes.h"
#ifndef USE_OPENGL
#include "render/graphics.h"
@@ -33,7 +32,6 @@
#include "render/graphics.h"
-#include "resources/image.h"
#include "resources/mapitemtype.h"
#include "resources/map/mapitem.h"
@@ -41,8 +39,6 @@
#include "resources/map/maptype.h"
#include "resources/map/speciallayer.h"
-#include "utils/dtor.h"
-
#include "debug.h"
MapLayer::MapLayer(const int x, const int y,
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 5f95565ec..49e3ced2d 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -23,11 +23,11 @@
#include "resources/mapreader.h"
#include "configuration.h"
+#ifdef USE_OPENGL
#include "graphicsmanager.h"
+#endif
#include "logger.h"
-#include "main.h"
-#include "resources/map/blocktype.h"
#include "resources/map/map.h"
#include "resources/map/mapconsts.h"
#include "resources/map/mapheights.h"
@@ -39,7 +39,9 @@
#include "resources/mapitemtype.h"
#include "resources/resourcemanager.h"
+#ifdef USE_OPENGL
#include "resources/db/mapdb.h"
+#endif
#include "resources/map/tileanimation.h"
@@ -47,7 +49,6 @@
#include "utils/delete2.h"
#include "utils/stringmap.h"
-#include <iostream>
#include <zlib.h>
#include "debug.h"
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 786242485..f667569ce 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -28,8 +28,10 @@
#include "resources/map/walklayer.h"
+#ifdef USE_OPENGL
#include "resources/atlasmanager.h"
#include "resources/atlasresource.h"
+#endif
#include "resources/dye.h"
#include "resources/image.h"
#include "resources/imagehelper.h"
@@ -43,9 +45,11 @@
#include "utils/physfsrwops.h"
#include "utils/sdlcheckutils.h"
+#ifdef USE_OPENGL
#include "render/shaders/shader.h"
#include "render/shaders/shaderprogram.h"
#include "render/shaders/shadersmanager.h"
+#endif
#include <SDL_image.h>
diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp
index cbce0a534..dc251f013 100644
--- a/src/resources/wallpaper.cpp
+++ b/src/resources/wallpaper.cpp
@@ -29,8 +29,6 @@
#include "utils/physfstools.h"
#include <algorithm>
-#include <cstring>
-#include <ctime>
#include "debug.h"
diff --git a/src/spellmanager.cpp b/src/spellmanager.cpp
index 4b627ffde..90da0b06a 100644
--- a/src/spellmanager.cpp
+++ b/src/spellmanager.cpp
@@ -25,7 +25,6 @@
#include "configuration.h"
#include "being/localplayer.h"
-#include "being/playerinfo.h"
#include "enums/being/attributes.h"
diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp
index 5d69aa6df..d4083eac4 100644
--- a/src/statuseffect.cpp
+++ b/src/statuseffect.cpp
@@ -24,7 +24,6 @@
#include "animatedsprite.h"
#include "configuration.h"
-#include "logger.h"
#include "soundmanager.h"
#include "gui/widgets/tabs/chat/chattab.h"
@@ -34,8 +33,6 @@
#include "resources/beingcommon.h"
#include "resources/spriteaction.h"
-#include <map>
-
#include "debug.h"
static void unloadMap(std::map<int, StatusEffect *> &map);
diff --git a/src/touchmanager.cpp b/src/touchmanager.cpp
index dd1c0d79f..d9cd14087 100644
--- a/src/touchmanager.cpp
+++ b/src/touchmanager.cpp
@@ -33,7 +33,6 @@
#include "input/inputmanager.h"
-#include "render/graphics.h"
#include "render/renderers.h"
#include "gui/theme.h"
diff --git a/src/units.cpp b/src/units.cpp
index 577659818..4319fa89e 100644
--- a/src/units.cpp
+++ b/src/units.cpp
@@ -25,14 +25,8 @@
#include "configuration.h"
#include "logger.h"
-#include "utils/stringutils.h"
-#include "utils/xml.h"
-
#include "resources/beingcommon.h"
-#include <climits>
-#include <vector>
-
#include "debug.h"
struct UnitLevel final
diff --git a/src/utils/base64.cpp b/src/utils/base64.cpp
index bb69539e1..88fe8bf8f 100644
--- a/src/utils/base64.cpp
+++ b/src/utils/base64.cpp
@@ -29,8 +29,6 @@
#include "utils/base64.h"
-#include <string>
-
#include "debug.h"
static char base64_table[] =
diff --git a/src/utils/chatutils.cpp b/src/utils/chatutils.cpp
index 45130ced8..4ee5b6610 100644
--- a/src/utils/chatutils.cpp
+++ b/src/utils/chatutils.cpp
@@ -21,8 +21,9 @@
#include "utils/chatutils.h"
#include "actormanager.h"
-#include "guild.h"
+#ifdef TMWA_SUPPORT
#include "guildmanager.h"
+#endif
#include "party.h"
#include "being/localplayer.h"
diff --git a/src/utils/mkdir.cpp b/src/utils/mkdir.cpp
index e30b17854..86ba8d137 100644
--- a/src/utils/mkdir.cpp
+++ b/src/utils/mkdir.cpp
@@ -21,8 +21,6 @@
#include "utils/mkdir.h"
-#include <cstring>
-
#if defined WIN32
#include <limits.h>
#include <windows.h>
diff --git a/src/utils/process.cpp b/src/utils/process.cpp
index c9142da62..ced374d49 100644
--- a/src/utils/process.cpp
+++ b/src/utils/process.cpp
@@ -20,9 +20,6 @@
#include "utils/process.h"
-#include <cstdarg>
-#include <cstdio>
-
#include <unistd.h>
#include "localconsts.h"
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index aa881cfd7..dac6dd7f2 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -22,13 +22,7 @@
#include "utils/stringutils.h"
-#include <string>
#include <algorithm>
-#include <cstdarg>
-#include <cstdio>
-#include <cctype>
-#include <list>
-#include <ctime>
#include "debug.h"
diff --git a/src/utils/translation/podict.cpp b/src/utils/translation/podict.cpp
index 700157adf..ce9bc8aac 100644
--- a/src/utils/translation/podict.cpp
+++ b/src/utils/translation/podict.cpp
@@ -20,8 +20,6 @@
#include "utils/translation/podict.h"
-#include "localconsts.h"
-
#include "debug.h"
std::string empty;
diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp
index 1cdb4678b..33173b3ee 100644
--- a/src/utils/xml.cpp
+++ b/src/utils/xml.cpp
@@ -30,8 +30,6 @@
#include "utils/translation/podict.h"
-#include <fstream>
-
#include "debug.h"
namespace