diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-11-05 11:33:40 -0700 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-11-05 11:33:40 -0700 |
commit | 4e7791905b426792f70b6c29e74e4f31f2f1f1af (patch) | |
tree | cd47f4ec3e210f802089913d9d98d54cdd60fd99 | |
parent | b7481331c65a08d54d5e2ae286923627195076ce (diff) | |
download | manaserv-4e7791905b426792f70b6c29e74e4f31f2f1f1af.tar.gz manaserv-4e7791905b426792f70b6c29e74e4f31f2f1f1af.tar.bz2 manaserv-4e7791905b426792f70b6c29e74e4f31f2f1f1af.tar.xz manaserv-4e7791905b426792f70b6c29e74e4f31f2f1f1af.zip |
Fix handeling of GameServer port
-rw-r--r-- | src/game-server/accountconnection.cpp | 4 | ||||
-rw-r--r-- | src/game-server/accountconnection.hpp | 2 | ||||
-rw-r--r-- | src/game-server/main-game.cpp | 13 |
3 files changed, 11 insertions, 8 deletions
diff --git a/src/game-server/accountconnection.cpp b/src/game-server/accountconnection.cpp index 7a221e53..5f6f28fa 100644 --- a/src/game-server/accountconnection.cpp +++ b/src/game-server/accountconnection.cpp @@ -47,7 +47,7 @@ AccountConnection::~AccountConnection() delete mSyncBuffer; } -bool AccountConnection::start() +bool AccountConnection::start(const int gameServerPort) { const std::string accountServerAddress = Configuration::getValue("net_accountServerAddress", "localhost"); @@ -64,8 +64,6 @@ bool AccountConnection::start() const std::string gameServerAddress = Configuration::getValue("net_gameServerAddress", "localhost"); - const int gameServerPort = - Configuration::getValue("net_gameServerPort", DEFAULT_SERVER_PORT + 3); const std::string password = Configuration::getValue("net_password", "P@s$w0rd"); diff --git a/src/game-server/accountconnection.hpp b/src/game-server/accountconnection.hpp index 1cbe6d82..dda78f7e 100644 --- a/src/game-server/accountconnection.hpp +++ b/src/game-server/accountconnection.hpp @@ -63,7 +63,7 @@ class AccountConnection : public Connection * Initializes a connection to the account server described in the * configuration file. Registers the maps known by MapManager. */ - bool start(); + bool start(const int gameServerPort); /** * Sends data of a given character. diff --git a/src/game-server/main-game.cpp b/src/game-server/main-game.cpp index 07528ecb..891a0329 100644 --- a/src/game-server/main-game.cpp +++ b/src/game-server/main-game.cpp @@ -238,8 +238,7 @@ struct CommandLineOptions { CommandLineOptions(): verbosity(Logger::INFO), - port(Configuration::getValue("net_gameServerPort", - DEFAULT_SERVER_PORT + 3)) + port(0) {} Logger::Level verbosity; @@ -304,6 +303,12 @@ int main(int argc, char *argv[]) // General initialization initialize(); + if (options.port < 1) + { + options.port = Configuration::getValue("net_gameServerPort", + DEFAULT_SERVER_PORT + 3); + } + // Make an initial attempt to connect to the account server // Try again after longer and longer intervals when connection fails. bool isConnected = false; @@ -311,7 +316,7 @@ int main(int argc, char *argv[]) while (!isConnected) { LOG_INFO("Connecting to account server"); - isConnected = accountHandler->start(); + isConnected = accountHandler->start(options.port); if (!isConnected) { LOG_INFO("Retrying in " << ++waittime << " seconds"); @@ -386,7 +391,7 @@ int main(int argc, char *argv[]) // Try to reconnect every 200 ticks if (worldTime % 200 == 0) { - accountHandler->start(); + accountHandler->start(options.port); } } gameHandler->process(); |