summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/charselectdialog.cpp4
-rw-r--r--src/gui/charselectdialog.h7
-rw-r--r--src/main.cpp8
3 files changed, 14 insertions, 5 deletions
diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp
index e20ec849..66370a79 100644
--- a/src/gui/charselectdialog.cpp
+++ b/src/gui/charselectdialog.cpp
@@ -270,10 +270,10 @@ bool CharSelectDialog::selectByName(const std::string &name)
return false;
}
-void CharSelectDialog::chooseSelected()
+bool CharSelectDialog::chooseSelected()
{
if (!mCharInfo->getSize())
- return;
+ return false;
setVisible(false);
attemptCharSelect();
diff --git a/src/gui/charselectdialog.h b/src/gui/charselectdialog.h
index d16453a6..e2803cfc 100644
--- a/src/gui/charselectdialog.h
+++ b/src/gui/charselectdialog.h
@@ -66,7 +66,12 @@ class CharSelectDialog : public Window, public gcn::ActionListener,
bool selectByName(const std::string &name);
- void chooseSelected();
+ /**
+ * Send selection to character server
+ * @return false if the selection or the number of existing character
+ * is empty.
+ */
+ bool chooseSelected();
void update(int slot = -1);
diff --git a/src/main.cpp b/src/main.cpp
index 69b45091..af1057a7 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1073,8 +1073,12 @@ int main(int argc, char *argv[])
}
else
{
- ((CharSelectDialog*) currentDialog)->selectByName(
- config.getValue("lastCharacter", ""));
+ if (((CharSelectDialog*) currentDialog)->selectByName(
+ config.getValue("lastCharacter", "")))
+ {
+ if (options.chooseDefault)
+ ((CharSelectDialog*) currentDialog)->chooseSelected();
+ }
}
break;