diff options
author | jurkan <jurkan@gmx.de> | 2012-03-21 19:53:50 +0800 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-03-21 22:03:25 +0800 |
commit | 347cb6477d1394148340ed0f4650a6ecfaaaaf94 (patch) | |
tree | 135ec2a0a233b3063ce548a1631935d01eeb6f11 /src/gui/customserverdialog.cpp | |
parent | b3b7a6763ed8d16397965db50a1197f78aaec65a (diff) | |
download | mana-347cb6477d1394148340ed0f4650a6ecfaaaaf94.tar.gz mana-347cb6477d1394148340ed0f4650a6ecfaaaaf94.tar.bz2 mana-347cb6477d1394148340ed0f4650a6ecfaaaaf94.tar.xz mana-347cb6477d1394148340ed0f4650a6ecfaaaaf94.zip |
Added default ports when connecting to a custom server.
When creating a custom server entry, the default port is used if no
other port is specified.
Reviewed-by: Thorbjørn Lindeijer
Mantis-issue: 464
Diffstat (limited to 'src/gui/customserverdialog.cpp')
-rw-r--r-- | src/gui/customserverdialog.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/gui/customserverdialog.cpp b/src/gui/customserverdialog.cpp index 9d56a3ce..e0d25928 100644 --- a/src/gui/customserverdialog.cpp +++ b/src/gui/customserverdialog.cpp @@ -161,12 +161,10 @@ void CustomServerDialog::action(const gcn::ActionEvent &event) if (event.getId() == "addServer") { // Check the given information - if (mServerAddressField->getText().empty() - || mPortField->getText().empty()) + if (mServerAddressField->getText().empty()) { OkDialog *dlg = new OkDialog(_("Error"), - _("Please at least type both the address and the port " - "of the server.")); + _("Please type in at least the address of the server.")); dlg->addActionListener(this); } else @@ -178,7 +176,6 @@ void CustomServerDialog::action(const gcn::ActionEvent &event) serverInfo.name = mNameField->getText(); serverInfo.description = mDescriptionField->getText(); serverInfo.hostname = mServerAddressField->getText(); - serverInfo.port = (short) atoi(mPortField->getText().c_str()); #ifdef MANASERV_SUPPORT switch (mTypeField->getSelected()) { @@ -194,6 +191,10 @@ void CustomServerDialog::action(const gcn::ActionEvent &event) #else serverInfo.type = ServerInfo::TMWATHENA; #endif + if (mPortField->getText().empty()) + serverInfo.port = ServerInfo::defaultPortForServerType(serverInfo.type); + else + serverInfo.port = (short) atoi(mPortField->getText().c_str()); // Tell the server has to be saved serverInfo.save = true; |