summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-07-27 22:48:12 +0300
committerAndrei Karas <akaras@inbox.ru>2018-07-27 22:48:12 +0300
commit437586e9dad478fd63a96d442ab77b744ce6fec3 (patch)
tree9774f8ab62a23e771b1670e79bae3189ad639850
parent679ab7c8151b70bc9659c3ef4f16350702560a07 (diff)
downloadmanaplus-437586e9dad478fd63a96d442ab77b744ce6fec3.tar.gz
manaplus-437586e9dad478fd63a96d442ab77b744ce6fec3.tar.bz2
manaplus-437586e9dad478fd63a96d442ab77b744ce6fec3.tar.xz
manaplus-437586e9dad478fd63a96d442ab77b744ce6fec3.zip
Fix moving between slots in character selection dialog.
-rw-r--r--src/gui/windows/charselectdialog.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp
index 1359d33e7..cc0119101 100644
--- a/src/gui/windows/charselectdialog.cpp
+++ b/src/gui/windows/charselectdialog.cpp
@@ -381,9 +381,9 @@ void CharSelectDialog::keyPressed(KeyEvent &event)
int idx = mCharacterView->getSelected();
if (idx >= 0)
{
- idx ++;
- if (idx == SLOTS_PER_ROW)
+ if ((idx + 1) % SLOTS_PER_ROW == 0)
break;
+ idx ++;
mCharacterView->show(idx);
updateState();
}
@@ -396,7 +396,7 @@ void CharSelectDialog::keyPressed(KeyEvent &event)
int idx = mCharacterView->getSelected();
if (idx >= 0)
{
- if ((idx == 0) || idx == SLOTS_PER_ROW)
+ if (idx == 0 || idx % SLOTS_PER_ROW == 0)
break;
idx --;
mCharacterView->show(idx);
@@ -426,7 +426,7 @@ void CharSelectDialog::keyPressed(KeyEvent &event)
int idx = mCharacterView->getSelected();
if (idx >= 0)
{
- if (idx >= SLOTS_PER_ROW)
+ if (idx >= mLoginData->characterSlots - SLOTS_PER_ROW)
break;
idx += SLOTS_PER_ROW;
mCharacterView->show(idx);