From 45460ca58b3cbf6d92fe3cac1311bbfc9d00e841 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 5 May 2015 17:15:59 +0300 Subject: Build parts of inventorytype.h only if supported server enabled. --- src/enums/inventorytype.h | 2 +- src/gui/popups/popupmenu.cpp | 2 +- src/gui/windows/inventorywindow.cpp | 20 ++++++++++++++++++++ src/gui/windows/itemamountwindow.cpp | 16 ++++++++-------- src/inventory.cpp | 10 +++++----- 5 files changed, 35 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/enums/inventorytype.h b/src/enums/inventorytype.h index 37fad1890..fe24864d3 100644 --- a/src/enums/inventorytype.h +++ b/src/enums/inventorytype.h @@ -29,10 +29,10 @@ namespace InventoryType { INVENTORY = 0, STORAGE, - CART, TRADE, NPC, #ifdef EATHENA_SUPPORT + CART, VENDING, MAIL, #endif diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 591ccf540..5470d7b2e 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -1711,10 +1711,10 @@ void PopupMenu::showPopup(Window *const parent, } break; - case InventoryType::CART: case InventoryType::TRADE: case InventoryType::NPC: #ifdef EATHENA_SUPPORT + case InventoryType::CART: case InventoryType::VENDING: case InventoryType::MAIL: #endif diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index 5712bb436..3ef2dec5e 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -131,10 +131,12 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : mSortDropDown->setSelected(config.getIntValue( "storageSortOrder")); break; +#ifdef EATHENA_SUPPORT case InventoryType::CART: mSortDropDown->setSelected(config.getIntValue( "cartSortOrder")); break; +#endif }; } else @@ -269,6 +271,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : break; } +#ifdef EATHENA_SUPPORT case InventoryType::CART: { // TRANSLATORS: storage button @@ -298,6 +301,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : place(6, 6, mInvCloseButton); break; } +#endif default: case InventoryType::TRADE: @@ -375,10 +379,12 @@ void InventoryWindow::storeSortOrder() const config.setValue("storageSortOrder", mSortDropDown->getSelected()); break; +#ifdef EATHENA_SUPPORT case InventoryType::CART: config.setValue("cartSortOrder", mSortDropDown->getSelected()); break; +#endif }; } } @@ -793,7 +799,9 @@ void InventoryWindow::close() switch (mInventory->getType()) { case InventoryType::INVENTORY: +#ifdef EATHENA_SUPPORT case InventoryType::CART: +#endif setVisible(false); break; @@ -823,8 +831,14 @@ void InventoryWindow::updateWeight() if (!mInventory || !mWeightBar) return; const InventoryType::Type type = mInventory->getType(); +#ifdef EATHENA_SUPPORT if (type != InventoryType::INVENTORY && type != InventoryType::CART) +#else + if (type != InventoryType::INVENTORY) +#endif + { return; + } const bool isInv = type == InventoryType::INVENTORY; const int total = PlayerInfo::getAttribute(isInv @@ -940,8 +954,14 @@ void InventoryWindow::widgetResized(const Event &event) if (!mInventory) return; const InventoryType::Type type = mInventory->getType(); +#ifdef EATHENA_SUPPORT if (type != InventoryType::INVENTORY && type != InventoryType::CART) +#else + if (type != InventoryType::INVENTORY) +#endif + { return; + } if (getWidth() < 600) { diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp index f37e88c46..2933c57a1 100644 --- a/src/gui/windows/itemamountwindow.cpp +++ b/src/gui/windows/itemamountwindow.cpp @@ -74,18 +74,10 @@ void ItemAmountWindow::finish(const Item *const item, inventoryHandler->moveItem2(InventoryType::INVENTORY, item->getInvIndex(), amount, InventoryType::STORAGE); break; - case CartAdd: - inventoryHandler->moveItem2(InventoryType::INVENTORY, - item->getInvIndex(), amount, InventoryType::CART); - break; case StoreRemove: inventoryHandler->moveItem2(InventoryType::STORAGE, item->getInvIndex(), amount, InventoryType::INVENTORY); break; - case CartRemove: - inventoryHandler->moveItem2(InventoryType::CART, - item->getInvIndex(), amount, InventoryType::INVENTORY); - break; case ShopBuyAdd: if (shopWindow) shopWindow->addBuyItem(item, amount, price); @@ -95,6 +87,14 @@ void ItemAmountWindow::finish(const Item *const item, shopWindow->addSellItem(item, amount, price); break; #ifdef EATHENA_SUPPORT + case CartAdd: + inventoryHandler->moveItem2(InventoryType::INVENTORY, + item->getInvIndex(), amount, InventoryType::CART); + break; + case CartRemove: + inventoryHandler->moveItem2(InventoryType::CART, + item->getInvIndex(), amount, InventoryType::INVENTORY); + break; case MailAdd: if (mailEditWindow) mailEditWindow->addItem(item, amount); diff --git a/src/inventory.cpp b/src/inventory.cpp index 66de463a1..c58997ce6 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -305,17 +305,17 @@ std::string Inventory::getName() const // TRANSLATORS: inventory type name return N_("Storage"); } - case InventoryType::CART: - { - // TRANSLATORS: inventory type name - return N_("Cart"); - } case InventoryType::NPC: { // TRANSLATORS: inventory type name return N_("Npc"); } #ifdef EATHENA_SUPPORT + case InventoryType::CART: + { + // TRANSLATORS: inventory type name + return N_("Cart"); + } case InventoryType::MAIL: { // TRANSLATORS: inventory type name -- cgit v1.2.3-60-g2f50