diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-11-16 22:17:15 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-11-16 22:17:15 +0300 |
commit | 5e8e53f6e795a84ab5ca6cfe0d08672878044707 (patch) | |
tree | 23f5a196c6a288ef52cea2742b02ddbc52b2db61 /src/gui/windows | |
parent | 0c063cf5b45a843485fe3343e5fb79a40141f88c (diff) | |
download | mv-5e8e53f6e795a84ab5ca6cfe0d08672878044707.tar.gz mv-5e8e53f6e795a84ab5ca6cfe0d08672878044707.tar.bz2 mv-5e8e53f6e795a84ab5ca6cfe0d08672878044707.tar.xz mv-5e8e53f6e795a84ab5ca6cfe0d08672878044707.zip |
Convert InventoryType enum into strong typed.
Diffstat (limited to 'src/gui/windows')
-rw-r--r-- | src/gui/windows/equipmentwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/inventorywindow.cpp | 117 | ||||
-rw-r--r-- | src/gui/windows/itemamountwindow.cpp | 16 | ||||
-rw-r--r-- | src/gui/windows/maileditwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/ministatuswindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/npcdialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/tradewindow.cpp | 4 |
7 files changed, 76 insertions, 69 deletions
diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp index 4bd285b8f..b3accf9ed 100644 --- a/src/gui/windows/equipmentwindow.cpp +++ b/src/gui/windows/equipmentwindow.cpp @@ -489,7 +489,7 @@ void EquipmentWindow::mousePressed(MouseEvent& event) else { popupMenu->showPopup(this, mx, my, item, - InventoryType::INVENTORY); + InventoryType::Inventory); } return; } diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index 6f1cac84d..4770ef69a 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -117,24 +117,24 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : setWindowName(inventory->getName()); switch (inventory->getType()) { - case InventoryType::INVENTORY: - case InventoryType::TRADE: - case InventoryType::NPC: + case InventoryType::Inventory: + case InventoryType::Trade: + case InventoryType::Npc: #ifdef EATHENA_SUPPORT - case InventoryType::VENDING: - case InventoryType::MAIL: + case InventoryType::Vending: + case InventoryType::Mail: #endif - case InventoryType::TYPE_END: + case InventoryType::TypeEnd: default: mSortDropDown->setSelected(config.getIntValue( "inventorySortOrder")); break; - case InventoryType::STORAGE: + case InventoryType::Storage: mSortDropDown->setSelected(config.getIntValue( "storageSortOrder")); break; #ifdef EATHENA_SUPPORT - case InventoryType::CART: + case InventoryType::Cart: mSortDropDown->setSelected(config.getIntValue( "cartSortOrder")); break; @@ -151,7 +151,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : if (setupWindow && inventory && - inventory->getType() != InventoryType::STORAGE) + inventory->getType() != InventoryType::Storage) { setupWindow->registerWindowForReset(this); } @@ -193,7 +193,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : switch (mInventory->getType()) { - case InventoryType::INVENTORY: + case InventoryType::Inventory: { // TRANSLATORS: inventory button const std::string equip = _("Equip"); @@ -257,7 +257,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : break; } - case InventoryType::STORAGE: + case InventoryType::Storage: { // TRANSLATORS: storage button mStoreButton = new Button(this, _("Store"), "store", this); @@ -281,7 +281,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : } #ifdef EATHENA_SUPPORT - case InventoryType::CART: + case InventoryType::Cart: { // TRANSLATORS: storage button mStoreButton = new Button(this, _("Store"), "store", this); @@ -313,13 +313,13 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : #endif default: - case InventoryType::TRADE: - case InventoryType::NPC: + case InventoryType::Trade: + case InventoryType::Npc: #ifdef EATHENA_SUPPORT - case InventoryType::VENDING: - case InventoryType::MAIL: + case InventoryType::Vending: + case InventoryType::Mail: #endif - case InventoryType::TYPE_END: + case InventoryType::TypeEnd: break; }; @@ -351,7 +351,7 @@ void InventoryWindow::postInit() mItems->setSortType(mSortDropDown->getSelected()); widgetResized(Event(nullptr)); - if (mInventory && mInventory->getType() == InventoryType::STORAGE) + if (mInventory && mInventory->getType() == InventoryType::Storage) setVisible(Visible_true); } @@ -373,24 +373,24 @@ void InventoryWindow::storeSortOrder() const { switch (mInventory->getType()) { - case InventoryType::INVENTORY: - case InventoryType::TRADE: - case InventoryType::NPC: + case InventoryType::Inventory: + case InventoryType::Trade: + case InventoryType::Npc: #ifdef EATHENA_SUPPORT - case InventoryType::VENDING: - case InventoryType::MAIL: + case InventoryType::Vending: + case InventoryType::Mail: #endif - case InventoryType::TYPE_END: + case InventoryType::TypeEnd: default: config.setValue("inventorySortOrder", mSortDropDown->getSelected()); break; - case InventoryType::STORAGE: + case InventoryType::Storage: config.setValue("storageSortOrder", mSortDropDown->getSelected()); break; #ifdef EATHENA_SUPPORT - case InventoryType::CART: + case InventoryType::Cart: config.setValue("cartSortOrder", mSortDropDown->getSelected()); break; @@ -480,16 +480,18 @@ void InventoryWindow::action(const ActionEvent &event) { if (isStorageActive()) { - inventoryHandler->moveItem2(InventoryType::INVENTORY, - item->getInvIndex(), item->getQuantity(), - InventoryType::STORAGE); + inventoryHandler->moveItem2(InventoryType::Inventory, + item->getInvIndex(), + item->getQuantity(), + InventoryType::Storage); } #ifdef EATHENA_SUPPORT else if (cartWindow && cartWindow->isWindowVisible()) { - inventoryHandler->moveItem2(InventoryType::INVENTORY, - item->getInvIndex(), item->getQuantity(), - InventoryType::CART); + inventoryHandler->moveItem2(InventoryType::Inventory, + item->getInvIndex(), + item->getQuantity(), + InventoryType::Cart); } else #endif @@ -598,13 +600,15 @@ void InventoryWindow::mouseClicked(MouseEvent &event) if (event.getButton() == MouseButton::RIGHT) { ItemAmountWindow::showWindow(ItemAmountWindow::StoreAdd, - inventoryWindow, item); + inventoryWindow, + item); } else { - inventoryHandler->moveItem2(InventoryType::INVENTORY, - item->getInvIndex(), item->getQuantity(), - InventoryType::STORAGE); + inventoryHandler->moveItem2(InventoryType::Inventory, + item->getInvIndex(), + item->getQuantity(), + InventoryType::Storage); } } else @@ -616,9 +620,10 @@ void InventoryWindow::mouseClicked(MouseEvent &event) } else { - inventoryHandler->moveItem2(InventoryType::STORAGE, - item->getInvIndex(), item->getQuantity(), - InventoryType::INVENTORY); + inventoryHandler->moveItem2(InventoryType::Storage, + item->getInvIndex(), + item->getQuantity(), + InventoryType::Inventory); } } } @@ -793,30 +798,30 @@ void InventoryWindow::close() switch (mInventory->getType()) { - case InventoryType::INVENTORY: + case InventoryType::Inventory: #ifdef EATHENA_SUPPORT - case InventoryType::CART: + case InventoryType::Cart: #endif setVisible(Visible_false); break; - case InventoryType::STORAGE: + case InventoryType::Storage: if (inventoryHandler) { - inventoryHandler->closeStorage(InventoryType::STORAGE); + inventoryHandler->closeStorage(); inventoryHandler->forgotStorage(); } scheduleDelete(); break; default: - case InventoryType::TRADE: - case InventoryType::NPC: + case InventoryType::Trade: + case InventoryType::Npc: #ifdef EATHENA_SUPPORT - case InventoryType::VENDING: - case InventoryType::MAIL: + case InventoryType::Vending: + case InventoryType::Mail: #endif - case InventoryType::TYPE_END: + case InventoryType::TypeEnd: break; } } @@ -825,17 +830,18 @@ void InventoryWindow::updateWeight() { if (!mInventory || !mWeightBar) return; - const InventoryType::Type type = mInventory->getType(); + const InventoryTypeT type = mInventory->getType(); #ifdef EATHENA_SUPPORT - if (type != InventoryType::INVENTORY && type != InventoryType::CART) + if (type != InventoryType::Inventory && + type != InventoryType::Cart) #else - if (type != InventoryType::INVENTORY) + if (type != InventoryType::Inventory) #endif { return; } - const bool isInv = type == InventoryType::INVENTORY; + const bool isInv = type == InventoryType::Inventory; const int total = PlayerInfo::getAttribute(isInv ? Attributes::TOTAL_WEIGHT : Attributes::CART_TOTAL_WEIGHT); const int max = PlayerInfo::getAttribute(isInv @@ -948,11 +954,12 @@ void InventoryWindow::widgetResized(const Event &event) if (!mInventory) return; - const InventoryType::Type type = mInventory->getType(); + const InventoryTypeT type = mInventory->getType(); #ifdef EATHENA_SUPPORT - if (type != InventoryType::INVENTORY && type != InventoryType::CART) + if (type != InventoryType::Inventory && + type != InventoryType::Cart) #else - if (type != InventoryType::INVENTORY) + if (type != InventoryType::Inventory) #endif { return; diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp index a48a6dab2..fba671675 100644 --- a/src/gui/windows/itemamountwindow.cpp +++ b/src/gui/windows/itemamountwindow.cpp @@ -74,12 +74,12 @@ void ItemAmountWindow::finish(const Item *const item, inventoryHandler->splitItem(item, amount); break; case StoreAdd: - inventoryHandler->moveItem2(InventoryType::INVENTORY, - item->getInvIndex(), amount, InventoryType::STORAGE); + inventoryHandler->moveItem2(InventoryType::Inventory, + item->getInvIndex(), amount, InventoryType::Storage); break; case StoreRemove: - inventoryHandler->moveItem2(InventoryType::STORAGE, - item->getInvIndex(), amount, InventoryType::INVENTORY); + inventoryHandler->moveItem2(InventoryType::Storage, + item->getInvIndex(), amount, InventoryType::Inventory); break; case ShopBuyAdd: if (shopWindow) @@ -91,12 +91,12 @@ void ItemAmountWindow::finish(const Item *const item, break; #ifdef EATHENA_SUPPORT case CartAdd: - inventoryHandler->moveItem2(InventoryType::INVENTORY, - item->getInvIndex(), amount, InventoryType::CART); + inventoryHandler->moveItem2(InventoryType::Inventory, + item->getInvIndex(), amount, InventoryType::Cart); break; case CartRemove: - inventoryHandler->moveItem2(InventoryType::CART, - item->getInvIndex(), amount, InventoryType::INVENTORY); + inventoryHandler->moveItem2(InventoryType::Cart, + item->getInvIndex(), amount, InventoryType::Inventory); break; case MailAdd: if (mailEditWindow) diff --git a/src/gui/windows/maileditwindow.cpp b/src/gui/windows/maileditwindow.cpp index de403839b..da7210a43 100644 --- a/src/gui/windows/maileditwindow.cpp +++ b/src/gui/windows/maileditwindow.cpp @@ -66,7 +66,7 @@ MailEditWindow::MailEditWindow() : mSubjectField(new TextField(this)), mMoneyField(new IntTextField(this, 0, 0, 10000000)), mMessageField(new TextField(this)), - mInventory(new Inventory(InventoryType::MAIL, 1)), + mInventory(new Inventory(InventoryType::Mail, 1)), mItemContainer(new ItemContainer(this, mInventory)), mItemScrollArea(new ScrollArea(this, mItemContainer, getOptionBool("showitemsbackground"), "mailedit_listbackground.xml")) diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp index 37e6bccc9..aa544e128 100644 --- a/src/gui/windows/ministatuswindow.cpp +++ b/src/gui/windows/ministatuswindow.cpp @@ -538,7 +538,7 @@ void MiniStatusWindow::slotsChanged(Inventory *const inventory) if (!inventory) return; - if (inventory->getType() == InventoryType::INVENTORY) + if (inventory->getType() == InventoryType::Inventory) StatusWindow::updateInvSlotsBar(mInvSlotsBar); } diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index f2157585d..4f716f32d 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -124,7 +124,7 @@ NpcDialog::NpcDialog(const BeingId npcId) : mButton3(new Button(this, _("Add"), "add", this)), // TRANSLATORS: npc dialog button mResetButton(new Button(this, _("Reset"), "reset", this)), - mInventory(new Inventory(InventoryType::NPC, 1)), + mInventory(new Inventory(InventoryType::Npc, 1)), mItemContainer(new ItemContainer(this, mInventory, 10000, ShowEmptyRows_true)), mItemScrollArea(new ScrollArea(this, mItemContainer, diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp index edd685f30..69cf87848 100644 --- a/src/gui/windows/tradewindow.cpp +++ b/src/gui/windows/tradewindow.cpp @@ -73,8 +73,8 @@ TradeWindow::TradeWindow() : Window(_("Trade: You"), Modal_false, nullptr, "trade.xml"), ActionListener(), SelectionListener(), - mMyInventory(new Inventory(InventoryType::TRADE)), - mPartnerInventory(new Inventory(InventoryType::TRADE)), + mMyInventory(new Inventory(InventoryType::Trade)), + mPartnerInventory(new Inventory(InventoryType::Trade)), mMyItemContainer(new ItemContainer(this, mMyInventory)), mPartnerItemContainer(new ItemContainer(this, mPartnerInventory)), // TRANSLATORS: trade window money label |