From 3f5c128b889b4cb41f9782fe1531c55e7d07432f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 24 Jan 2015 15:31:06 +0300 Subject: Move inventory type into separate file. --- src/gui/windows/inventorywindow.cpp | 56 ++++++++++++++++++------------------ src/gui/windows/itemamountwindow.cpp | 8 +++--- src/gui/windows/ministatuswindow.cpp | 2 +- src/gui/windows/npcdialog.cpp | 2 +- src/gui/windows/tradewindow.cpp | 4 +-- 5 files changed, 36 insertions(+), 36 deletions(-) (limited to 'src/gui/windows') diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index 80f9cc5fd..535f87f59 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -117,18 +117,18 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : setWindowName(inventory->getName()); switch (inventory->getType()) { - case Inventory::INVENTORY: - case Inventory::TRADE: - case Inventory::NPC: + case InventoryType::INVENTORY: + case InventoryType::TRADE: + case InventoryType::NPC: default: mSortDropDown->setSelected(config.getIntValue( "inventorySortOrder")); break; - case Inventory::STORAGE: + case InventoryType::STORAGE: mSortDropDown->setSelected(config.getIntValue( "storageSortOrder")); break; - case Inventory::CART: + case InventoryType::CART: mSortDropDown->setSelected(config.getIntValue( "cartSortOrder")); break; @@ -176,7 +176,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : switch (mInventory->getType()) { - case Inventory::INVENTORY: + case InventoryType::INVENTORY: { // TRANSLATORS: inventory button const std::string equip = _("Equip"); @@ -233,7 +233,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : break; } - case Inventory::STORAGE: + case InventoryType::STORAGE: { // TRANSLATORS: storage button mStoreButton = new Button(this, _("Store"), "store", this); @@ -255,7 +255,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : break; } - case Inventory::CART: + case InventoryType::CART: { // TRANSLATORS: storage button mStoreButton = new Button(this, _("Store"), "store", this); @@ -278,8 +278,8 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : } default: - case Inventory::TRADE: - case Inventory::NPC: + case InventoryType::TRADE: + case InventoryType::NPC: break; }; @@ -310,7 +310,7 @@ void InventoryWindow::postInit() mItems->setSortType(mSortDropDown->getSelected()); widgetResized(Event(nullptr)); - if (mInventory->getType() == Inventory::INVENTORY) + if (mInventory->getType() == InventoryType::INVENTORY) setVisible(true); } @@ -332,18 +332,18 @@ void InventoryWindow::storeSortOrder() const { switch (mInventory->getType()) { - case Inventory::INVENTORY: - case Inventory::TRADE: - case Inventory::NPC: + case InventoryType::INVENTORY: + case InventoryType::TRADE: + case InventoryType::NPC: default: config.setValue("inventorySortOrder", mSortDropDown->getSelected()); break; - case Inventory::STORAGE: + case InventoryType::STORAGE: config.setValue("storageSortOrder", mSortDropDown->getSelected()); break; - case Inventory::CART: + case InventoryType::CART: config.setValue("cartSortOrder", mSortDropDown->getSelected()); break; @@ -421,9 +421,9 @@ void InventoryWindow::action(const ActionEvent &event) { if (isStorageActive()) { - inventoryHandler->moveItem2(Inventory::INVENTORY, + inventoryHandler->moveItem2(InventoryType::INVENTORY, item->getInvIndex(), item->getQuantity(), - Inventory::STORAGE); + InventoryType::STORAGE); } else { @@ -526,9 +526,9 @@ void InventoryWindow::mouseClicked(MouseEvent &event) } else { - inventoryHandler->moveItem2(Inventory::INVENTORY, + inventoryHandler->moveItem2(InventoryType::INVENTORY, item->getInvIndex(), item->getQuantity(), - Inventory::STORAGE); + InventoryType::STORAGE); } } else @@ -540,9 +540,9 @@ void InventoryWindow::mouseClicked(MouseEvent &event) } else { - inventoryHandler->moveItem2(Inventory::STORAGE, + inventoryHandler->moveItem2(InventoryType::STORAGE, item->getInvIndex(), item->getQuantity(), - Inventory::INVENTORY); + InventoryType::INVENTORY); } } } @@ -711,23 +711,23 @@ void InventoryWindow::close() { switch (mInventory->getType()) { - case Inventory::INVENTORY: - case Inventory::CART: + case InventoryType::INVENTORY: + case InventoryType::CART: setVisible(false); break; - case Inventory::STORAGE: + case InventoryType::STORAGE: if (inventoryHandler) { - inventoryHandler->closeStorage(Inventory::STORAGE); + inventoryHandler->closeStorage(InventoryType::STORAGE); inventoryHandler->forgotStorage(); } scheduleDelete(); break; default: - case Inventory::TRADE: - case Inventory::NPC: + case InventoryType::TRADE: + case InventoryType::NPC: break; } } diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp index 0715a2bbe..19d18eef8 100644 --- a/src/gui/windows/itemamountwindow.cpp +++ b/src/gui/windows/itemamountwindow.cpp @@ -69,12 +69,12 @@ void ItemAmountWindow::finish(const Item *const item, inventoryHandler->splitItem(item, amount); break; case StoreAdd: - inventoryHandler->moveItem2(Inventory::INVENTORY, - item->getInvIndex(), amount, Inventory::STORAGE); + inventoryHandler->moveItem2(InventoryType::INVENTORY, + item->getInvIndex(), amount, InventoryType::STORAGE); break; case StoreRemove: - inventoryHandler->moveItem2(Inventory::STORAGE, - item->getInvIndex(), amount, Inventory::INVENTORY); + inventoryHandler->moveItem2(InventoryType::STORAGE, + item->getInvIndex(), amount, InventoryType::INVENTORY); break; case ShopBuyAdd: if (shopWindow) diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp index 02f1f8400..ec2cf05b2 100644 --- a/src/gui/windows/ministatuswindow.cpp +++ b/src/gui/windows/ministatuswindow.cpp @@ -527,7 +527,7 @@ void MiniStatusWindow::slotsChanged(Inventory *const inventory) if (!inventory) return; - if (inventory->getType() == Inventory::INVENTORY) + if (inventory->getType() == InventoryType::INVENTORY) StatusWindow::updateInvSlotsBar(mInvSlotsBar); } diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index 6eeb3153f..fa5cb21d7 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -116,7 +116,7 @@ NpcDialog::NpcDialog(const int npcId) : mButton3(new Button(this, _("Add"), "add", this)), // TRANSLATORS: npc dialog button mResetButton(new Button(this, _("Reset"), "reset", this)), - mInventory(new Inventory(Inventory::NPC, 1)), + mInventory(new Inventory(InventoryType::NPC, 1)), mItemContainer(new ItemContainer(this, mInventory)), mItemScrollArea(new ScrollArea(this, mItemContainer, getOptionBool("showitemsbackground"), "npc_listbackground.xml")), diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp index 1ed169181..c15e56f44 100644 --- a/src/gui/windows/tradewindow.cpp +++ b/src/gui/windows/tradewindow.cpp @@ -75,8 +75,8 @@ TradeWindow::TradeWindow() : Window(_("Trade: You"), false, nullptr, "trade.xml"), ActionListener(), SelectionListener(), - mMyInventory(new Inventory(Inventory::TRADE)), - mPartnerInventory(new Inventory(Inventory::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 -- cgit v1.2.3-70-g09d2