diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-02-13 01:11:50 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-02-13 01:11:50 +0300 |
commit | 308e352fbf2fd4f96d797e596fc41083e53e6106 (patch) | |
tree | e874de1b2ebcaec013f6b1c3363faacc698a438d /src | |
parent | c67648bcc2ebd94da7ad90dc1f886b9f8206de8e (diff) | |
download | manaplus-308e352fbf2fd4f96d797e596fc41083e53e6106.tar.gz manaplus-308e352fbf2fd4f96d797e596fc41083e53e6106.tar.bz2 manaplus-308e352fbf2fd4f96d797e596fc41083e53e6106.tar.xz manaplus-308e352fbf2fd4f96d797e596fc41083e53e6106.zip |
Fix code style.
Diffstat (limited to 'src')
-rw-r--r-- | src/actorspritemanager.cpp | 12 | ||||
-rw-r--r-- | src/actorspritemanager.h | 3 | ||||
-rw-r--r-- | src/game.cpp | 2 | ||||
-rw-r--r-- | src/gui/charselectdialog.cpp | 26 | ||||
-rw-r--r-- | src/gui/windowmenu.cpp | 12 | ||||
-rw-r--r-- | src/net/eathena/network.cpp | 4 | ||||
-rw-r--r-- | src/net/eathena/npchandler.cpp | 14 | ||||
-rw-r--r-- | src/net/eathena/npchandler.h | 2 | ||||
-rw-r--r-- | src/net/tmwa/network.cpp | 4 | ||||
-rw-r--r-- | src/resources/npcdb.cpp | 2 | ||||
-rw-r--r-- | src/utils/process.cpp | 1 |
11 files changed, 42 insertions, 40 deletions
diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp index dc6676dfd..4a36d6e1d 100644 --- a/src/actorspritemanager.cpp +++ b/src/actorspritemanager.cpp @@ -611,7 +611,8 @@ bool ActorSpriteManager::pickUpAll(const int x1, const int y1, return finded; } -bool ActorSpriteManager::pickUpNearest(const int x, const int y, int maxdist) const +bool ActorSpriteManager::pickUpNearest(const int x, const int y, + int maxdist) const { if (!player_node) return false; @@ -1553,7 +1554,8 @@ void ActorSpriteManager::rebuildPickupItems() } int ActorSpriteManager::getIndexByName(const std::string &name, - const std::map<std::string, int> &map) const + const std::map<std::string, int> &map) + const { const std::map<std::string, int>::const_iterator i = map.find(name); @@ -1563,7 +1565,8 @@ int ActorSpriteManager::getIndexByName(const std::string &name, return (*i).second; } -int ActorSpriteManager::getPriorityAttackMobIndex(const std::string &name) const +int ActorSpriteManager::getPriorityAttackMobIndex(const std::string &name) + const { return getIndexByName(name, mPriorityAttackMobsMap); } @@ -1643,7 +1646,8 @@ bool ActorSpriteManager::checkForPickup(const FloorItem *const item) const return true; } } - else if (item && mPickupItemsSet.find(item->getName()) != mPickupItemsSet.end()) + else if (item && mPickupItemsSet.find(item->getName()) + != mPickupItemsSet.end()) { return true; } diff --git a/src/actorspritemanager.h b/src/actorspritemanager.h index 0386a93f2..1056a7068 100644 --- a/src/actorspritemanager.h +++ b/src/actorspritemanager.h @@ -289,7 +289,8 @@ class ActorSpriteManager final: public ConfigListener int getAttackMobIndex(const std::string &name) const A_WARN_UNUSED; - int getPriorityAttackMobIndex(const std::string &name) const A_WARN_UNUSED; + int getPriorityAttackMobIndex(const std::string &name) + const A_WARN_UNUSED; int getPickupItemIndex(const std::string &name) const A_WARN_UNUSED; diff --git a/src/game.cpp b/src/game.cpp index 26ce9480e..33aa1ca02 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -946,7 +946,7 @@ void Game::handleInput() Client::resize(event.resize.w, event.resize.h); break; // Active event - case SDL_ACTIVEEVENT: + case SDL_ACTIVEEVENT: handleActive(event); break; // Quit event diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp index c127f9bf8..ffa88cb75 100644 --- a/src/gui/charselectdialog.cpp +++ b/src/gui/charselectdialog.cpp @@ -139,8 +139,8 @@ class CharacterScroller final : public Container, public gcn::ActionListener { public: - CharacterScroller(CharSelectDialog *widget, - std::vector<CharacterDisplay*> *entries) : + CharacterScroller(CharSelectDialog *const widget, + std::vector<CharacterDisplay*> *const entries) : Container(widget), gcn::ActionListener(), mSelectedEntry(nullptr), @@ -168,7 +168,7 @@ class CharacterScroller final : public Container, void show(const int i) { - const int sz = (signed)mCharacterEntries->size(); + const int sz = static_cast<signed>(mCharacterEntries->size()); if (mSelectedEntry) mSelectedEntry->setVisible(false); if (i >= sz) @@ -185,14 +185,13 @@ class CharacterScroller final : public Container, void resize() { - CharacterDisplay *firtChar = (*mCharacterEntries)[0]; + const CharacterDisplay *const firtChar = (*mCharacterEntries)[0]; const int x = (getWidth() - firtChar->getWidth()) / 2; const int y = (getHeight() - firtChar->getHeight()) / 2; FOR_EACHP (std::vector<CharacterDisplay*>::iterator, it, mCharacterEntries) { - CharacterDisplay *character = *it; - character->setPosition(x, y); + (*it)->setPosition(x, y); } const int y2 = (getHeight() - mPrevious->getHeight()) / 2; const int y3 = y2 - 55; @@ -216,7 +215,7 @@ class CharacterScroller final : public Container, } } - int getSelected() + int getSelected() const { return mSelected; } @@ -297,23 +296,20 @@ CharSelectDialog::CharSelectDialog(LoginData *const data): { for (int i = 0; i < static_cast<int>(mLoginData->characterSlots); i++) { - CharacterDisplay *character = new CharacterDisplay(this, this); + CharacterDisplay *const character + = new CharacterDisplay(this, this); character->setVisible(false); mCharacterEntries.push_back(character); -// placer(i % SLOTS_PER_ROW, static_cast<int>(i) / SLOTS_PER_ROW, -// mCharacterEntries[i]); } mCharacterScroller = new CharacterScroller(this, &mCharacterEntries); - mCharacterScroller->setWidth(mainGraphics->getWidth() - 2 * getPadding()); + mCharacterScroller->setWidth(mainGraphics->getWidth() + - 2 * getPadding()); mCharacterScroller->setHeight(200); placer(0, 0, mCharacterScroller); -// placer(0, 0, mCharacterEntries[0]); } reflowLayout(); - addKeyListener(this); - center(); setVisible(true); @@ -673,7 +669,7 @@ bool CharSelectDialog::selectByName(const std::string &name, { if (character->dummy && character->dummy->getName() == name) { - focusCharacter(i); + focusCharacter(static_cast<int>(i)); if (selAction == Choose) attemptCharacterSelect(static_cast<int>(i)); return true; diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index 6139d410a..c9fb9c40c 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -199,12 +199,12 @@ void WindowMenu::action(const gcn::ActionEvent &event) { const std::string &eventId = event.getId(); - std::map <std::string, ButtonInfo*>::iterator + const std::map <std::string, ButtonInfo*>::iterator it = mButtonNames.find(eventId); if (it == mButtonNames.end()) return; - ButtonInfo *const info = (*it).second; + const ButtonInfo *const info = (*it).second; if (!info) return; @@ -296,7 +296,7 @@ void WindowMenu::mouseExited(gcn::MouseEvent& mouseEvent A_UNUSED) void WindowMenu::showButton(const std::string &name, const bool visible) { - ButtonInfo *const info = dynamic_cast<ButtonInfo *const>( + const ButtonInfo *const info = dynamic_cast<ButtonInfo *const>( mButtonNames[name]); if (!info || !info->button) return; @@ -340,7 +340,7 @@ void WindowMenu::loadButtons() it = mButtonNames.begin(), it_end = mButtonNames.end(); it != it_end; ++it) { - ButtonInfo *info = (*it).second; + const ButtonInfo *const info = (*it).second; if (!info || !info->button || info->visible) continue; info->button->setVisible(false); @@ -354,7 +354,7 @@ void WindowMenu::loadButtons() std::string str = config.getValue("windowmenu" + toString(f), ""); if (str == "" || str == "SET") continue; - ButtonInfo *const info = dynamic_cast<ButtonInfo *const>( + const ButtonInfo *const info = dynamic_cast<ButtonInfo *const>( mButtonNames[str]); if (!info || !info->button) continue; @@ -367,7 +367,7 @@ void WindowMenu::loadButtons() it = mButtonNames.begin(), it_end = mButtonNames.end(); it != it_end; ++it) { - ButtonInfo *info = (*it).second; + const ButtonInfo *const info = (*it).second; if (!info || !info->button) continue; Button *const button = info->button; diff --git a/src/net/eathena/network.cpp b/src/net/eathena/network.cpp index b16d36158..57b450f1a 100644 --- a/src/net/eathena/network.cpp +++ b/src/net/eathena/network.cpp @@ -114,10 +114,10 @@ static const int messagesSize = 0xffff; Network *Network::mInstance = nullptr; Network::Network() : - Ea::Network() + Ea::Network(), + mMessageHandlers(new MessageHandler*[messagesSize]) { mInstance = this; - mMessageHandlers = new MessageHandler*[messagesSize]; memset(&mMessageHandlers[0], 0, sizeof(MessageHandler*) * 0xffff); } diff --git a/src/net/eathena/npchandler.cpp b/src/net/eathena/npchandler.cpp index af90c6fd6..530ba0416 100644 --- a/src/net/eathena/npchandler.cpp +++ b/src/net/eathena/npchandler.cpp @@ -67,32 +67,32 @@ void NpcHandler::handleMessage(Net::MessageIn &msg) switch (msg.getId()) { case SMSG_NPC_CHOICE: - npcId = getNpc(msg, true); + getNpc(msg, true); processNpcChoice(msg); break; case SMSG_NPC_MESSAGE: - npcId = getNpc(msg, true); + getNpc(msg, true); processNpcMessage(msg); break; case SMSG_NPC_CLOSE: - npcId = getNpc(msg, false); + getNpc(msg, false); processNpcClose(msg); break; case SMSG_NPC_NEXT: - npcId = getNpc(msg, false); + getNpc(msg, false); processNpcNext(msg); break; case SMSG_NPC_INT_INPUT: - npcId = getNpc(msg, false); + getNpc(msg, false); processNpcIntInput(msg); break; case SMSG_NPC_STR_INPUT: - npcId = getNpc(msg, false); + getNpc(msg, false); processNpcStrInput(msg); break; @@ -101,7 +101,7 @@ void NpcHandler::handleMessage(Net::MessageIn &msg) break; case SMSG_NPC_VIEWPOINT: - npcId = getNpc(msg, true); + getNpc(msg, true); processNpcViewPoint(msg, npcId); break; diff --git a/src/net/eathena/npchandler.h b/src/net/eathena/npchandler.h index 2d5be025d..fc6a3fb6e 100644 --- a/src/net/eathena/npchandler.h +++ b/src/net/eathena/npchandler.h @@ -66,7 +66,7 @@ class NpcHandler final : public MessageHandler, public Ea::NpcHandler void sellItem(int beingId, int itemId, int amount); - int getNpc(Net::MessageIn &msg, bool haveLength) A_WARN_UNUSED; + int getNpc(Net::MessageIn &msg, bool haveLength); void processNpcCutin(Net::MessageIn &msg, int npcId); diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index 40106ebfa..957fdd5a3 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -92,10 +92,10 @@ static const int messagesSize = 0xffff; Network *Network::mInstance = nullptr; Network::Network() : - Ea::Network() + Ea::Network(), + mMessageHandlers(new MessageHandler*[messagesSize]) { mInstance = this; - mMessageHandlers = new MessageHandler*[messagesSize]; memset(&mMessageHandlers[0], 0, sizeof(MessageHandler*) * 0xffff); } diff --git a/src/resources/npcdb.cpp b/src/resources/npcdb.cpp index f2b3f7d2b..9831da06b 100644 --- a/src/resources/npcdb.cpp +++ b/src/resources/npcdb.cpp @@ -154,7 +154,7 @@ BeingInfo *NPCDB::get(const int id) uint16_t NPCDB::getAvatarFor(const int id) { - BeingInfo *const info = get(id); + const BeingInfo *const info = get(id); if (!info) return 0; return info->getAvatarId(); diff --git a/src/utils/process.cpp b/src/utils/process.cpp index 3d667e457..b424b42e3 100644 --- a/src/utils/process.cpp +++ b/src/utils/process.cpp @@ -238,6 +238,7 @@ bool openBrowser(std::string url) bool openBrowser(std::string url) { SDL_ANDROID_OpenBrowser(url.c_str()); + return true; } #elif defined __APPLE__ bool openBrowser(std::string url) |