From d70d41864853924a456595875b6811b74222dd7c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 30 Jan 2015 22:15:24 +0300 Subject: Fix code style. --- src/actions/actions.cpp | 8 +++++--- src/being/being.cpp | 2 +- src/gui/popups/popupmenu.cpp | 2 ++ src/gui/widgets/itemcontainer.cpp | 4 +++- src/gui/windows/inventorywindow.cpp | 16 ++++++++++++---- src/gui/windows/itemamountwindow.cpp | 1 - src/gui/windows/shopwindow.cpp | 2 +- src/gui/windows/shopwindow.h | 1 - src/inventory.cpp | 11 +++++++++++ src/net/ea/inventoryhandler.h | 1 - src/net/eathena/inventoryhandler.cpp | 2 +- src/net/tmwa/inventoryhandler.cpp | 3 ++- 12 files changed, 38 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index 2cff275f5..036f107b8 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -726,7 +726,7 @@ impHandler(attack) return true; } -impHandler0(targetAttack) +impHandler(targetAttack) { if (localPlayer && actorManager) { @@ -1439,7 +1439,8 @@ impHandler(useItemInv) impHandler(invToStorage) { Item *item = nullptr; - const int amount = getAmountFromEvent(event, item, InventoryType::INVENTORY); + const int amount = getAmountFromEvent(event, item, + InventoryType::INVENTORY); if (amount) { inventoryHandler->moveItem2(InventoryType::INVENTORY, @@ -1458,7 +1459,8 @@ impHandler(invToStorage) impHandler(tradeAdd) { Item *item = nullptr; - const int amount = getAmountFromEvent(event, item, InventoryType::INVENTORY); + const int amount = getAmountFromEvent(event, item, + InventoryType::INVENTORY); if (!item || PlayerInfo::isItemProtected(item->getId())) return true; diff --git a/src/being/being.cpp b/src/being/being.cpp index 616acf99a..c1ccf3c90 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -1575,7 +1575,7 @@ void Being::petLogic() const int time = tick_time; const int thinkTime = mInfo->getThinkTime(); - if (abs(mMoveTime - time) < thinkTime) + if (abs(static_cast(mMoveTime) - time) < thinkTime) return; mMoveTime = time; diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 6e7b94e44..5bed32f13 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -1723,6 +1723,8 @@ void PopupMenu::showPopup(Window *const parent, case InventoryType::CART: case InventoryType::TRADE: + case InventoryType::NPC: + case InventoryType::TYPE_END: default: break; } diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 915116491..64c1ad50a 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -427,6 +427,7 @@ void ItemContainer::mousePressed(MouseEvent &event) src = DRAGDROP_SOURCE_CART; break; default: + case InventoryType::TYPE_END: break; } if (mSelectedIndex == index && mClicks != 2) @@ -525,6 +526,7 @@ void ItemContainer::mouseReleased(MouseEvent &event) dst = DRAGDROP_SOURCE_CART; break; default: + case InventoryType::TYPE_END: break; } int srcContainer = -1; @@ -561,7 +563,7 @@ void ItemContainer::mouseReleased(MouseEvent &event) inventory = PlayerInfo::getCartInventory(); } else if (src == DRAGDROP_SOURCE_CART - && dst == DRAGDROP_SOURCE_STORAGE) + && dst == DRAGDROP_SOURCE_STORAGE) { srcContainer = InventoryType::CART; dstContainer = InventoryType::STORAGE; diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index 0a6c4c37f..bd6bdfc7f 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -120,6 +120,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : case InventoryType::INVENTORY: case InventoryType::TRADE: case InventoryType::NPC: + case InventoryType::TYPE_END: default: mSortDropDown->setSelected(config.getIntValue( "inventorySortOrder")); @@ -207,7 +208,8 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : mShopButton = new Button(this, _("S"), "shop", this); // TRANSLATORS: inventory equipment button mEquipmentButton = new Button(this, _("E"), "equipment", this); - mWeightBar = new ProgressBar(this, 0.0F, 100, 0, Theme::PROG_WEIGHT, + mWeightBar = new ProgressBar(this, 0.0F, 100, 0, + Theme::PROG_WEIGHT, "weightprogressbar.xml", "weightprogressbar_fill.xml"); mWeightBar->setColor(getThemeColor(Theme::WEIGHT_BAR), getThemeColor(Theme::WEIGHT_BAR_OUTLINE)); @@ -247,7 +249,8 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : // TRANSLATORS: storage button mStoreButton = new Button(this, _("Store"), "store", this); // TRANSLATORS: storage button - mRetrieveButton = new Button(this, _("Retrieve"), "retrieve", this); + mRetrieveButton = new Button(this, _("Retrieve"), + "retrieve", this); // TRANSLATORS: storage button mInvCloseButton = new Button(this, _("Close"), "close", this); @@ -269,11 +272,13 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : // TRANSLATORS: storage button mStoreButton = new Button(this, _("Store"), "store", this); // TRANSLATORS: storage button - mRetrieveButton = new Button(this, _("Retrieve"), "retrieve", this); + mRetrieveButton = new Button(this, _("Retrieve"), + "retrieve", this); // TRANSLATORS: storage button mInvCloseButton = new Button(this, _("Close"), "close", this); - mWeightBar = new ProgressBar(this, 0.0F, 100, 0, Theme::PROG_WEIGHT, + mWeightBar = new ProgressBar(this, 0.0F, 100, 0, + Theme::PROG_WEIGHT, "weightprogressbar.xml", "weightprogressbar_fill.xml"); mWeightBar->setColor(getThemeColor(Theme::WEIGHT_BAR), getThemeColor(Theme::WEIGHT_BAR_OUTLINE)); @@ -295,6 +300,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : default: case InventoryType::TRADE: case InventoryType::NPC: + case InventoryType::TYPE_END: break; }; @@ -348,6 +354,7 @@ void InventoryWindow::storeSortOrder() const case InventoryType::INVENTORY: case InventoryType::TRADE: case InventoryType::NPC: + case InventoryType::TYPE_END: default: config.setValue("inventorySortOrder", mSortDropDown->getSelected()); @@ -781,6 +788,7 @@ void InventoryWindow::close() default: case InventoryType::TRADE: case InventoryType::NPC: + case InventoryType::TYPE_END: break; } } diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp index 5b714774c..fe081a799 100644 --- a/src/gui/windows/itemamountwindow.cpp +++ b/src/gui/windows/itemamountwindow.cpp @@ -22,7 +22,6 @@ #include "gui/windows/itemamountwindow.h" -#include "inventory.h" #include "item.h" #include "being/playerinfo.h" diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp index b04e60c59..9240b8e8c 100644 --- a/src/gui/windows/shopwindow.cpp +++ b/src/gui/windows/shopwindow.cpp @@ -37,7 +37,6 @@ #include "gui/widgets/button.h" #include "gui/widgets/checkbox.h" #include "gui/widgets/containerplacer.h" -#include "gui/widgets/label.h" #include "gui/widgets/layout.h" #include "gui/widgets/layouttype.h" #include "gui/widgets/scrollarea.h" @@ -88,6 +87,7 @@ ShopWindow::ShopWindow() : mTradeItem(nullptr), mBuyShopItemList(new ShopListBox(this, mBuyShopItems, mBuyShopItems)), mSellShopItemList(new ShopListBox(this, mSellShopItems, mSellShopItems)), + mCurrentShopItemList(nullptr), mScrollArea(new ScrollArea(this, mBuyShopItemList, getOptionBool("showbuybackground"), "shop_buy_background.xml")), // TRANSLATORS: shop window label diff --git a/src/gui/windows/shopwindow.h b/src/gui/windows/shopwindow.h index 8ab765e3c..a3409bbe7 100644 --- a/src/gui/windows/shopwindow.h +++ b/src/gui/windows/shopwindow.h @@ -31,7 +31,6 @@ class Button; class CheckBox; class Item; -class Label; class ScrollArea; class ShopItem; class ShopItems; diff --git a/src/inventory.cpp b/src/inventory.cpp index c6376825c..7969dfcc3 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -293,6 +293,7 @@ std::string Inventory::getName() const switch (mType) { case InventoryType::INVENTORY: + case InventoryType::TYPE_END: default: { // TRANSLATORS: inventory type name @@ -308,6 +309,16 @@ std::string Inventory::getName() const // TRANSLATORS: inventory type name return N_("Cart"); } + case InventoryType::NPC: + { + // TRANSLATORS: inventory type name + return N_("Npc"); + } + case InventoryType::TRADE: + { + // TRANSLATORS: inventory type name + return N_("Trade"); + } } } diff --git a/src/net/ea/inventoryhandler.h b/src/net/ea/inventoryhandler.h index be9fb0e52..c8aadc514 100644 --- a/src/net/ea/inventoryhandler.h +++ b/src/net/ea/inventoryhandler.h @@ -23,7 +23,6 @@ #ifndef NET_EA_INVENTORYHANDLER_H #define NET_EA_INVENTORYHANDLER_H -#include "inventory.h" #include "localconsts.h" #include "net/inventoryhandler.h" diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp index 030925965..bcf5806a5 100644 --- a/src/net/eathena/inventoryhandler.cpp +++ b/src/net/eathena/inventoryhandler.cpp @@ -798,7 +798,7 @@ void InventoryHandler::processCartInfo(Net::MessageIn &msg) void InventoryHandler::processCartRemove(Net::MessageIn &msg A_UNUSED) { - //+++ need close or clear cart? + // +++ need close or clear cart? } void InventoryHandler::processPlayerCartAdd(Net::MessageIn &msg) diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 7821d9aca..b0dcca900 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -223,7 +223,8 @@ void InventoryHandler::closeStorage(const int type A_UNUSED) const void InventoryHandler::moveItem2(const int source, const int slot, const int amount, const int destination) const { - if (source == InventoryType::INVENTORY && destination == InventoryType::STORAGE) + if (source == InventoryType::INVENTORY + && destination == InventoryType::STORAGE) { createOutPacket(CMSG_MOVE_TO_STORAGE); outMsg.writeInt16(static_cast(slot + INVENTORY_OFFSET), -- cgit v1.2.3-60-g2f50