summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-10-30 17:30:52 +0300
committerAndrei Karas <akaras@inbox.ru>2015-10-30 18:19:54 +0300
commitb0388c5ad0a49f65becdee1120d4df476410dd01 (patch)
tree3e883d2e3ee1ed79569f999e5fdc24a30614cc13 /src/gui
parente196607ec6a16204579f8e37e1c88c133bf1db37 (diff)
downloadplus-b0388c5ad0a49f65becdee1120d4df476410dd01.tar.gz
plus-b0388c5ad0a49f65becdee1120d4df476410dd01.tar.bz2
plus-b0388c5ad0a49f65becdee1120d4df476410dd01.tar.xz
plus-b0388c5ad0a49f65becdee1120d4df476410dd01.zip
Add strong typed bool enum ForceQuantity.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/widgets/itemcontainer.cpp8
-rw-r--r--src/gui/widgets/itemcontainer.h6
2 files changed, 9 insertions, 5 deletions
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 9d8a7e264..d9d2b5f4b 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -159,7 +159,7 @@ namespace
ItemContainer::ItemContainer(const Widget2 *const widget,
Inventory *const inventory,
- const bool forceQuantity) :
+ const ForceQuantity forceQuantity) :
Widget(widget),
KeyListener(),
MouseListener(),
@@ -342,7 +342,8 @@ void ItemContainer::draw(Graphics *graphics)
// Draw item caption
std::string caption;
- if (item->getQuantity() > 1 || mForceQuantity)
+ if (item->getQuantity() > 1 ||
+ mForceQuantity == ForceQuantity_true)
{
caption = toString(item->getQuantity());
}
@@ -460,7 +461,8 @@ void ItemContainer::safeDraw(Graphics *graphics)
// Draw item caption
std::string caption;
- if (item->getQuantity() > 1 || mForceQuantity)
+ if (item->getQuantity() > 1 ||
+ mForceQuantity == ForceQuantity_true)
{
caption = toString(item->getQuantity());
}
diff --git a/src/gui/widgets/itemcontainer.h b/src/gui/widgets/itemcontainer.h
index eb422e269..a8d7c794e 100644
--- a/src/gui/widgets/itemcontainer.h
+++ b/src/gui/widgets/itemcontainer.h
@@ -27,6 +27,8 @@
#include "listeners/mouselistener.h"
#include "listeners/widgetlistener.h"
+#include "enums/simpletypes/forcequantity.h"
+
#include "gui/widgets/widget.h"
#include "localconsts.h"
@@ -57,7 +59,7 @@ class ItemContainer final : public Widget,
*/
ItemContainer(const Widget2 *const widget,
Inventory *const inventory,
- const bool forceQuantity = false);
+ const ForceQuantity forceQuantity = ForceQuantity_false);
A_DELETE_COPY(ItemContainer)
@@ -204,7 +206,7 @@ class ItemContainer final : public Widget,
int mPaddingItemX;
int mPaddingItemY;
SelectionState mSelectionStatus;
- bool mForceQuantity;
+ ForceQuantity mForceQuantity;
bool mDescItems;
bool mRedraw;
};