diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-08-08 21:20:53 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-08-08 21:20:53 +0300 |
commit | 64887d7ee931fa8426d25c4aaf0ee1a767d4a761 (patch) | |
tree | 038eb18058213ccbde5296686d3d687df610aac5 /src/gui/shortcut/shortcutbase.h | |
parent | 91e74d8f1dc3f1fe01cb65822913488f5cbc5657 (diff) | |
download | ManaVerse-64887d7ee931fa8426d25c4aaf0ee1a767d4a761.tar.gz ManaVerse-64887d7ee931fa8426d25c4aaf0ee1a767d4a761.tar.bz2 ManaVerse-64887d7ee931fa8426d25c4aaf0ee1a767d4a761.tar.xz ManaVerse-64887d7ee931fa8426d25c4aaf0ee1a767d4a761.zip |
Use size_t type for index in other shortcut classes.
Diffstat (limited to 'src/gui/shortcut/shortcutbase.h')
-rw-r--r-- | src/gui/shortcut/shortcutbase.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/gui/shortcut/shortcutbase.h b/src/gui/shortcut/shortcutbase.h index 7fb656dbf..90ca41ee7 100644 --- a/src/gui/shortcut/shortcutbase.h +++ b/src/gui/shortcut/shortcutbase.h @@ -25,6 +25,8 @@ #include "enums/simpletypes/itemcolor.h" +#include "utils/cast.h" + #include <string> #include "localconsts.h" @@ -66,17 +68,17 @@ class ShortcutBase notfinal * * @param index Index of the shortcut item. */ - int getItem(const int index) const A_WARN_UNUSED + int getItem(const size_t index) const A_WARN_UNUSED { return mItems[index]; } - ItemColor getItemColor(const int index) const A_WARN_UNUSED + ItemColor getItemColor(const size_t index) const A_WARN_UNUSED { return mItemColors[index]; } /** * Returns the amount of shortcut items. */ int getItemCount() const noexcept2 A_WARN_UNUSED - { return mMaxSize; } + { return CAST_S32(mMaxSize); } /** * Returns the item ID that is currently selected. @@ -89,7 +91,7 @@ class ShortcutBase notfinal * * @param index Index of the items. */ - void setItem(const int index); + void setItem(const size_t index); /** * Adds an item to the items store specified by the index. @@ -97,7 +99,7 @@ class ShortcutBase notfinal * @param index Index of the item. * @param itemId ID of the item. */ - void setItems(const int index, + void setItems(const size_t index, const int itemId, const ItemColor color) { mItems[index] = itemId; mItemColors[index] = color; save(); } @@ -121,7 +123,7 @@ class ShortcutBase notfinal /** * Remove a item from the shortcut. */ - void removeItem(const int index) + void removeItem(const size_t index) { mItems[index] = -1; save(); } void clear(const bool isSave = true); @@ -131,8 +133,8 @@ class ShortcutBase notfinal ItemColor *mItemColors A_NONNULLPOINTER; std::string mItemName; std::string mColorName; + size_t mMaxSize; int mItemSelected; - int mMaxSize; ItemColor mItemColorSelected; }; |