summaryrefslogtreecommitdiff
path: root/src/account-server/accounthandler.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2010-12-15 14:35:22 +0100
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2010-12-16 18:25:58 +0100
commit01489b9930025bed3c5bfc34b6c86045cbaccb46 (patch)
tree2820d4a62f0562168cee7b989fd611adfff0da70 /src/account-server/accounthandler.cpp
parentcee7b8909d3591ad851ac7b31753b83fbfdabfa5 (diff)
downloadmanaserv-01489b9930025bed3c5bfc34b6c86045cbaccb46.tar.gz
manaserv-01489b9930025bed3c5bfc34b6c86045cbaccb46.tar.bz2
manaserv-01489b9930025bed3c5bfc34b6c86045cbaccb46.tar.xz
manaserv-01489b9930025bed3c5bfc34b6c86045cbaccb46.zip
Deharcoded the host and port options for each servers.
Changes: ============================================================ For the account server: ------------------------------------------------------------ Old -> New ------------------------------------------------------------ net_accountServerAddress, net_listenHost -> net_accountHost net_accountServerPort -> net_accountListenToClientPort net_accountServerPort +1 -> net_accountListenToGamePort For the game server: ------------------------------------------------------------ Old -> New ------------------------------------------------------------ net_gameServerAddress -> net_gameHost net_gameServerPort -> net_gameListenToClientPort For the chat server: ------------------------------------------------------------ Old -> New ------------------------------------------------------------ -> net_chatHost net_accountServerPort + 2 -> net_chatListenToClientPort Special fallback feature, as requested by Freeyorp: When the net_accountListenToClientPort (default to 9601) is set, the 3 others ports will automatically offset from it, if they're not set, following this rule: net_accountListenToGamePort = net_accountListenToClientPort + 1 net_chatListenToClientPort = net_accountListenToClientPort + 2 net_gameListenToClientPort = net_accountListenToClientPort + 3 Resolves: Mana-Mantis #216. Reviewed-by: Jaxad0127.
Diffstat (limited to 'src/account-server/accounthandler.cpp')
-rw-r--r--src/account-server/accounthandler.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/account-server/accounthandler.cpp b/src/account-server/accounthandler.cpp
index 5b1ccd05..1463b37e 100644
--- a/src/account-server/accounthandler.cpp
+++ b/src/account-server/accounthandler.cpp
@@ -868,11 +868,19 @@ void AccountHandler::handleCharacterSelectMessage(AccountClient &client,
reply.writeString(address);
reply.writeInt16(port);
- // TODO: get correct address and port for the chat server
- reply.writeString(Configuration::getValue("net_accountServerAddress",
+ // Give address and port for the chat server
+ reply.writeString(Configuration::getValue("net_chatHost",
"localhost"));
- reply.writeInt16(Configuration::getValue("net_accountServerPort",
- DEFAULT_SERVER_PORT) + 2);
+
+ // When the chatListenToClientPort is set, we use it.
+ // Otherwise, we use the accountListenToClientPort + 2 if the option is set.
+ // If neither, the DEFAULT_SERVER_PORT + 2 is used.
+ int alternativePort =
+ Configuration::getValue("net_accountListenToClientPort", 0) + 2;
+ if (alternativePort == 2)
+ alternativePort = DEFAULT_SERVER_PORT + 2;
+ reply.writeInt16(Configuration::getValue("net_chatListenToClientPort",
+ alternativePort));
GameServerHandler::registerClient(magic_token, selectedChar);
registerChatClient(magic_token, selectedChar->getName(), acc->getLevel());