summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/spellshortcut.cpp7
-rw-r--r--src/spellshortcut.h4
2 files changed, 6 insertions, 5 deletions
diff --git a/src/spellshortcut.cpp b/src/spellshortcut.cpp
index 533e071a5..5a3dd6eda 100644
--- a/src/spellshortcut.cpp
+++ b/src/spellshortcut.cpp
@@ -48,18 +48,17 @@ SpellShortcut::~SpellShortcut()
void SpellShortcut::load()
{
- for (unsigned f = 0; f < SPELL_SHORTCUT_ITEMS * SPELL_SHORTCUT_TABS; f ++)
+ for (unsigned f = 0; f < SPELLS_SIZE; f ++)
mItems[f] = -1;
if (!spellManager)
return;
- std::vector<TextCommand*> spells = spellManager->getAll();
+ const std::vector<TextCommand*> spells = spellManager->getAll();
unsigned k = 0;
for (std::vector<TextCommand*>::const_iterator i = spells.begin(),
- i_end = spells.end(); i != i_end
- && k < SPELL_SHORTCUT_ITEMS * SPELL_SHORTCUT_TABS; ++i)
+ i_end = spells.end(); i != i_end && k < SPELLS_SIZE; ++i)
{
mItems[k++] = (*i)->getId();
}
diff --git a/src/spellshortcut.h b/src/spellshortcut.h
index 7393503dc..d5ce35e6e 100644
--- a/src/spellshortcut.h
+++ b/src/spellshortcut.h
@@ -27,6 +27,8 @@
class TextCommand;
+const int SPELLS_SIZE = SPELL_SHORTCUT_ITEMS * SPELL_SHORTCUT_TABS;
+
/**
* The class which keeps track of the item shortcuts.
*/
@@ -81,7 +83,7 @@ class SpellShortcut final
{ return mItems[index]; }
private:
- int mItems[SPELL_SHORTCUT_ITEMS * SPELL_SHORTCUT_TABS];
+ int mItems[SPELLS_SIZE];
int mItemSelected; /**< The item held by cursor. */
};