diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-08-24 18:29:30 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-08-24 18:30:16 +0300 |
commit | a316d537dce50f4b4e1e10f5c26a7851baddbd8b (patch) | |
tree | 078de355216db6dab67df9575402cdba7d537dbd /src | |
parent | cb00b6fe126afe5fff8fc7ff491fda6003ea68f2 (diff) | |
download | mv-a316d537dce50f4b4e1e10f5c26a7851baddbd8b.tar.gz mv-a316d537dce50f4b4e1e10f5c26a7851baddbd8b.tar.bz2 mv-a316d537dce50f4b4e1e10f5c26a7851baddbd8b.tar.xz mv-a316d537dce50f4b4e1e10f5c26a7851baddbd8b.zip |
Small style changes.
Also fix overloaded methods visibility.
Diffstat (limited to 'src')
-rw-r--r-- | src/actorspritemanager.cpp | 4 | ||||
-rw-r--r-- | src/auctionmanager.cpp | 2 | ||||
-rw-r--r-- | src/being.cpp | 14 | ||||
-rw-r--r-- | src/channelmanager.cpp | 1 | ||||
-rw-r--r-- | src/client.cpp | 3 | ||||
-rw-r--r-- | src/commandhandler.cpp | 6 | ||||
-rw-r--r-- | src/compoundsprite.cpp | 4 | ||||
-rw-r--r-- | src/gui/minimap.cpp | 2 | ||||
-rw-r--r-- | src/gui/npcdialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/setup.cpp | 3 | ||||
-rw-r--r-- | src/gui/setup_colors.cpp | 1 | ||||
-rw-r--r-- | src/gui/socialwindow.cpp | 27 | ||||
-rw-r--r-- | src/gui/statuswindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/viewport.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/dropshortcutcontainer.h | 3 | ||||
-rw-r--r-- | src/gui/widgets/itemshortcutcontainer.h | 3 | ||||
-rw-r--r-- | src/gui/widgets/spellshortcutcontainer.h | 3 | ||||
-rw-r--r-- | src/gui/widgets/whispertab.h | 3 | ||||
-rw-r--r-- | src/gui/windowmenu.h | 4 | ||||
-rw-r--r-- | src/guichan/widget.cpp | 2 | ||||
-rw-r--r-- | src/guild.cpp | 4 | ||||
-rw-r--r-- | src/localplayer.h | 4 | ||||
-rw-r--r-- | src/playerrelations.cpp | 1 |
23 files changed, 51 insertions, 49 deletions
diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp index 095ce745c..012cdd3e0 100644 --- a/src/actorspritemanager.cpp +++ b/src/actorspritemanager.cpp @@ -335,7 +335,7 @@ Being *ActorSpriteManager::findBeingByPixel(int x, int y, if (!noBeing) { FloorItem *floor = static_cast<FloorItem*>(*it); - if (!noBeing && (floor->getPixelX() - 32 <= x) && + if ((floor->getPixelX() - 32 <= x) && (floor->getPixelX() + 32 > x) && (floor->getPixelY() - 64 <= y) && (floor->getPixelY() + 16 > y)) @@ -1243,7 +1243,7 @@ void ActorSpriteManager::deleteBlock(uint32_t id) { if (*iter == id) { - iter = blockedBeings.erase(iter); + blockedBeings.erase(iter); break; } } diff --git a/src/auctionmanager.cpp b/src/auctionmanager.cpp index 70513ce8c..03068c607 100644 --- a/src/auctionmanager.cpp +++ b/src/auctionmanager.cpp @@ -56,7 +56,7 @@ void AuctionManager::init() val = 0; serverConfig.setValue("enableAuctionBot", val); } - mEnableAuctionBot = val; + mEnableAuctionBot = (val != 0); if (mEnableAuctionBot) auctionManager = new AuctionManager(); } diff --git a/src/being.cpp b/src/being.cpp index 14351aad9..8ec6f7927 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -1818,9 +1818,9 @@ bool Being::updateFromCache() if (entry->isAdvanced()) { int flags = entry->getFlags(); - mShop = (flags & FLAG_SHOP); - mAway = (flags & FLAG_AWAY); - mInactive = (flags & FLAG_INACTIVE); + mShop = ((flags & FLAG_SHOP) != 0); + mAway = ((flags & FLAG_AWAY) != 0); + mInactive = ((flags & FLAG_INACTIVE) != 0); if (mShop || mAway || mInactive) updateName(); } @@ -2027,7 +2027,7 @@ bool Being::drawSpriteAt(Graphics *graphics, int x, int y) const { // show hp bar here int maxHP = mMaxHP; - if (!maxHP && mInfo) + if (!maxHP) maxHP = mInfo->getMaxHP(); drawHpBar(graphics, maxHP, mHP, mDamageTaken, @@ -2517,9 +2517,9 @@ void Being::saveComment(const std::string &name, void Being::setState(uint8_t state) { - bool shop = (state & FLAG_SHOP); - bool away = (state & FLAG_AWAY); - bool inactive = (state & FLAG_INACTIVE); + bool shop = ((state & FLAG_SHOP) != 0); + bool away = ((state & FLAG_AWAY) != 0); + bool inactive = ((state & FLAG_INACTIVE) != 0); bool needUpdate = (shop != mShop || away != mAway || inactive != mInactive); diff --git a/src/channelmanager.cpp b/src/channelmanager.cpp index 83229b454..e4d9601e3 100644 --- a/src/channelmanager.cpp +++ b/src/channelmanager.cpp @@ -90,5 +90,4 @@ void ChannelManager::removeChannel(Channel *channel) { mChannels.remove(channel); delete channel; - channel = nullptr; } diff --git a/src/client.cpp b/src/client.cpp index 13226055a..8a8fcd06c 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -317,7 +317,7 @@ void Client::gameInit() storeSafeParameters(); -#if ENABLE_NLS +#ifdef ENABLE_NLS std::string lang = config.getValue("lang", ""); #ifdef WIN32 if (lang.empty()) @@ -812,7 +812,6 @@ int Client::testsExec() TestLauncher launcher(mOptions.test); return launcher.exec(); } - return 0; } int Client::gameExec() diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp index b1df134b0..0cdda3502 100644 --- a/src/commandhandler.cpp +++ b/src/commandhandler.cpp @@ -786,8 +786,7 @@ void CommandHandler::handleFollow(const std::string &args, ChatTab *tab) if (tab->getType() == ChatTab::TAB_WHISPER) { WhisperTab *wTab = static_cast<WhisperTab*>(tab); - if (wTab) - player_node->setFollow(wTab->getNick()); + player_node->setFollow(wTab->getNick()); } } } @@ -804,8 +803,7 @@ void CommandHandler::handleImitation(const std::string &args, ChatTab *tab) else if (tab && tab->getType() == ChatTab::TAB_WHISPER) { WhisperTab *wTab = static_cast<WhisperTab*>(tab); - if (wTab) - player_node->setImitate(wTab->getNick()); + player_node->setImitate(wTab->getNick()); } else { diff --git a/src/compoundsprite.cpp b/src/compoundsprite.cpp index a6f0c3d77..53caedc47 100644 --- a/src/compoundsprite.cpp +++ b/src/compoundsprite.cpp @@ -175,7 +175,7 @@ int CompoundSprite::getWidth() const for (SpriteConstIterator it = mSprites.begin(), it_end = mSprites.end(); it != it_end; ++ it) { - if ((base = (*it))) + if (base = *it) break; } @@ -192,7 +192,7 @@ int CompoundSprite::getHeight() const for (SpriteConstIterator it = mSprites.begin(), it_end = mSprites.end(); it != it_end; ++ it) { - if ((base = (*it))) + if (base = *it) break; } diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index c834bed64..8cbeebad8 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -278,7 +278,7 @@ void Minimap::draw(gcn::Graphics *graphics) { type = UserPalette::GUILD; } - else if (being) + else { switch (being->getType()) { diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp index b47e78626..166cef5b1 100644 --- a/src/gui/npcdialog.cpp +++ b/src/gui/npcdialog.cpp @@ -695,7 +695,7 @@ void NpcDialog::showAvatar(int avatarId) delete mAvatarBeing; mAvatarBeing = new Being(0, ActorSprite::NPC, avatarId, nullptr); mPlayerBox->setPlayer(mAvatarBeing); - if (mAvatarBeing && !mAvatarBeing->empty()) + if (!mAvatarBeing->empty()) { mAvatarBeing->logic(); Sprite *sprite = mAvatarBeing->getSprite(0); diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index 8c76d89d0..b849823d9 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -50,7 +50,8 @@ extern Window *statusWindow; Setup::Setup(): - Window(_("Setup"), false, nullptr, "setup.xml") + Window(_("Setup"), false, nullptr, "setup.xml"), + mResetWindows(nullptr) { setCloseButton(true); setResizable(true); diff --git a/src/gui/setup_colors.cpp b/src/gui/setup_colors.cpp index f2412b3ff..09468a4a9 100644 --- a/src/gui/setup_colors.cpp +++ b/src/gui/setup_colors.cpp @@ -292,6 +292,7 @@ void Setup_Colors::valueChanged(const gcn::SelectionEvent &event A_UNUSED) case UserPalette::ATTACK_RANGE: case UserPalette::MONSTER_ATTACK_RANGE: mTextPreview->setShadow(false); + break; default: break; } diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index 2c4f1316d..0f32f34a8 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -81,6 +81,20 @@ class SortFriendsFunctor class SocialTab : public Tab { +public: + virtual void invite() = 0; + + virtual void leave() = 0; + + virtual void updateList() = 0; + + virtual void updateAvatar(std::string name) = 0; + + virtual void resetDamage(std::string name) = 0; + + virtual void selectIndex(unsigned num A_UNUSED) + { } + protected: friend class SocialWindow; @@ -109,19 +123,6 @@ protected: } } - virtual void invite() = 0; - - virtual void leave() = 0; - - virtual void updateList() = 0; - - virtual void updateAvatar(std::string name) = 0; - - virtual void resetDamage(std::string name) = 0; - - virtual void selectIndex(unsigned num A_UNUSED) - { } - TextDialog *mInviteDialog; ConfirmDialog *mConfirmDialog; ScrollArea *mScroll; diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index 88b48a472..6354fe42e 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -108,9 +108,9 @@ class ChangeDisplay : public AttrDisplay, gcn::ActionListener void setPointsNeeded(int needed); - private: void action(const gcn::ActionEvent &event); + private: int mNeeded; Label *mPoints; diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 358974707..459f66052 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -281,7 +281,7 @@ void Viewport::_followMouse() { uint8_t button = SDL_GetMouseState(&mMouseX, &mMouseY); // If the left button is dragged - if (mPlayerFollowMouse && button & SDL_BUTTON(1)) + if (mPlayerFollowMouse && (button & SDL_BUTTON(1))) { // We create a mouse event and send it to mouseDragged. uint8_t *keys = SDL_GetKeyState(nullptr); diff --git a/src/gui/widgets/dropshortcutcontainer.h b/src/gui/widgets/dropshortcutcontainer.h index 91e436836..99ff8bd2e 100644 --- a/src/gui/widgets/dropshortcutcontainer.h +++ b/src/gui/widgets/dropshortcutcontainer.h @@ -71,10 +71,11 @@ class DropShortcutContainer : public ShortcutContainer void widgetHidden(const gcn::Event &event); - private: void mouseExited(gcn::MouseEvent &event); + void mouseMoved(gcn::MouseEvent &event); + private: bool mItemClicked; Item *mItemMoved; diff --git a/src/gui/widgets/itemshortcutcontainer.h b/src/gui/widgets/itemshortcutcontainer.h index 255a8090e..1ed0bf627 100644 --- a/src/gui/widgets/itemshortcutcontainer.h +++ b/src/gui/widgets/itemshortcutcontainer.h @@ -72,10 +72,11 @@ class ItemShortcutContainer : public ShortcutContainer void widgetHidden(const gcn::Event &event); - private: void mouseExited(gcn::MouseEvent &event); + void mouseMoved(gcn::MouseEvent &event); + private: bool mItemClicked; Item *mItemMoved; unsigned mNumber; diff --git a/src/gui/widgets/spellshortcutcontainer.h b/src/gui/widgets/spellshortcutcontainer.h index 72fec758f..e8f4cc2dc 100644 --- a/src/gui/widgets/spellshortcutcontainer.h +++ b/src/gui/widgets/spellshortcutcontainer.h @@ -71,10 +71,11 @@ class SpellShortcutContainer : public ShortcutContainer void widgetHidden(const gcn::Event &event); - private: void mouseExited(gcn::MouseEvent &event); + void mouseMoved(gcn::MouseEvent &event); + private: bool mSpellClicked; TextCommand *mSpellMoved; SpellPopup *mSpellPopup; diff --git a/src/gui/widgets/whispertab.h b/src/gui/widgets/whispertab.h index 226ebaf40..85c670db1 100644 --- a/src/gui/widgets/whispertab.h +++ b/src/gui/widgets/whispertab.h @@ -46,11 +46,10 @@ class WhisperTab : public ChatTab void saveToLogFile(std::string &msg); - void getAutoCompleteList(StringVect &names) const; - protected: friend class ChatWindow; + void getAutoCompleteList(StringVect &names) const; /** * Constructor. * diff --git a/src/gui/windowmenu.h b/src/gui/windowmenu.h index e1c78e5f8..3538a9b83 100644 --- a/src/gui/windowmenu.h +++ b/src/gui/windowmenu.h @@ -77,11 +77,11 @@ class WindowMenu : public Container, void saveButtons(); - void drawChildren(gcn::Graphics* graphics); - void optionChanged(const std::string &name); private: + void drawChildren(gcn::Graphics* graphics); + inline void addButton(const char* text, std::string description, int &x, int &h, int key, bool visible = true); diff --git a/src/guichan/widget.cpp b/src/guichan/widget.cpp index 8bae81141..efeb80486 100644 --- a/src/guichan/widget.cpp +++ b/src/guichan/widget.cpp @@ -299,7 +299,7 @@ namespace gcn if (visible) distributeShownEvent(); - else if (!visible) + else distributeHiddenEvent(); mVisible = visible; diff --git a/src/guild.cpp b/src/guild.cpp index 11817c48d..1e577b2b5 100644 --- a/src/guild.cpp +++ b/src/guild.cpp @@ -95,7 +95,7 @@ GuildMember *Guild::addMember(int accountId, int charId, const std::string &name) { GuildMember *m; - if ((m = getMember(accountId, charId))) + if (m = getMember(accountId, charId)) return m; m = new GuildMember(this, accountId, charId, name); @@ -108,7 +108,7 @@ GuildMember *Guild::addMember(int accountId, int charId, GuildMember *Guild::addMember(const std::string &name) { GuildMember *m; - if ((m = getMember(name))) + if (m = getMember(name)) return m; m = new GuildMember(this, name); diff --git a/src/localplayer.h b/src/localplayer.h index 55b29a731..aeae31faf 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -351,8 +351,6 @@ class LocalPlayer : public Being, public ActorSpriteListener, void navigateClean(); - void updateCoords(); - void imitateEmote(Being* being, unsigned char emote); void imitateAction(Being *being, Being::Action action); @@ -512,6 +510,8 @@ class LocalPlayer : public Being, public ActorSpriteListener, std::string getGameModifiersString(); protected: + void updateCoords(); + /** Whether or not the name settings have changed */ bool mUpdateName; diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp index 39bd0bd23..e06f87955 100644 --- a/src/playerrelations.cpp +++ b/src/playerrelations.cpp @@ -68,6 +68,7 @@ class PlayerConfSerialiser : public ConfigurationListManager<std::pair<std::string, PlayerRelation *>, std::map<std::string, PlayerRelation *> *> { +public: virtual ConfigurationObject *writeConfigItem( std::pair<std::string, PlayerRelation *> value, ConfigurationObject *cobj) |