diff options
-rw-r--r-- | docs/example.mana | 1 | ||||
-rw-r--r-- | src/client.cpp | 2 | ||||
-rw-r--r-- | src/gui/serverdialog.cpp | 14 | ||||
-rw-r--r-- | src/gui/theme.cpp | 2 | ||||
-rw-r--r-- | src/net/serverinfo.h | 10 |
5 files changed, 16 insertions, 13 deletions
diff --git a/docs/example.mana b/docs/example.mana index 9802c280..9173efb0 100644 --- a/docs/example.mana +++ b/docs/example.mana @@ -16,6 +16,7 @@ filename / path as a command line parameter <option name="onlineServerList" value="http://manasource.org/serverlist.xml"/> <option name="defaultServer" value="testing.manasource.org"/> <option name="defaultPort" value="9601"/> + <option name="defaultServerType" value="manaserv"/> <option name="defaultUpdateHost" value="http://updates.themanaworld.org"/> <option name="font" value="fonts/dejavusans.ttf" /> <option name="boldFont" value="fonts/dejavusans-bold.ttf" /> diff --git a/src/client.cpp b/src/client.cpp index 2a996c26..ad9a560b 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -394,6 +394,8 @@ Client::Client(const Options &options): { mCurrentServer.port = (short) branding.getValue("defaultPort", DEFAULT_PORT); + mCurrentServer.type = ServerInfo::parseType( + branding.getValue("defaultServerType", "eathena")); } if (loginData.username.empty() && loginData.remember) loginData.username = config.getValue("username", ""); diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index eb6e9b4b..6a6c7a91 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -49,16 +49,6 @@ static const int MAX_SERVERLIST = 6; -static ServerInfo::Type stringToServerType(const std::string &type) -{ - if (compareStrI(type, "eathena") == 0) - return ServerInfo::EATHENA; - else if (compareStrI(type, "manaserv") == 0) - return ServerInfo::MANASERV; - - return ServerInfo::UNKNOWN; -} - static std::string serverTypeToString(ServerInfo::Type type) { switch (type) @@ -448,7 +438,7 @@ void ServerDialog::loadServers() std::string type = XML::getProperty(serverNode, "type", "unknown"); - server.type = stringToServerType(type); + server.type = ServerInfo::parseType(type); server.name = XML::getProperty(serverNode, "name", std::string()); if (server.type == ServerInfo::UNKNOWN) @@ -503,7 +493,7 @@ void ServerDialog::loadCustomServers() ServerInfo server; server.hostname = config.getValue(nameKey, ""); - server.type = stringToServerType(config.getValue(typeKey, "")); + server.type = ServerInfo::parseType(config.getValue(typeKey, "")); const int defaultPort = defaultPortForServerType(server.type); server.port = (unsigned short) config.getValue(portKey, defaultPort); diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 1841f8d9..4e0090e9 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -40,7 +40,7 @@ #include <algorithm> -#define GUI_ROOT "graphics/gui" +#define GUI_ROOT "graphics/gui/" std::string Theme::mThemePath; Theme *Theme::mInstance = 0; diff --git a/src/net/serverinfo.h b/src/net/serverinfo.h index 63d50ce4..803bcc71 100644 --- a/src/net/serverinfo.h +++ b/src/net/serverinfo.h @@ -83,6 +83,16 @@ public: return (type != other.type || hostname != other.hostname || port != other.port); } + + static Type parseType(const std::string &type) + { + if (compareStrI(type, "eathena") == 0) + return EATHENA; + else if (compareStrI(type, "manaserv") == 0) + return MANASERV; + + return UNKNOWN; + } }; typedef std::vector<ServerInfo> ServerInfos; |