diff options
author | Andrei Karas <akaras@inbox.ru> | 2009-12-20 04:32:22 +0200 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-12-27 10:40:04 -0700 |
commit | 84adedb3f7c351fc9c4f50828c73640530b706d9 (patch) | |
tree | 6ec05d22882848e3a8933d105638bdf094be91e6 | |
parent | 5f5f174e9143dd76ea1667077d72b8433ee6d952 (diff) | |
download | mana-client-84adedb3f7c351fc9c4f50828c73640530b706d9.tar.gz mana-client-84adedb3f7c351fc9c4f50828c73640530b706d9.tar.bz2 mana-client-84adedb3f7c351fc9c4f50828c73640530b706d9.tar.xz mana-client-84adedb3f7c351fc9c4f50828c73640530b706d9.zip |
Fix double servers list in ServerDialog
-rw-r--r-- | src/gui/serverdialog.cpp | 6 | ||||
-rw-r--r-- | src/net/serverinfo.h | 11 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index 32e714c6..bbbf132d 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -108,6 +108,7 @@ ServerDialog::ServerDialog(ServerInfo *serverInfo, const std::string &dir): currentConfig = "MostUsedServerPort" + toString(i); currentServer.port = (short) config.getValue(currentConfig, DEFAULT_PORT); + currentServer.type = ServerInfo::getCurrentType(); if (!currentServer.hostname.empty() && currentServer.port != 0) { @@ -207,6 +208,7 @@ void ServerDialog::action(const gcn::ActionEvent &event) ServerInfo tempServer; currentServer.hostname = mServerNameField->getText(); currentServer.port = (short) atoi(mPortField->getText().c_str()); + currentServer.type = ServerInfo::getCurrentType(); // now rewrite the configuration... // id = 0 is always the last selected server @@ -384,11 +386,11 @@ void ServerDialog::loadServers() { if (xmlStrEqual(subnode->name, BAD_CAST "connection")) { - if (compareStrI(type, "manaserv")) + if (!compareStrI(type, "manaserv")) { currentServer.type = ServerInfo::MANASERV; } - else if (compareStrI(type, "eathena")) + else if (!compareStrI(type, "eathena")) { currentServer.type = ServerInfo::EATHENA; } diff --git a/src/net/serverinfo.h b/src/net/serverinfo.h index 82d11fec..25b4e9a8 100644 --- a/src/net/serverinfo.h +++ b/src/net/serverinfo.h @@ -25,6 +25,8 @@ #include <string> #include <vector> +#include "utils/stringutils.h" + class ServerInfo { public: @@ -72,6 +74,15 @@ public: return (type != other.type || hostname != other.hostname || port != other.port); } + + Type static getCurrentType() + { +#ifdef MANASERV_SUPPORT + return MANASERV; +#else + return EATHENA; +#endif + } }; typedef std::vector<ServerInfo> ServerInfos; |