diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-05-21 12:28:40 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-05-21 20:26:12 +0300 |
commit | f4fe732ccbd65fd584b7787f3b5aec904a85d11b (patch) | |
tree | 5cf6023ab3713316326547026c10f2fb4ce6d8b8 | |
parent | c78423448941517eeae0a60e703a5dc2976aed0c (diff) | |
download | manaverse-f4fe732ccbd65fd584b7787f3b5aec904a85d11b.tar.gz manaverse-f4fe732ccbd65fd584b7787f3b5aec904a85d11b.tar.bz2 manaverse-f4fe732ccbd65fd584b7787f3b5aec904a85d11b.tar.xz manaverse-f4fe732ccbd65fd584b7787f3b5aec904a85d11b.zip |
Fix code style.
34 files changed, 72 insertions, 58 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0788568a9..d797977e2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -484,7 +484,7 @@ SET(SRCS net/generalhandler.h net/guildhandler.h net/inventoryhandler.h - net/inventoryitem.h + net/ea/inventoryitem.h net/logindata.h net/loginhandler.h net/messagehandler.h diff --git a/src/Makefile.am b/src/Makefile.am index de9610b4f..6505dfa9c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -599,7 +599,7 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ net/generalhandler.h \ net/guildhandler.h \ net/inventoryhandler.h \ - net/inventoryitem.h \ + net/ea/inventoryitem.h \ net/logindata.h \ net/loginhandler.h \ net/messagehandler.h \ diff --git a/src/actormanager.cpp b/src/actormanager.cpp index 56a04fe55..dcb439e0f 100644 --- a/src/actormanager.cpp +++ b/src/actormanager.cpp @@ -41,6 +41,7 @@ #include "input/inputmanager.h" +#include "utils/checkutils.h" #include "utils/gettext.h" #include "net/net.h" diff --git a/src/being/being.cpp b/src/being/being.cpp index 2fd83c7b5..adc1313a0 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -82,6 +82,7 @@ #include "gui/widgets/tabs/langtab.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "utils/timer.h" @@ -597,7 +598,11 @@ void Being::takeDamage(Being *const attacker, const int amount, mDamageTaken += amount; if (mInfo) { - playSfx(mInfo->getSound(ItemSoundEvent::HURT), this, false, mX, mY); + playSfx(mInfo->getSound(ItemSoundEvent::HURT), + this, + false, + mX, + mY); if (!mInfo->isStaticMaxHP()) { diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 73c3f40ec..ddc29629e 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -904,7 +904,8 @@ int LocalPlayer::getAttackRange() const } else { - const Item *const weapon = PlayerInfo::getEquipment(ItemSlot::FIGHT1_SLOT); + const Item *const weapon = PlayerInfo::getEquipment( + ItemSlot::FIGHT1_SLOT); if (weapon) { const ItemInfo &info = weapon->getInfo(); @@ -3592,7 +3593,8 @@ void LocalPlayer::setRealPos(const int x, const int y) if ((mCrossX || mCrossY) && layer->getTile(mCrossX, mCrossY) - && layer->getTile(mCrossX, mCrossY)->getType() == MapItemType::CROSS) + && layer->getTile(mCrossX, mCrossY)->getType() + == MapItemType::CROSS) { layer->setTile(mCrossX, mCrossY, MapItemType::EMPTY); } diff --git a/src/client.cpp b/src/client.cpp index 097e1641b..f6b5c8a89 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -43,6 +43,7 @@ #include "touchmanager.h" #include "being/beingspeech.h" +#include "being/playerinfo.h" #include "being/playerrelations.h" #include "input/inputmanager.h" diff --git a/src/commands.cpp b/src/commands.cpp index f4ead27e7..711806021 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -1307,11 +1307,11 @@ static int uploadUpdate(void *ptr, size_t total A_UNUSED, size_t remaining A_UNUSED) { - if (status == DownloadStatus::IDLE || status == DownloadStatus::STARTING) + if (status == DownloadStatus::Idle || status == DownloadStatus::Starting) return 0; UploadChatInfo *const info = reinterpret_cast<UploadChatInfo*>(ptr); - if (status == DownloadStatus::COMPLETE) + if (status == DownloadStatus::Complete) { ChatTab *const tab = info->tab; if (chatWindow && (!tab || chatWindow->isTabPresent(tab))) diff --git a/src/gui/widgets/tabs/socialfriendstab.h b/src/gui/widgets/tabs/socialfriendstab.h index 0a43c6e2f..f483a73ca 100644 --- a/src/gui/widgets/tabs/socialfriendstab.h +++ b/src/gui/widgets/tabs/socialfriendstab.h @@ -35,7 +35,6 @@ #include "utils/delete2.h" #include "utils/gettext.h" -#include "utils/stringutils.h" #include <algorithm> diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp index 90b966259..02ff66354 100644 --- a/src/gui/windows/charcreatedialog.cpp +++ b/src/gui/windows/charcreatedialog.cpp @@ -46,6 +46,7 @@ #include "resources/db/colordb.h" #include "resources/db/itemdb.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "debug.h" diff --git a/src/gui/windows/logindialog.cpp b/src/gui/windows/logindialog.cpp index 83041bc75..6cd9ecdf5 100644 --- a/src/gui/windows/logindialog.cpp +++ b/src/gui/windows/logindialog.cpp @@ -47,6 +47,7 @@ #include "net/loginhandler.h" #include "net/net.h" +#include "utils/delete2.h" #include "utils/paths.h" #include "debug.h" diff --git a/src/gui/windows/quitdialog.cpp b/src/gui/windows/quitdialog.cpp index 0a9a222cd..9d0b72295 100644 --- a/src/gui/windows/quitdialog.cpp +++ b/src/gui/windows/quitdialog.cpp @@ -44,6 +44,7 @@ #include "resources/map/map.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "utils/process.h" diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index a56c79a3b..48ccd9f6d 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -31,6 +31,7 @@ #include "input/inputaction.h" +#include "net/download.h" #include "gui/gui.h" #include "gui/fonts/font.h" @@ -683,7 +684,7 @@ void ServerDialog::saveCustomServers(const ServerInfo ¤tServer, int ServerDialog::downloadUpdate(void *ptr, DownloadStatus::Type status, size_t total, size_t remaining) { - if (!ptr || status == DownloadStatus::CANCELLED) + if (!ptr || status == DownloadStatus::Cancelled) return -1; ServerDialog *const sd = reinterpret_cast<ServerDialog*>(ptr); @@ -692,7 +693,7 @@ int ServerDialog::downloadUpdate(void *ptr, DownloadStatus::Type status, if (!sd->mDownload) return -1; - if (status == DownloadStatus::COMPLETE) + if (status == DownloadStatus::Complete) { finished = true; } diff --git a/src/gui/windows/serverdialog.h b/src/gui/windows/serverdialog.h index e2ab64ada..f10a222e6 100644 --- a/src/gui/windows/serverdialog.h +++ b/src/gui/windows/serverdialog.h @@ -25,7 +25,7 @@ #include "gui/widgets/window.h" -#include "net/download.h" +#include "net/downloadstatus.h" #include "net/serverinfo.h" #include "utils/mutex.h" @@ -42,6 +42,11 @@ class Label; class ListBox; class ServersListModel; +namespace Net +{ + class Download; +} + /** * The server choice dialog. * diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index 898d50425..ff194ada4 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -38,7 +38,8 @@ #include "gui/widgets/progressbar.h" #include "gui/widgets/scrollarea.h" -#include "net/logindata.h" +#include "net/download.h" +#include "net/updatetype.h" #include "resources/resourcemanager.h" @@ -463,12 +464,12 @@ int UpdaterWindow::updateProgress(void *ptr, DownloadStatus::Type status, if (!uw) return -1; - if (status == DownloadStatus::COMPLETE) + if (status == DownloadStatus::Complete) { uw->mDownloadComplete = true; } - else if (status == DownloadStatus::ERROR || - status == DownloadStatus::CANCELLED) + else if (status == DownloadStatus::Error || + status == DownloadStatus::Cancelled) { if (uw->mDownloadStatus == UPDATE_COMPLETE) { // ignoring error in last state (was UPDATE_PATCH) diff --git a/src/gui/windows/updaterwindow.h b/src/gui/windows/updaterwindow.h index 332f0d629..eaca25e9f 100644 --- a/src/gui/windows/updaterwindow.h +++ b/src/gui/windows/updaterwindow.h @@ -26,8 +26,6 @@ #include "gui/widgets/linkhandler.h" #include "gui/widgets/window.h" -#include "net/download.h" - #include "resources/updatefile.h" #include "utils/mutex.h" @@ -35,6 +33,8 @@ #include "listeners/actionlistener.h" #include "listeners/keylistener.h" +#include "net/downloadstatus.h" + #include <string> #include <vector> @@ -45,6 +45,11 @@ class ProgressBar; class ResourceManager; class ScrollArea; +namespace Net +{ + class Download; +} + /** * Update progress window GUI * diff --git a/src/listeners/requesttradelistener.h b/src/listeners/requesttradelistener.h index 54cbce8de..6d549dcfd 100644 --- a/src/listeners/requesttradelistener.h +++ b/src/listeners/requesttradelistener.h @@ -20,10 +20,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#ifndef LISTENERS_REQUESTTRADELISTENER_H +#define LISTENERS_REQUESTTRADELISTENER_H + #include "being/playerrelations.h" #include "gui/windows/confirmdialog.h" +#include "net/net.h" #include "net/tradehandler.h" #include "listeners/actionlistener.h" @@ -49,3 +53,5 @@ struct RequestTradeListener final : public ActionListener Net::getTradeHandler()->respond(eventId == "yes"); } }; + +#endif // LISTENERS_REQUESTTRADELISTENER_H diff --git a/src/net/character.h b/src/net/character.h index 89789335c..1b5113627 100644 --- a/src/net/character.h +++ b/src/net/character.h @@ -23,14 +23,15 @@ #ifndef NET_CHARACTER_H #define NET_CHARACTER_H +#include "being/localplayer.h" +#include "being/playerinfo.h" + #include "utils/delete2.h" #include <string> #include <vector> -class LocalPlayer; - -struct PlayerInfoBackend; +#include "localconsts.h" namespace Net { diff --git a/src/net/charserverhandler.h b/src/net/charserverhandler.h index 744ee685b..f552f6ba7 100644 --- a/src/net/charserverhandler.h +++ b/src/net/charserverhandler.h @@ -24,9 +24,6 @@ #define NET_CHARSERVERHANDLER_H #include "being/localplayer.h" -#include "being/playerinfo.h" - -#include "utils/delete2.h" #include <string> #include <vector> diff --git a/src/net/download.cpp b/src/net/download.cpp index c61e42e0c..011182a7e 100644 --- a/src/net/download.cpp +++ b/src/net/download.cpp @@ -202,7 +202,7 @@ bool Download::start() logger->log1(DOWNLOAD_ERROR_MESSAGE_THREAD); if (mError) strcpy(mError, DOWNLOAD_ERROR_MESSAGE_THREAD); - mUpdateFunction(mPtr, DownloadStatus::THREAD_ERROR, 0, 0); + mUpdateFunction(mPtr, DownloadStatus::ThreadError, 0, 0); if (!mIgnoreError) return false; } @@ -239,12 +239,12 @@ int Download::downloadProgress(void *clientp, double dltotal, double dlnow, if (d->mOptions.cancel) { - return d->mUpdateFunction(d->mPtr, DownloadStatus::CANCELLED, + return d->mUpdateFunction(d->mPtr, DownloadStatus::Cancelled, static_cast<size_t>(dltotal), static_cast<size_t>(dlnow)); } - return d->mUpdateFunction(d->mPtr, DownloadStatus::IDLE, + return d->mUpdateFunction(d->mPtr, DownloadStatus::Idle, static_cast<size_t>(dltotal), static_cast<size_t>(dlnow)); } @@ -283,7 +283,7 @@ int Download::downloadThread(void *ptr) logger->log_r("selected url: %s", d->mUrl.c_str()); while (attempts < 3 && !complete && !d->mOptions.cancel) { - d->mUpdateFunction(d->mPtr, DownloadStatus::STARTING, 0, 0); + d->mUpdateFunction(d->mPtr, DownloadStatus::Starting, 0, 0); if (d->mOptions.cancel) { @@ -372,7 +372,7 @@ int Download::downloadThread(void *ptr) if (d->mOptions.cancel) break; -// d->mUpdateFunction(d->mPtr, DownloadStatus::ERROR, 0, 0); +// d->mUpdateFunction(d->mPtr, DownloadStatus::Error, 0, 0); if (file) { @@ -495,11 +495,11 @@ int Download::downloadThread(void *ptr) } else if (!complete || attempts >= 3) { - d->mUpdateFunction(d->mPtr, DownloadStatus::ERROR, 0, 0); + d->mUpdateFunction(d->mPtr, DownloadStatus::Error, 0, 0); } else { - d->mUpdateFunction(d->mPtr, DownloadStatus::COMPLETE, 0, 0); + d->mUpdateFunction(d->mPtr, DownloadStatus::Complete, 0, 0); } return 0; diff --git a/src/net/downloadstatus.h b/src/net/downloadstatus.h index 8c5066915..c927c0f19 100644 --- a/src/net/downloadstatus.h +++ b/src/net/downloadstatus.h @@ -26,13 +26,13 @@ namespace DownloadStatus { enum Type { - CANCELLED = -3, - THREAD_ERROR = -2, - ERROR = -1, - STARTING = 0, - IDLE, - COMPLETE + Cancelled = -3, + ThreadError = -2, + Error = -1, + Starting = 0, + Idle, + Complete }; -} // namespace Net +} // namespace DownloadStatus #endif // NET_DOWNLOADSTATUS_H diff --git a/src/net/ea/equipbackend.h b/src/net/ea/equipbackend.h index ff1813500..5a557eaa6 100644 --- a/src/net/ea/equipbackend.h +++ b/src/net/ea/equipbackend.h @@ -27,6 +27,9 @@ #include "inventory.h" #include "item.h" +#include "being/playerinfo.h" + +#include "gui/windows/inventorywindow.h" namespace Ea { diff --git a/src/net/ea/inventoryhandler.h b/src/net/ea/inventoryhandler.h index cd32f28a6..e26878f65 100644 --- a/src/net/ea/inventoryhandler.h +++ b/src/net/ea/inventoryhandler.h @@ -23,15 +23,9 @@ #ifndef NET_EA_INVENTORYHANDLER_H #define NET_EA_INVENTORYHANDLER_H -#include "equipment.h" #include "inventory.h" -#include "item.h" #include "localconsts.h" -#include "being/playerinfo.h" - -#include "gui/windows/inventorywindow.h" - #include "net/inventoryhandler.h" #include "net/ea/equipbackend.h" diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index da38cce6a..0ed9f9a18 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -35,7 +35,6 @@ #include "gui/viewport.h" #include "gui/windows/okdialog.h" -#include "gui/windows/npcdialog.h" #include "gui/windows/skilldialog.h" #include "gui/windows/statuswindow.h" @@ -48,7 +47,6 @@ #include "listeners/weightlistener.h" #include "net/messagein.h" -#include "net/net.h" #include "net/ea/eaprotocol.h" diff --git a/src/net/ea/tradehandler.cpp b/src/net/ea/tradehandler.cpp index 48d80c9ee..64e41646a 100644 --- a/src/net/ea/tradehandler.cpp +++ b/src/net/ea/tradehandler.cpp @@ -35,7 +35,6 @@ #include "gui/windows/tradewindow.h" #include "net/messagein.h" -#include "net/net.h" #include "net/ea/eaprotocol.h" diff --git a/src/net/eathena/attrs.h b/src/net/eathena/attrs.h index dc3108ce0..d79e0de27 100644 --- a/src/net/eathena/attrs.h +++ b/src/net/eathena/attrs.h @@ -49,4 +49,4 @@ namespace EAthena }; } // namespace EAthena -#endif // NET_EATHENA_PROTOCOL_H +#endif // NET_EATHENA_ATTRS_H diff --git a/src/net/eathena/generalhandler.cpp b/src/net/eathena/generalhandler.cpp index ea4444ea7..2b54be9cb 100644 --- a/src/net/eathena/generalhandler.cpp +++ b/src/net/eathena/generalhandler.cpp @@ -59,6 +59,7 @@ #include "resources/db/itemdbstat.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "debug.h" diff --git a/src/net/eathena/loginhandler.h b/src/net/eathena/loginhandler.h index 8be4f1397..5a5287da0 100644 --- a/src/net/eathena/loginhandler.h +++ b/src/net/eathena/loginhandler.h @@ -23,8 +23,6 @@ #ifndef NET_EATHENA_LOGINHANDLER_H #define NET_EATHENA_LOGINHANDLER_H -#include "net/loginhandler.h" - #include "net/ea/loginhandler.h" #include "net/eathena/messagehandler.h" diff --git a/src/net/eathena/partyhandler.h b/src/net/eathena/partyhandler.h index dd98a6fce..e80c1ed71 100644 --- a/src/net/eathena/partyhandler.h +++ b/src/net/eathena/partyhandler.h @@ -22,8 +22,6 @@ #ifndef NET_EATHENA_PARTYHANDLER_H #define NET_EATHENA_PARTYHANDLER_H -#include "net/partyhandler.h" - #include "net/eathena/messagehandler.h" #include "net/ea/partyhandler.h" diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index 57b8ee6d5..bc24c8bf2 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -61,6 +61,7 @@ #include "resources/db/itemdbstat.h" +#include "utils/delete2.h" #include "utils/gettext.h" #include "debug.h" diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp index eccbf0928..b9a1e7365 100644 --- a/src/net/tmwa/loginhandler.cpp +++ b/src/net/tmwa/loginhandler.cpp @@ -25,8 +25,6 @@ #include "client.h" #include "logger.h" -#include "net/registrationoptions.h" - #include "net/tmwa/messageout.h" #include "net/tmwa/network.h" #include "net/tmwa/protocol.h" diff --git a/src/net/tmwa/partyhandler.h b/src/net/tmwa/partyhandler.h index 41e42097e..ec8800316 100644 --- a/src/net/tmwa/partyhandler.h +++ b/src/net/tmwa/partyhandler.h @@ -22,8 +22,6 @@ #ifndef NET_TMWA_PARTYHANDLER_H #define NET_TMWA_PARTYHANDLER_H -#include "net/partyhandler.h" - #include "net/tmwa/messagehandler.h" #include "net/ea/partyhandler.h" diff --git a/src/render/surfacegraphics.cpp b/src/render/surfacegraphics.cpp index 2bd59889f..e6aee752f 100644 --- a/src/render/surfacegraphics.cpp +++ b/src/render/surfacegraphics.cpp @@ -25,7 +25,6 @@ #include "main.h" #include "resources/image.h" -#include "resources/imagerect.h" #include "resources/surfaceimagehelper.h" #include "debug.h" diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp index 4987fb5ae..eeac1c73f 100644 --- a/src/resources/db/itemdb.cpp +++ b/src/resources/db/itemdb.cpp @@ -29,7 +29,7 @@ #include "resources/beingcommon.h" #include "resources/iteminfo.h" -#include "resources/spritedef.h" +#include "resources/spritedirection.h" #include "resources/spritereference.h" #include "resources/db/itemdbstat.h" diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp index ca5d122b7..608fb6c20 100644 --- a/src/resources/iteminfo.cpp +++ b/src/resources/iteminfo.cpp @@ -23,7 +23,7 @@ #include "resources/iteminfo.h" #include "resources/spriteaction.h" -#include "resources/spritedef.h" +#include "resources/spritedirection.h" #include "resources/map/mapconsts.h" |