From 9a39234015f092c5eb0f461da91689e71bf43943 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 29 Jun 2015 21:16:55 +0300 Subject: Fix code style. --- src/CMakeLists.txt | 2 +- src/client.cpp | 1 - src/enums/resources/map/blockmask.h | 2 +- src/enums/resources/map/blocktype.h | 2 +- src/game.cpp | 1 - src/gui/models/ignorechoiceslistmodel.h | 1 + src/gui/models/playerrelationlistmodel.h | 1 - src/gui/models/playertablemodel.cpp | 2 ++ src/gui/models/playertablemodel.h | 2 -- src/gui/widgets/skillinfo.h | 1 - src/gui/widgets/skilllistbox.h | 3 -- src/localconsts.h | 7 +++++ src/navigationmanager.cpp | 48 ++++++++++++++++---------------- src/navigationmanager.h | 2 ++ src/net/ea/chathandler.cpp | 2 +- src/net/eathena/inventoryhandler.cpp | 2 -- src/net/eathena/playerhandler.cpp | 2 -- src/net/tmwa/charserverhandler.cpp | 1 - src/net/tmwa/inventoryhandler.cpp | 3 -- src/net/tmwa/tradehandler.cpp | 3 +- src/resources/resourcemanager.cpp | 2 +- src/resources/resourcemanager.h | 3 +- 22 files changed, 45 insertions(+), 48 deletions(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c95768b4b..6a3ded644 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -661,7 +661,7 @@ SET(SRCS resources/notificationinfo.h resources/notifications.h enums/resources/notifyflags.h - resources/notifytypes.h + enums/resources/notifytypes.h resources/db/monsterdb.cpp resources/db/monsterdb.h resources/db/npcdb.cpp diff --git a/src/client.cpp b/src/client.cpp index 4028856bf..981ead21c 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -24,7 +24,6 @@ #include "chatlogger.h" #include "configmanager.h" -#include "defaults.h" #include "dirs.h" #include "dropshortcut.h" #include "emoteshortcut.h" diff --git a/src/enums/resources/map/blockmask.h b/src/enums/resources/map/blockmask.h index 83a6ffedb..dda859abf 100644 --- a/src/enums/resources/map/blockmask.h +++ b/src/enums/resources/map/blockmask.h @@ -35,6 +35,6 @@ namespace BlockMask GROUND = 0x10, // 0001 0000 GROUNDTOP = 0x20 // 0010 0000 }; -} +} // namespace BlockMask #endif // ENUMS_RESOURCES_MAP_BLOCKMASK_H diff --git a/src/enums/resources/map/blocktype.h b/src/enums/resources/map/blocktype.h index 03d14ec37..5909703cb 100644 --- a/src/enums/resources/map/blocktype.h +++ b/src/enums/resources/map/blocktype.h @@ -37,6 +37,6 @@ namespace BlockType GROUNDTOP, NB_BLOCKTYPES }; -} +} // namespace BlockType #endif // ENUMS_RESOURCES_MAP_BLOCKTYPE_H diff --git a/src/game.cpp b/src/game.cpp index 7dedb9700..df2b99e64 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -114,7 +114,6 @@ #include "utils/delete2.h" #include "utils/gettext.h" -#include "utils/langs.h" #include "utils/mkdir.h" #include "utils/physfstools.h" #include "utils/sdlcheckutils.h" diff --git a/src/gui/models/ignorechoiceslistmodel.h b/src/gui/models/ignorechoiceslistmodel.h index c6dea9603..8c2711b64 100644 --- a/src/gui/models/ignorechoiceslistmodel.h +++ b/src/gui/models/ignorechoiceslistmodel.h @@ -26,6 +26,7 @@ #include "gui/models/playerrelationlistmodel.h" #include "being/playerignorestrategy.h" +#include "being/playerrelations.h" /** * Class for choosing one of the various `what to do when ignoring a player' options diff --git a/src/gui/models/playerrelationlistmodel.h b/src/gui/models/playerrelationlistmodel.h index f969b8e20..d34b3c1e1 100644 --- a/src/gui/models/playerrelationlistmodel.h +++ b/src/gui/models/playerrelationlistmodel.h @@ -24,7 +24,6 @@ #define GUI_MODELS_PLAYERRELATIONLISTMODEL_H #include "being/playerrelation.h" -#include "being/playerrelations.h" #include "gui/models/listmodel.h" diff --git a/src/gui/models/playertablemodel.cpp b/src/gui/models/playertablemodel.cpp index 4affed712..8844404a9 100644 --- a/src/gui/models/playertablemodel.cpp +++ b/src/gui/models/playertablemodel.cpp @@ -22,6 +22,8 @@ #include "gui/models/playertablemodel.h" +#include "being/playerrelations.h" + #include "gui/widgets/dropdown.h" #include "gui/widgets/label.h" diff --git a/src/gui/models/playertablemodel.h b/src/gui/models/playertablemodel.h index de21224b8..6525a38b3 100644 --- a/src/gui/models/playertablemodel.h +++ b/src/gui/models/playertablemodel.h @@ -27,8 +27,6 @@ #include "gui/models/tablemodel.h" -#include "being/playerrelation.h" - #include "localconsts.h" class PlayerRelationListModel; diff --git a/src/gui/widgets/skillinfo.h b/src/gui/widgets/skillinfo.h index 9324091bf..f0e356a58 100644 --- a/src/gui/widgets/skillinfo.h +++ b/src/gui/widgets/skillinfo.h @@ -30,7 +30,6 @@ #include "resources/skilltype.h" #include - #include #include diff --git a/src/gui/widgets/skilllistbox.h b/src/gui/widgets/skilllistbox.h index b8aa3f3c5..62848a98e 100644 --- a/src/gui/widgets/skilllistbox.h +++ b/src/gui/widgets/skilllistbox.h @@ -30,7 +30,6 @@ #include "gui/widgets/createwidget.h" #include "gui/widgets/listbox.h" -#include "gui/widgets/skilldata.h" #include "gui/fonts/font.h" @@ -38,8 +37,6 @@ #include "gui/popups/skillpopup.h" -#include "render/graphics.h" - #include "utils/delete2.h" #include "resources/skillconsts.h" diff --git a/src/localconsts.h b/src/localconsts.h index dcd0613b2..58923b609 100644 --- a/src/localconsts.h +++ b/src/localconsts.h @@ -70,13 +70,20 @@ #define A_WARN_UNUSED __attribute__ ((warn_unused_result)) #define DEPRECATED __attribute__ ((deprecated)) #define restrict __restrict__ + +#ifndef ENABLE_CILKPLUS #define A_NONNULL(...) __attribute__((nonnull (__VA_ARGS__))) +#else +#define A_NONNULL(...) +#endif + #else #define A_UNUSED #define A_WARN_UNUSED #define gnu_printf printf #define DEPRECATED #define restrict +#define A_NONNULL(...) #endif #ifdef __clang__ #define gnu_printf printf diff --git a/src/navigationmanager.cpp b/src/navigationmanager.cpp index cf078e06f..de05c62db 100644 --- a/src/navigationmanager.cpp +++ b/src/navigationmanager.cpp @@ -80,30 +80,6 @@ Resource *NavigationManager::loadWalkLayer(const Map *const map) return walkLayer; } -#endif - -bool NavigationManager::findWalkableTile(int &x1, int &y1, - const int width, - const int height, - const MetaTile *const tiles, - const int *const data) -{ - for (int y = 0; y < height; y ++) - { - const int y2 = y * width; - for (int x = 0; x < width; x ++) - { - const int ptr = x + y2; - if (!(tiles[ptr].blockmask & blockWalkMask) && !data[ptr]) - { - x1 = x; - y1 = y; - return true; - } - } - } - return false; -} void NavigationManager::fillNum(int x, int y, const int width, @@ -168,3 +144,27 @@ void NavigationManager::fillNum(int x, int y, } } } +#endif + +bool NavigationManager::findWalkableTile(int &x1, int &y1, + const int width, + const int height, + const MetaTile *const tiles, + const int *const data) +{ + for (int y = 0; y < height; y ++) + { + const int y2 = y * width; + for (int x = 0; x < width; x ++) + { + const int ptr = x + y2; + if (!(tiles[ptr].blockmask & blockWalkMask) && !data[ptr]) + { + x1 = x; + y1 = y; + return true; + } + } + } + return false; +} diff --git a/src/navigationmanager.h b/src/navigationmanager.h index 16b8b9fae..c7be1a053 100644 --- a/src/navigationmanager.h +++ b/src/navigationmanager.h @@ -48,12 +48,14 @@ class NavigationManager final const MetaTile *const tiles, const int *const data) A_NONNULL(5, 6); +#ifndef DYECMD static void fillNum(int x, int y, const int width, const int height, const int num, const MetaTile *const tiles, int *const data) A_NONNULL(6, 7); +#endif }; #endif // NAVIGATIONMANAGER_H diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp index 0ece76168..fc489a18a 100644 --- a/src/net/ea/chathandler.cpp +++ b/src/net/ea/chathandler.cpp @@ -32,7 +32,7 @@ #include "gui/windows/chatwindow.h" -#include "gui/widgets/tabs/chat/gmtab.h" +#include "gui/widgets/tabs/chat/chattab.h" #include "net/messagein.h" diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp index 9edbc4d67..a2e7c869e 100644 --- a/src/net/eathena/inventoryhandler.cpp +++ b/src/net/eathena/inventoryhandler.cpp @@ -22,11 +22,9 @@ #include "net/eathena/inventoryhandler.h" -#include "item.h" #include "notifymanager.h" #include "being/localplayer.h" -#include "being/playerinfo.h" #include "enums/equipslot.h" diff --git a/src/net/eathena/playerhandler.cpp b/src/net/eathena/playerhandler.cpp index 486d3dd30..984713cc8 100644 --- a/src/net/eathena/playerhandler.cpp +++ b/src/net/eathena/playerhandler.cpp @@ -40,8 +40,6 @@ #include "net/eathena/protocol.h" #include "net/eathena/inventoryhandler.h" -#include "utils/stringutils.h" - #include "resources/map/map.h" #include "debug.h" diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index 4c6636727..e1e0464a0 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -32,7 +32,6 @@ #include "gui/widgets/createwidget.h" #include "net/character.h" -#include "net/serverfeatures.h" #include "net/ea/token.h" diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 7c40df902..6097f515d 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -22,14 +22,11 @@ #include "net/tmwa/inventoryhandler.h" -#include "item.h" - #include "notifymanager.h" #include "enums/equipslot.h" #include "being/localplayer.h" -#include "being/playerinfo.h" #include "enums/resources/notifytypes.h" diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp index 76a8903d6..c445f8d06 100644 --- a/src/net/tmwa/tradehandler.cpp +++ b/src/net/tmwa/tradehandler.cpp @@ -259,7 +259,8 @@ void TradeHandler::processTradeItemAddResponse(Net::MessageIn &msg) void TradeHandler::processTradeResponse(Net::MessageIn &msg) { if (tradePartnerName.empty() || - !player_relations.hasPermission(tradePartnerName, PlayerRelation::TRADE)) + !player_relations.hasPermission(tradePartnerName, + PlayerRelation::TRADE)) { tradeHandler->respond(false); return; diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp index 55ef60dc7..0c0a5bd7c 100644 --- a/src/resources/resourcemanager.cpp +++ b/src/resources/resourcemanager.cpp @@ -464,7 +464,7 @@ Resource *ResourceManager::getFromCache(const std::string &idPath) } Resource *ResourceManager::get(const std::string &idPath, - const generator fun, + generator fun, const void *const data) { #ifndef DISABLE_RESOURCE_CACHING diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h index 91456460d..cb55f4d6e 100644 --- a/src/resources/resourcemanager.h +++ b/src/resources/resourcemanager.h @@ -109,7 +109,8 @@ class ResourceManager final * @return A valid resource or NULL if the resource could * not be generated. */ - Resource *get(const std::string &idPath, const generator fun, + Resource *get(const std::string &idPath, + generator fun, const void *const data) A_WARN_UNUSED; Resource *getFromCache(const std::string &idPath) A_WARN_UNUSED; -- cgit v1.2.3-70-g09d2