summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);