From 36c45ae7d8d2577a900ec266b64448d4b488013d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 29 Jun 2017 20:13:40 +0300 Subject: Move cast macroses into separate file. --- src/CMakeLists.txt | 1 + src/Makefile.am | 1 + src/actormanager.h | 1 + src/being/actor.h | 2 ++ src/chatlogger.cpp | 10 +++++---- src/commandline.cpp | 1 + src/enums/enums_unittest.cc | 2 ++ src/fs/mkdir.cpp | 2 ++ src/gui/color.h | 2 ++ src/gui/models/beingslistmodel.h | 1 + src/gui/models/extendednamesmodel.cpp | 2 ++ src/gui/models/iconsmodel.h | 1 + src/gui/models/ignorechoiceslistmodel.h | 2 ++ src/gui/models/itemsmodel.h | 1 + src/gui/models/modelistmodel.h | 1 + src/gui/models/namesmodel.cpp | 1 + src/gui/models/serverslistmodel.h | 1 + src/gui/models/shopitems.h | 2 ++ src/gui/models/skillmodel.h | 2 ++ src/gui/models/updatelistmodel.h | 1 + src/gui/models/worldlistmodel.h | 1 + src/gui/palette.h | 2 ++ src/gui/sdlinput.h | 2 ++ src/gui/theme.h | 1 + src/gui/themecolorsidoperators.cpp | 2 ++ src/gui/userpalette.h | 2 ++ src/gui/widgets/serverslistbox.h | 2 ++ src/gui/widgets/skilllistbox.h | 1 + src/gui/widgets/skillrectanglelistbox.h | 1 + src/gui/widgets/tabs/socialfriendstab.h | 1 + src/gui/widgets/tabs/socialguildtab.h | 1 + src/gui/widgets/tabs/socialguildtab2.h | 1 + src/gui/widgets/tabs/socialnavigationtab.h | 1 + src/gui/widgets/tabs/socialpartytab.h | 1 + src/gui/widgets/tabs/socialplayerstab.h | 1 + src/gui/widgets/textbox.h | 2 ++ src/gui/widgets/widget2.h | 2 ++ src/guild.h | 1 + src/input/inputactionmap.h | 2 ++ src/input/inputactionoperators.cpp | 2 ++ src/input/inputactionsortfunctor.h | 2 ++ src/input/inputmanager.h | 1 + src/input/keyboardconfig.h | 2 ++ src/input/touch/touchmanager.h | 2 ++ src/integrity_unittest.cc | 1 + src/localconsts.h | 9 -------- src/logger.h | 2 ++ src/net/eathena/bankrecv.cpp | 2 ++ src/net/messageout.h | 2 ++ src/net/packetcounters.cpp | 2 ++ src/net/updatetypeoperators.cpp | 2 ++ src/particle/particle.h | 2 ++ src/particle/textparticle.h | 2 ++ src/party.h | 1 + src/render/mockgraphics.cc | 1 + src/resources/image/subimage.cpp | 2 ++ src/resources/iteminfo.h | 1 + src/resources/map/map.h | 6 ++++-- src/resources/map/mapheights.h | 2 ++ src/resources/map/objectslayer.cpp | 2 ++ src/resources/wallpaper.cpp | 1 + src/utils/base64.cpp | 2 ++ src/utils/buildhex.h | 2 ++ src/utils/cast.h | 33 ++++++++++++++++++++++++++++++ src/utils/mathutils.h | 2 ++ src/utils/mathutils_unittest.cc | 1 + src/utils/sdlpixel.h | 2 ++ src/utils/stringutils.cpp | 1 + src/utils/stringutils_unittest.cc | 1 + 69 files changed, 142 insertions(+), 15 deletions(-) create mode 100644 src/utils/cast.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 57eca194d..9441e11fe 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -855,6 +855,7 @@ SET(SRCS utils/browserboxtools.cpp utils/browserboxtools.h utils/buildhex.h + utils/cast.h utils/chatutils.cpp utils/chatutils.h utils/checkutils.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 8c52ba399..6fac4b0ed 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -553,6 +553,7 @@ BASE_SRC += events/actionevent.h \ utils/browserboxtools.cpp \ utils/browserboxtools.h \ utils/buildhex.h \ + utils/cast.h \ utils/checkutils.cpp \ utils/checkutils.h \ utils/copynpaste.cpp \ diff --git a/src/actormanager.h b/src/actormanager.h index 0c456362f..10ca749fb 100644 --- a/src/actormanager.h +++ b/src/actormanager.h @@ -38,6 +38,7 @@ #include "listeners/configlistener.h" +#include "utils/cast.h" #include "utils/stringmap.h" #include "utils/stringvector.h" diff --git a/src/being/actor.h b/src/being/actor.h index 8b3e09260..50a9dca24 100644 --- a/src/being/actor.h +++ b/src/being/actor.h @@ -24,6 +24,8 @@ #include "vector.h" +#include "utils/cast.h" + #include #include "localconsts.h" diff --git a/src/chatlogger.cpp b/src/chatlogger.cpp index 3a7792455..d6376f504 100644 --- a/src/chatlogger.cpp +++ b/src/chatlogger.cpp @@ -22,6 +22,12 @@ #include "chatlogger.h" +#include "configuration.h" + +#include "fs/mkdir.h" + +#include "utils/cast.h" + #include #include @@ -32,10 +38,6 @@ #include #endif // WIN32 -#include "configuration.h" - -#include "fs/mkdir.h" - #include "debug.h" ChatLogger *chatLogger = nullptr; diff --git a/src/commandline.cpp b/src/commandline.cpp index 506242a2c..71341f288 100644 --- a/src/commandline.cpp +++ b/src/commandline.cpp @@ -27,6 +27,7 @@ #include "fs/paths.h" +#include "utils/cast.h" #include "utils/gettext.h" #include "utils/stringutils.h" diff --git a/src/enums/enums_unittest.cc b/src/enums/enums_unittest.cc index 3ba1e631d..84f2eb642 100644 --- a/src/enums/enums_unittest.cc +++ b/src/enums/enums_unittest.cc @@ -22,6 +22,8 @@ #include "enums/being/gender.h" +#include "utils/cast.h" + #include "debug.h" TEST_CASE("Gender", "Enums") diff --git a/src/fs/mkdir.cpp b/src/fs/mkdir.cpp index d45810b7c..341f138da 100644 --- a/src/fs/mkdir.cpp +++ b/src/fs/mkdir.cpp @@ -21,6 +21,8 @@ #include "fs/mkdir.h" +#include "utils/cast.h" + #if defined WIN32 #include #include diff --git a/src/gui/color.h b/src/gui/color.h index 4b8e06eb3..c4a1aab01 100644 --- a/src/gui/color.h +++ b/src/gui/color.h @@ -64,6 +64,8 @@ #ifndef GUI_COLOR_H #define GUI_COLOR_H +#include "utils/cast.h" + #include "localconsts.h" /** diff --git a/src/gui/models/beingslistmodel.h b/src/gui/models/beingslistmodel.h index c2b8def74..a50b20d8d 100644 --- a/src/gui/models/beingslistmodel.h +++ b/src/gui/models/beingslistmodel.h @@ -24,6 +24,7 @@ #include "gui/models/avatarlistmodel.h" +#include "utils/cast.h" #include "utils/dtor.h" #include diff --git a/src/gui/models/extendednamesmodel.cpp b/src/gui/models/extendednamesmodel.cpp index 2c8d7167a..74b52beae 100644 --- a/src/gui/models/extendednamesmodel.cpp +++ b/src/gui/models/extendednamesmodel.cpp @@ -20,6 +20,8 @@ #include "gui/models/extendednamesmodel.h" +#include "utils/cast.h" + #include "debug.h" ExtendedNamesModel::ExtendedNamesModel() : diff --git a/src/gui/models/iconsmodel.h b/src/gui/models/iconsmodel.h index 4028895fb..ce977fb5f 100644 --- a/src/gui/models/iconsmodel.h +++ b/src/gui/models/iconsmodel.h @@ -25,6 +25,7 @@ #include "gui/models/listmodel.h" +#include "utils/cast.h" #include "utils/foreach.h" #include "resources/iteminfo.h" diff --git a/src/gui/models/ignorechoiceslistmodel.h b/src/gui/models/ignorechoiceslistmodel.h index ef537a5c7..6cd8bbe87 100644 --- a/src/gui/models/ignorechoiceslistmodel.h +++ b/src/gui/models/ignorechoiceslistmodel.h @@ -28,6 +28,8 @@ #include "being/playerignorestrategy.h" #include "being/playerrelations.h" +#include "utils/cast.h" + /** * Class for choosing one of the various `what to do when ignoring a player' options */ diff --git a/src/gui/models/itemsmodel.h b/src/gui/models/itemsmodel.h index a49a7cfc5..3b4933ce2 100644 --- a/src/gui/models/itemsmodel.h +++ b/src/gui/models/itemsmodel.h @@ -29,6 +29,7 @@ #include "resources/db/itemdb.h" +#include "utils/cast.h" #include "utils/foreach.h" #include diff --git a/src/gui/models/modelistmodel.h b/src/gui/models/modelistmodel.h index abeb99f68..ed4d449d7 100644 --- a/src/gui/models/modelistmodel.h +++ b/src/gui/models/modelistmodel.h @@ -25,6 +25,7 @@ #include "gui/models/listmodel.h" +#include "utils/cast.h" #include "utils/stringvector.h" #include "localconsts.h" diff --git a/src/gui/models/namesmodel.cpp b/src/gui/models/namesmodel.cpp index 5a351f471..ee26dbdaa 100644 --- a/src/gui/models/namesmodel.cpp +++ b/src/gui/models/namesmodel.cpp @@ -20,6 +20,7 @@ #include "gui/models/namesmodel.h" +#include "utils/cast.h" #include "utils/gettext.h" #include "debug.h" diff --git a/src/gui/models/serverslistmodel.h b/src/gui/models/serverslistmodel.h index 206daa02a..8b558d17a 100644 --- a/src/gui/models/serverslistmodel.h +++ b/src/gui/models/serverslistmodel.h @@ -31,6 +31,7 @@ #include "gui/models/listmodel.h" +#include "utils/cast.h" #include "utils/gettext.h" /** diff --git a/src/gui/models/shopitems.h b/src/gui/models/shopitems.h index 3b6d611cb..d162ce524 100644 --- a/src/gui/models/shopitems.h +++ b/src/gui/models/shopitems.h @@ -29,6 +29,8 @@ #include "gui/models/listmodel.h" +#include "utils/cast.h" + #include #include "localconsts.h" diff --git a/src/gui/models/skillmodel.h b/src/gui/models/skillmodel.h index c3331ed30..6c7792508 100644 --- a/src/gui/models/skillmodel.h +++ b/src/gui/models/skillmodel.h @@ -25,6 +25,8 @@ #include "gui/models/listmodel.h" +#include "utils/cast.h" + #include "resources/skill/skillinfo.h" #include "localconsts.h" diff --git a/src/gui/models/updatelistmodel.h b/src/gui/models/updatelistmodel.h index 74bd44af1..f50072112 100644 --- a/src/gui/models/updatelistmodel.h +++ b/src/gui/models/updatelistmodel.h @@ -27,6 +27,7 @@ #include "net/serverinfo.h" +#include "utils/cast.h" #include "utils/foreach.h" #include "localconsts.h" diff --git a/src/gui/models/worldlistmodel.h b/src/gui/models/worldlistmodel.h index f22c808bb..9ae5a5e22 100644 --- a/src/gui/models/worldlistmodel.h +++ b/src/gui/models/worldlistmodel.h @@ -25,6 +25,7 @@ #include "gui/models/listmodel.h" +#include "utils/cast.h" #include "utils/stringutils.h" #include "net/worldinfo.h" diff --git a/src/gui/palette.h b/src/gui/palette.h index 00f295cc4..0905bf22a 100644 --- a/src/gui/palette.h +++ b/src/gui/palette.h @@ -28,6 +28,8 @@ #include "gui/color.h" +#include "utils/cast.h" + #include #include #include diff --git a/src/gui/sdlinput.h b/src/gui/sdlinput.h index 79a30758b..d2b7847df 100644 --- a/src/gui/sdlinput.h +++ b/src/gui/sdlinput.h @@ -82,6 +82,8 @@ #include "input/keyinput.h" +#include "utils/cast.h" + PRAGMA48(GCC diagnostic push) PRAGMA48(GCC diagnostic ignored "-Wshadow") #include diff --git a/src/gui/theme.h b/src/gui/theme.h index 9ef477452..b617002ad 100644 --- a/src/gui/theme.h +++ b/src/gui/theme.h @@ -34,6 +34,7 @@ #include "gui/palette.h" +#include "utils/cast.h" #include "utils/stringvector.h" #include "localconsts.h" diff --git a/src/gui/themecolorsidoperators.cpp b/src/gui/themecolorsidoperators.cpp index 37dc2e7ab..df3a7e65b 100644 --- a/src/gui/themecolorsidoperators.cpp +++ b/src/gui/themecolorsidoperators.cpp @@ -20,6 +20,8 @@ #include "gui/themecolorsidoperators.h" +#include "utils/cast.h" + #include "debug.h" ThemeColorIdT operator+(const ThemeColorIdT &id, const int& i) diff --git a/src/gui/userpalette.h b/src/gui/userpalette.h index 4f7e0e941..712c1f90a 100644 --- a/src/gui/userpalette.h +++ b/src/gui/userpalette.h @@ -32,6 +32,8 @@ #include "gui/models/listmodel.h" +#include "utils/cast.h" + /** * Class controlling the game's color palette. */ diff --git a/src/gui/widgets/serverslistbox.h b/src/gui/widgets/serverslistbox.h index 20d019f8d..16689d6a9 100644 --- a/src/gui/widgets/serverslistbox.h +++ b/src/gui/widgets/serverslistbox.h @@ -27,6 +27,8 @@ #include "gui/models/serverslistmodel.h" +#include "utils/cast.h" + #include "localconsts.h" class ServersListBox final : public ListBox diff --git a/src/gui/widgets/skilllistbox.h b/src/gui/widgets/skilllistbox.h index 93c702381..d611b7dce 100644 --- a/src/gui/widgets/skilllistbox.h +++ b/src/gui/widgets/skilllistbox.h @@ -39,6 +39,7 @@ #include "gui/popups/popupmenu.h" #include "gui/popups/skillpopup.h" +#include "utils/cast.h" #include "utils/delete2.h" #include "utils/stringutils.h" diff --git a/src/gui/widgets/skillrectanglelistbox.h b/src/gui/widgets/skillrectanglelistbox.h index 88698de1c..16fc610a4 100644 --- a/src/gui/widgets/skillrectanglelistbox.h +++ b/src/gui/widgets/skillrectanglelistbox.h @@ -36,6 +36,7 @@ #include "gui/popups/popupmenu.h" #include "gui/popups/skillpopup.h" +#include "utils/cast.h" #include "utils/delete2.h" #include "utils/stringutils.h" diff --git a/src/gui/widgets/tabs/socialfriendstab.h b/src/gui/widgets/tabs/socialfriendstab.h index 017f465c7..d023fa442 100644 --- a/src/gui/widgets/tabs/socialfriendstab.h +++ b/src/gui/widgets/tabs/socialfriendstab.h @@ -33,6 +33,7 @@ #include "gui/widgets/tabs/socialfriendsfunctor.h" +#include "utils/cast.h" #include "utils/delete2.h" #include "utils/foreach.h" #include "utils/gettext.h" diff --git a/src/gui/widgets/tabs/socialguildtab.h b/src/gui/widgets/tabs/socialguildtab.h index 8652a54fe..9a23938ca 100644 --- a/src/gui/widgets/tabs/socialguildtab.h +++ b/src/gui/widgets/tabs/socialguildtab.h @@ -26,6 +26,7 @@ #include "being/localplayer.h" +#include "utils/cast.h" #include "utils/delete2.h" #include "utils/foreach.h" #include "utils/gettext.h" diff --git a/src/gui/widgets/tabs/socialguildtab2.h b/src/gui/widgets/tabs/socialguildtab2.h index ff8544232..9f8a8ff67 100644 --- a/src/gui/widgets/tabs/socialguildtab2.h +++ b/src/gui/widgets/tabs/socialguildtab2.h @@ -28,6 +28,7 @@ #include "being/localplayer.h" +#include "utils/cast.h" #include "utils/delete2.h" #include "utils/foreach.h" #include "utils/gettext.h" diff --git a/src/gui/widgets/tabs/socialnavigationtab.h b/src/gui/widgets/tabs/socialnavigationtab.h index 80b5910f3..b86799f6a 100644 --- a/src/gui/widgets/tabs/socialnavigationtab.h +++ b/src/gui/widgets/tabs/socialnavigationtab.h @@ -34,6 +34,7 @@ #include "input/keyboardconfig.h" +#include "utils/cast.h" #include "utils/delete2.h" #include "utils/gettext.h" diff --git a/src/gui/widgets/tabs/socialpartytab.h b/src/gui/widgets/tabs/socialpartytab.h index d7f22c1f7..1287bfed1 100644 --- a/src/gui/widgets/tabs/socialpartytab.h +++ b/src/gui/widgets/tabs/socialpartytab.h @@ -30,6 +30,7 @@ #include "net/partyhandler.h" +#include "utils/cast.h" #include "utils/delete2.h" #include "utils/foreach.h" #include "utils/gettext.h" diff --git a/src/gui/widgets/tabs/socialplayerstab.h b/src/gui/widgets/tabs/socialplayerstab.h index 87b0335c1..d8ce21df0 100644 --- a/src/gui/widgets/tabs/socialplayerstab.h +++ b/src/gui/widgets/tabs/socialplayerstab.h @@ -30,6 +30,7 @@ #include "gui/models/beingslistmodel.h" +#include "utils/cast.h" #include "utils/gettext.h" #include "utils/delete2.h" #include "utils/stringutils.h" diff --git a/src/gui/widgets/textbox.h b/src/gui/widgets/textbox.h index fefd862a0..bcde2e411 100644 --- a/src/gui/widgets/textbox.h +++ b/src/gui/widgets/textbox.h @@ -73,6 +73,8 @@ #include "listeners/keylistener.h" #include "listeners/mouselistener.h" +#include "utils/cast.h" + #include "localconsts.h" /** diff --git a/src/gui/widgets/widget2.h b/src/gui/widgets/widget2.h index ed9110ba4..12f76e897 100644 --- a/src/gui/widgets/widget2.h +++ b/src/gui/widgets/widget2.h @@ -28,6 +28,8 @@ #include "gui/themecolorsidoperators.h" #include "gui/theme.h" +#include "utils/cast.h" + #include "localconsts.h" class Widget; diff --git a/src/guild.h b/src/guild.h index 2bec6497c..3a58883c9 100644 --- a/src/guild.h +++ b/src/guild.h @@ -25,6 +25,7 @@ #include "gui/models/avatarlistmodel.h" +#include "utils/cast.h" #include "utils/dtor.h" #include "utils/stringvector.h" diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index a87c0cada..8b8d3bf47 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -41,6 +41,8 @@ #include "input/inputactiondata.h" #include "input/inputmanager.h" +#include "utils/cast.h" + #include "localconsts.h" #define defaultAction(name) \ diff --git a/src/input/inputactionoperators.cpp b/src/input/inputactionoperators.cpp index 911cf2e7b..5d6db0967 100644 --- a/src/input/inputactionoperators.cpp +++ b/src/input/inputactionoperators.cpp @@ -20,6 +20,8 @@ #include "input/inputactionoperators.h" +#include "utils/cast.h" + #include "debug.h" InputActionT operator+(InputActionT action, const int& i) diff --git a/src/input/inputactionsortfunctor.h b/src/input/inputactionsortfunctor.h index 1d2583aa9..106f44b0a 100644 --- a/src/input/inputactionsortfunctor.h +++ b/src/input/inputactionsortfunctor.h @@ -23,6 +23,8 @@ #include "input/inputactiondata.h" +#include "utils/cast.h" + #include "localconsts.h" class InputActionSortFunctor final diff --git a/src/input/inputmanager.h b/src/input/inputmanager.h index db61053b0..6deb64858 100644 --- a/src/input/inputmanager.h +++ b/src/input/inputmanager.h @@ -25,6 +25,7 @@ #include "events/inputevent.h" +#include "utils/cast.h" #include "utils/stringmap.h" #include diff --git a/src/input/keyboardconfig.h b/src/input/keyboardconfig.h index 8691571ae..b5e8dc796 100644 --- a/src/input/keyboardconfig.h +++ b/src/input/keyboardconfig.h @@ -25,6 +25,8 @@ #include "localconsts.h" +#include "utils/cast.h" + PRAGMA48(GCC diagnostic push) PRAGMA48(GCC diagnostic ignored "-Wshadow") #include diff --git a/src/input/touch/touchmanager.h b/src/input/touch/touchmanager.h index b5aea56f0..0d5640f50 100644 --- a/src/input/touch/touchmanager.h +++ b/src/input/touch/touchmanager.h @@ -27,6 +27,8 @@ #include "gui/rect.h" +#include "utils/cast.h" + #include #include "localconsts.h" diff --git a/src/integrity_unittest.cc b/src/integrity_unittest.cc index 130716ce6..55c78220f 100644 --- a/src/integrity_unittest.cc +++ b/src/integrity_unittest.cc @@ -46,6 +46,7 @@ #include "resources/resourcemanager/resourcemanager.h" +#include "utils/cast.h" #include "utils/env.h" #include "utils/delete2.h" #include "utils/foreach.h" diff --git a/src/localconsts.h b/src/localconsts.h index e6b455cf6..e416924fe 100644 --- a/src/localconsts.h +++ b/src/localconsts.h @@ -23,15 +23,6 @@ #define ENABLEDEBUGLOG 1 -#define CAST_8 static_cast -#define CAST_S8 static_cast -#define CAST_U8 static_cast -#define CAST_S16 static_cast -#define CAST_U16 static_cast -#define CAST_S32 static_cast -#define CAST_U32 static_cast -#define CAST_SIZE static_cast - #define GCC_VERSION (__GNUC__ * 10000 \ + __GNUC_MINOR__ * 100 \ + __GNUC_PATCHLEVEL__) diff --git a/src/logger.h b/src/logger.h index 15b955795..5efa0779f 100644 --- a/src/logger.h +++ b/src/logger.h @@ -23,6 +23,8 @@ #ifndef LOGGER_H #define LOGGER_H +#include "utils/cast.h" + #include "localconsts.h" PRAGMA48(GCC diagnostic push) diff --git a/src/net/eathena/bankrecv.cpp b/src/net/eathena/bankrecv.cpp index 9f566d5a4..12b17727b 100644 --- a/src/net/eathena/bankrecv.cpp +++ b/src/net/eathena/bankrecv.cpp @@ -28,6 +28,8 @@ #include "net/messagein.h" +#include "utils/cast.h" + #include "debug.h" namespace EAthena diff --git a/src/net/messageout.h b/src/net/messageout.h index 247cf31b9..1be005220 100644 --- a/src/net/messageout.h +++ b/src/net/messageout.h @@ -25,6 +25,8 @@ #include "enums/simpletypes/beingid.h" +#include "utils/cast.h" + #include #include "localconsts.h" diff --git a/src/net/packetcounters.cpp b/src/net/packetcounters.cpp index 4170c2cf0..6d0a8bbf6 100644 --- a/src/net/packetcounters.cpp +++ b/src/net/packetcounters.cpp @@ -22,6 +22,8 @@ #include "net/packetcounters.h" +#include "utils/cast.h" + #include "debug.h" extern volatile time_t cur_time; diff --git a/src/net/updatetypeoperators.cpp b/src/net/updatetypeoperators.cpp index 8ba8224a0..1ee52455c 100644 --- a/src/net/updatetypeoperators.cpp +++ b/src/net/updatetypeoperators.cpp @@ -20,6 +20,8 @@ #include "net/updatetypeoperators.h" +#include "utils/cast.h" + #include "debug.h" int operator&(const UpdateTypeT &a, const UpdateTypeT &b) diff --git a/src/particle/particle.h b/src/particle/particle.h index 7004af0e6..1db2f565b 100644 --- a/src/particle/particle.h +++ b/src/particle/particle.h @@ -30,6 +30,8 @@ #include "enums/simpletypes/beingid.h" +#include "utils/cast.h" + #include "particle/particleengine.h" #include "localconsts.h" diff --git a/src/particle/textparticle.h b/src/particle/textparticle.h index e67120688..2e06ae495 100644 --- a/src/particle/textparticle.h +++ b/src/particle/textparticle.h @@ -25,6 +25,8 @@ #include "particle/particle.h" +#include "utils/cast.h" + class TextParticle final : public Particle { public: diff --git a/src/party.h b/src/party.h index 7b46339bf..ca7c11d2e 100644 --- a/src/party.h +++ b/src/party.h @@ -24,6 +24,7 @@ #include "gui/models/avatarlistmodel.h" +#include "utils/cast.h" #include "utils/dtor.h" #include "utils/stringvector.h" diff --git a/src/render/mockgraphics.cc b/src/render/mockgraphics.cc index d36a6b1f5..f3cadee1d 100644 --- a/src/render/mockgraphics.cc +++ b/src/render/mockgraphics.cc @@ -24,6 +24,7 @@ #include "graphicsmanager.h" +#include "utils/cast.h" #include "utils/sdlcheckutils.h" #include "render/vertexes/imagecollection.h" diff --git a/src/resources/image/subimage.cpp b/src/resources/image/subimage.cpp index 77d0eb889..735ed27f5 100644 --- a/src/resources/image/subimage.cpp +++ b/src/resources/image/subimage.cpp @@ -22,6 +22,8 @@ #include "resources/image/subimage.h" +#include "utils/cast.h" + #ifdef DEBUG_IMAGES #include "logger.h" #endif // DEBUG_IMAGES diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h index 384626856..dd91dc738 100644 --- a/src/resources/iteminfo.h +++ b/src/resources/iteminfo.h @@ -35,6 +35,7 @@ #include "resources/sprite/spritedisplay.h" +#include "utils/cast.h" #include "utils/intmap.h" // sprite, diff --git a/src/resources/map/map.h b/src/resources/map/map.h index 1d5ccefdc..3ae809058 100644 --- a/src/resources/map/map.h +++ b/src/resources/map/map.h @@ -33,12 +33,14 @@ #include "enums/resources/map/maplayerposition.h" #include "enums/resources/map/maptype.h" +#include "utils/cast.h" + +#include "listeners/configlistener.h" + #include "resources/memorycounter.h" #include "resources/map/properties.h" -#include "listeners/configlistener.h" - #include class AmbientLayer; diff --git a/src/resources/map/mapheights.h b/src/resources/map/mapheights.h index 43721e817..ef8c4151b 100644 --- a/src/resources/map/mapheights.h +++ b/src/resources/map/mapheights.h @@ -23,6 +23,8 @@ #include "resources/memorycounter.h" +#include "utils/cast.h" + #include "localconsts.h" class MapHeights final : public MemoryCounter diff --git a/src/resources/map/objectslayer.cpp b/src/resources/map/objectslayer.cpp index 3224da0e6..05d00c61e 100644 --- a/src/resources/map/objectslayer.cpp +++ b/src/resources/map/objectslayer.cpp @@ -20,6 +20,8 @@ #include "resources/map/objectslayer.h" +#include "utils/cast.h" + #include "resources/map/mapobjectlist.h" #include "debug.h" diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp index e474d2315..2cc4c5754 100644 --- a/src/resources/wallpaper.cpp +++ b/src/resources/wallpaper.cpp @@ -29,6 +29,7 @@ #include "resources/wallpaperdata.h" +#include "utils/cast.h" #include "utils/foreach.h" #include diff --git a/src/utils/base64.cpp b/src/utils/base64.cpp index 9f1c2a1d4..62ba76f21 100644 --- a/src/utils/base64.cpp +++ b/src/utils/base64.cpp @@ -29,6 +29,8 @@ #include "utils/base64.h" +#include "utils/cast.h" + #include "debug.h" static char base64_table[] = diff --git a/src/utils/buildhex.h b/src/utils/buildhex.h index 0a4349bac..777d19784 100644 --- a/src/utils/buildhex.h +++ b/src/utils/buildhex.h @@ -21,6 +21,8 @@ #ifndef UTILS_BUILDHEX_H #define UTILS_BUILDHEX_H +#include "utils/cast.h" + #include "localconsts.h" PRAGMA48(GCC diagnostic push) diff --git a/src/utils/cast.h b/src/utils/cast.h new file mode 100644 index 000000000..9b6289ebc --- /dev/null +++ b/src/utils/cast.h @@ -0,0 +1,33 @@ +/* + * The ManaPlus Client + * Copyright (C) 2011-2017 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef UTILS_CAST_H +#define UTILS_CAST_H + +#define CAST_8 static_cast +#define CAST_S8 static_cast +#define CAST_U8 static_cast +#define CAST_S16 static_cast +#define CAST_U16 static_cast +#define CAST_S32 static_cast +#define CAST_U32 static_cast +#define CAST_SIZE static_cast + +#endif // UTILS_CAST_H diff --git a/src/utils/mathutils.h b/src/utils/mathutils.h index b82ad3065..045feb10a 100644 --- a/src/utils/mathutils.h +++ b/src/utils/mathutils.h @@ -23,6 +23,8 @@ #ifndef UTILS_MATHUTILS_H #define UTILS_MATHUTILS_H +#include "utils/cast.h" + #include #ifndef USE_SDL2 diff --git a/src/utils/mathutils_unittest.cc b/src/utils/mathutils_unittest.cc index 187accf74..c7a545f87 100644 --- a/src/utils/mathutils_unittest.cc +++ b/src/utils/mathutils_unittest.cc @@ -20,6 +20,7 @@ #include "test/unittests.h" +#include "utils/cast.h" #include "utils/mathutils.h" #include "debug.h" diff --git a/src/utils/sdlpixel.h b/src/utils/sdlpixel.h index 920ad4164..54e7e0b41 100644 --- a/src/utils/sdlpixel.h +++ b/src/utils/sdlpixel.h @@ -66,6 +66,8 @@ #include "gui/color.h" +#include "utils/cast.h" + PRAGMA48(GCC diagnostic push) PRAGMA48(GCC diagnostic ignored "-Wshadow") #include diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index 201ffc0c4..71a82f16f 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -30,6 +30,7 @@ #include "resources/db/itemdb.h" #endif // DYECMD +#include "utils/cast.h" #include "utils/gettext.h" #include "utils/foreach.h" diff --git a/src/utils/stringutils_unittest.cc b/src/utils/stringutils_unittest.cc index 354232965..19670db99 100644 --- a/src/utils/stringutils_unittest.cc +++ b/src/utils/stringutils_unittest.cc @@ -27,6 +27,7 @@ #include "fs/virtfs/fs.h" +#include "utils/cast.h" #include "utils/delete2.h" #include "utils/dtor.h" -- cgit v1.2.3-70-g09d2