summaryrefslogtreecommitdiff
path: root/src/gui/shortcut/itemshortcut.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-08-08 20:18:08 +0300
committerAndrei Karas <akaras@inbox.ru>2017-08-08 20:18:08 +0300
commit91e74d8f1dc3f1fe01cb65822913488f5cbc5657 (patch)
tree7cd1485d11ca1915504ba6ed6e92c0d7ca0d97d0 /src/gui/shortcut/itemshortcut.cpp
parentd1dcddb018c74aebf0ffb2bbde1501685372c2d8 (diff)
downloadplus-91e74d8f1dc3f1fe01cb65822913488f5cbc5657.tar.gz
plus-91e74d8f1dc3f1fe01cb65822913488f5cbc5657.tar.bz2
plus-91e74d8f1dc3f1fe01cb65822913488f5cbc5657.tar.xz
plus-91e74d8f1dc3f1fe01cb65822913488f5cbc5657.zip
Use size_t type for index in itemshortcut.
Diffstat (limited to 'src/gui/shortcut/itemshortcut.cpp')
-rw-r--r--src/gui/shortcut/itemshortcut.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/gui/shortcut/itemshortcut.cpp b/src/gui/shortcut/itemshortcut.cpp
index 2f80f6759..7139fd74e 100644
--- a/src/gui/shortcut/itemshortcut.cpp
+++ b/src/gui/shortcut/itemshortcut.cpp
@@ -147,7 +147,7 @@ void ItemShortcut::clear()
}
}
-void ItemShortcut::useItem(const int index) const
+void ItemShortcut::useItem(const size_t index) const
{
const Inventory *const inv = PlayerInfo::getInventory();
if (inv == nullptr)
@@ -177,7 +177,7 @@ void ItemShortcut::useItem(const int index) const
}
}
-void ItemShortcut::equipItem(const int index) const
+void ItemShortcut::equipItem(const size_t index) const
{
const Inventory *const inv = PlayerInfo::getInventory();
if (inv == nullptr)
@@ -197,7 +197,7 @@ void ItemShortcut::equipItem(const int index) const
}
}
}
-void ItemShortcut::unequipItem(const int index) const
+void ItemShortcut::unequipItem(const size_t index) const
{
const Inventory *const inv = PlayerInfo::getInventory();
if (inv == nullptr)
@@ -232,14 +232,14 @@ void ItemShortcut::setItemSelected(const Item *const item)
}
}
-void ItemShortcut::setItem(const int index)
+void ItemShortcut::setItem(const size_t index)
{
mItems[index] = mItemSelected;
mItemColors[index] = mItemColorSelected;
save();
}
-void ItemShortcut::setItem(const int index,
+void ItemShortcut::setItem(const size_t index,
const int item,
const ItemColor color)
{
@@ -256,11 +256,11 @@ void ItemShortcut::setItemFast(const size_t index,
mItemColors[index] = color;
}
-void ItemShortcut::swap(const int index1, const int index2)
+void ItemShortcut::swap(const size_t index1,
+ const size_t index2)
{
- if (index1 < 0 || index2 < 0
- || CAST_U32(index1) >= SHORTCUT_ITEMS
- || CAST_U32(index2) >= SHORTCUT_ITEMS)
+ if (CAST_U32(index1) >= SHORTCUT_ITEMS ||
+ CAST_U32(index2) >= SHORTCUT_ITEMS)
{
return;
}
@@ -285,5 +285,5 @@ size_t ItemShortcut::getFreeIndex() const
if (mItems[i] < 0)
return i;
}
- return -1;
+ return SHORTCUT_ITEMS;
}