From 7cc864e68935b035d69d68aba2f8ad38ce275d5a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 6 Jul 2013 01:30:12 +0300 Subject: fix code style and some minor issues. --- src/animatedsprite_unittest.cc | 1 - src/client.cpp | 5 +++-- src/game.cpp | 1 - src/gui/inventorywindow.cpp | 1 - src/gui/widgets/itemcontainer.cpp | 2 +- src/gui/widgets/shoplistbox.cpp | 2 +- src/gui/widgets/spellshortcutcontainer.cpp | 2 -- src/gui/widgets/spellshortcutcontainer.h | 1 - src/itemshortcut.cpp | 5 +++-- src/net/inventoryhandler.h | 2 ++ src/spellmanager.cpp | 6 +++--- 11 files changed, 13 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/animatedsprite_unittest.cc b/src/animatedsprite_unittest.cc index d429f1329..12449148f 100644 --- a/src/animatedsprite_unittest.cc +++ b/src/animatedsprite_unittest.cc @@ -47,7 +47,6 @@ static void init() imageHelper = new SDLImageHelper(); SDL_SetVideoMode(640, 480, 0, SDL_ANYFORMAT | SDL_SWSURFACE); - Theme *theme = Theme::instance(); } TEST(AnimatedSprite, basic) diff --git a/src/client.cpp b/src/client.cpp index 9eb11d663..37e4f21db 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1704,8 +1704,9 @@ int Client::gameExec() logger->log1("State: UNREGISTER SUCCESS"); Net::getLoginHandler()->disconnect(); - // TRANSLATORS: unregister message header - mCurrentDialog = openErrorDialog(_("Unregister Successful"), + mCurrentDialog = openErrorDialog( + // TRANSLATORS: unregister message header + _("Unregister Successful"), // TRANSLATORS: unregister message text _("Farewell, come back any time..."), true); loginData.clear(); diff --git a/src/game.cpp b/src/game.cpp index 052e20949..08544e8eb 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -614,7 +614,6 @@ void Game::slowLogic() { if (!disconnectedDialog) { - // TRANSLATORS: error message text errorMessage = _("The connection to the server was lost."); disconnectedDialog = Client::openErrorDialog( diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index a9a096d73..f5243a09b 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -278,7 +278,6 @@ InventoryWindow::~InventoryWindow() mSortDropDown->hideDrop(false); delete mSortModel; mSortModel = nullptr; - //delete mTextPopup; mTextPopup = nullptr; } diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 20c8b9052..10a1b7b8d 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -452,7 +452,7 @@ void ItemContainer::mousePressed(gcn::MouseEvent &event) } } -void ItemContainer::mouseDragged(gcn::MouseEvent &event) +void ItemContainer::mouseDragged(gcn::MouseEvent &event A_UNUSED) { if (mSelectionStatus != SEL_NONE) mSelectionStatus = SEL_DRAGGING; diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 6516b056f..e6cbdae4e 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -145,7 +145,7 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics) width, mRowHeight)); } - if (mShopItems) + if (mShopItems && item) { Image *const icon = item->getImage(); if (icon) diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index 436f0c583..afd4e14f4 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -47,7 +47,6 @@ SpellShortcutContainer::SpellShortcutContainer(const unsigned number) : ShortcutContainer(), - mSpellMoved(nullptr), mSpellPopup(new SpellPopup), mNumber(number), mForegroundColor2(getThemeColor(Theme::TEXT_OUTLINE)), @@ -239,7 +238,6 @@ void SpellShortcutContainer::mouseReleased(gcn::MouseEvent &event) if (dragDrop.getSource() == DRAGDROP_SOURCE_SPELLS) { const int oldIndex = dragDrop.getTag(); - const int oldItemId = getItemByIndex(oldIndex); const int idx = mNumber * SPELL_SHORTCUT_ITEMS; if (spellManager) { diff --git a/src/gui/widgets/spellshortcutcontainer.h b/src/gui/widgets/spellshortcutcontainer.h index 509b96c61..57f5b4a13 100644 --- a/src/gui/widgets/spellshortcutcontainer.h +++ b/src/gui/widgets/spellshortcutcontainer.h @@ -82,7 +82,6 @@ class SpellShortcutContainer final : public ShortcutContainer int getItemByIndex(const int index); private: - TextCommand *mSpellMoved; SpellPopup *mSpellPopup; unsigned int mNumber; gcn::Color mForegroundColor2; diff --git a/src/itemshortcut.cpp b/src/itemshortcut.cpp index b373b5cd4..2ba3cbe9a 100644 --- a/src/itemshortcut.cpp +++ b/src/itemshortcut.cpp @@ -230,8 +230,9 @@ void ItemShortcut::setItem(const int index, const int item, void ItemShortcut::swap(const int index1, const int index2) { - if (index1 < 0 || index2 < 0 || (unsigned int)index1 >= SHORTCUT_ITEMS - || (unsigned int)index2 >= SHORTCUT_ITEMS) + if (index1 < 0 || index2 < 0 + || static_cast(index1) >= SHORTCUT_ITEMS + || static_cast(index2) >= SHORTCUT_ITEMS) { return; } diff --git a/src/net/inventoryhandler.h b/src/net/inventoryhandler.h index a8443d691..f4aa88ea0 100644 --- a/src/net/inventoryhandler.h +++ b/src/net/inventoryhandler.h @@ -25,6 +25,8 @@ #include "item.h" +#include "inventory.h" + #include namespace Net diff --git a/src/spellmanager.cpp b/src/spellmanager.cpp index 83fb746a7..23eb90ad1 100644 --- a/src/spellmanager.cpp +++ b/src/spellmanager.cpp @@ -408,13 +408,13 @@ void SpellManager::swap(const int id1, const int id2) spell2->setId(tmp); // swap in vector - const int sz = SPELL_SHORTCUT_ITEMS * SPELL_SHORTCUT_TABS; - for (unsigned f = 0; f < sz; f++) + const size_t sz = SPELL_SHORTCUT_ITEMS * SPELL_SHORTCUT_TABS; + for (size_t f = 0; f < sz; f++) { const TextCommand *const spellA = mSpellsVector[f]; if (spellA == spell1) { - for (unsigned d = 0; d < sz; d++) + for (size_t d = 0; d < sz; d++) { const TextCommand *const spellB = mSpellsVector[d]; if (spellB == spell2) -- cgit v1.2.3-60-g2f50