summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-01-24 16:05:23 +0300
committerAndrei Karas <akaras@inbox.ru>2015-01-24 16:05:23 +0300
commitd6b7cd3b259512cd28e1b5a82861ef8b11b2b7cb (patch)
tree440b21fa9ec5ced1e0222ef42c7aa5f24dbfc39c
parent3f5c128b889b4cb41f9782fe1531c55e7d07432f (diff)
downloadplus-d6b7cd3b259512cd28e1b5a82861ef8b11b2b7cb.tar.gz
plus-d6b7cd3b259512cd28e1b5a82861ef8b11b2b7cb.tar.bz2
plus-d6b7cd3b259512cd28e1b5a82861ef8b11b2b7cb.tar.xz
plus-d6b7cd3b259512cd28e1b5a82861ef8b11b2b7cb.zip
Use InventoryType for inventory type.
-rw-r--r--src/gui/popups/popupmenu.cpp2
-rw-r--r--src/gui/popups/popupmenu.h4
-rw-r--r--src/gui/windows/equipmentwindow.cpp7
-rw-r--r--src/inventory.cpp2
-rw-r--r--src/inventory.h7
5 files changed, 15 insertions, 7 deletions
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index af207dffe..6e7b94e44 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -1612,7 +1612,7 @@ void PopupMenu::handleLink(const std::string &link,
void PopupMenu::showPopup(Window *const parent,
const int x, const int y,
Item *const item,
- const int type)
+ const InventoryType::Type type)
{
if (!item)
return;
diff --git a/src/gui/popups/popupmenu.h b/src/gui/popups/popupmenu.h
index 5b959cdaa..0274d69a4 100644
--- a/src/gui/popups/popupmenu.h
+++ b/src/gui/popups/popupmenu.h
@@ -23,6 +23,8 @@
#ifndef GUI_POPUPS_POPUPMENU_H
#define GUI_POPUPS_POPUPMENU_H
+#include "enums/inventorytype.h"
+
#include "gui/widgets/linkhandler.h"
#include "gui/widgets/popup.h"
@@ -89,7 +91,7 @@ class PopupMenu final : public Popup, public LinkHandler
void showPopup(Window *const parent,
const int x, const int y,
Item *const item,
- const int type);
+ const InventoryType::Type type);
void showPopup(const int x, const int y, Button *const button);
diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp
index ae438dc10..6bec6dfa3 100644
--- a/src/gui/windows/equipmentwindow.cpp
+++ b/src/gui/windows/equipmentwindow.cpp
@@ -430,9 +430,14 @@ void EquipmentWindow::mousePressed(MouseEvent& event)
{
event.consume();
if (mForing)
+ {
popupMenu->showUndressPopup(mx, my, mBeing, item);
+ }
else
- popupMenu->showPopup(this, mx, my, item, true);
+ {
+ popupMenu->showPopup(this, mx, my, item,
+ InventoryType::INVENTORY);
+ }
return;
}
}
diff --git a/src/inventory.cpp b/src/inventory.cpp
index be480f743..c6376825c 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -53,7 +53,7 @@ namespace
};
} // namespace
-Inventory::Inventory(const int type, const int size1) :
+Inventory::Inventory(const InventoryType::Type type, const int size1) :
mInventoryListeners(),
mType(type),
mSize(size1 == -1 ? static_cast<unsigned>(
diff --git a/src/inventory.h b/src/inventory.h
index 8438f63d7..e09fbb673 100644
--- a/src/inventory.h
+++ b/src/inventory.h
@@ -47,7 +47,8 @@ class Inventory final
*
* @param size the number of items that fit in the inventory
*/
- explicit Inventory(const int type, const int size = -1);
+ explicit Inventory(const InventoryType::Type type,
+ const int size = -1);
/**
* Destructor.
@@ -148,7 +149,7 @@ class Inventory final
void removeInventoyListener(InventoryListener *const listener);
- int getType() const A_WARN_UNUSED
+ InventoryType::Type getType() const A_WARN_UNUSED
{ return mType; }
bool isMainInventory() const A_WARN_UNUSED
@@ -168,7 +169,7 @@ class Inventory final
void distributeSlotsChangedEvent();
- int mType;
+ InventoryType::Type mType;
unsigned mSize; /**< The max number of inventory items */
Item **mItems; /**< The holder of items */
int mUsed; /**< THe number of slots in use */