diff options
author | Chuck Miller <shadowmil@gmail.com> | 2009-07-20 17:46:18 -0400 |
---|---|---|
committer | Chuck Miller <shadowmil@gmail.com> | 2009-07-20 17:46:18 -0400 |
commit | 575282d29ac181c990dc76de48c68d86ebd64efe (patch) | |
tree | 71430be3751dc84dbf5681f668099efec09cbcb6 /src/game-server/main-game.cpp | |
parent | 5c3f23831986dda46d1c41b8316dd901f1bf3164 (diff) | |
download | manaserv-575282d29ac181c990dc76de48c68d86ebd64efe.tar.gz manaserv-575282d29ac181c990dc76de48c68d86ebd64efe.tar.bz2 manaserv-575282d29ac181c990dc76de48c68d86ebd64efe.tar.xz manaserv-575282d29ac181c990dc76de48c68d86ebd64efe.zip |
Have the game server reconnect with the account-server if account-server is restarted
Diffstat (limited to 'src/game-server/main-game.cpp')
-rw-r--r-- | src/game-server/main-game.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/game-server/main-game.cpp b/src/game-server/main-game.cpp index 12b8c78c..6a223cd0 100644 --- a/src/game-server/main-game.cpp +++ b/src/game-server/main-game.cpp @@ -149,7 +149,11 @@ void initialize() stringFilter = new StringFilter; ResourceManager::initialize(); - MapManager::initialize(DEFAULT_MAPSDB_FILE); + if (MapManager::initialize(DEFAULT_MAPSDB_FILE) < 1) + { + LOG_FATAL("The Game Server can't find any valid/available maps."); + exit(2); + } ItemManager::initialize(DEFAULT_ITEMSDB_FILE); MonsterManager::initialize(DEFAULT_MONSTERSDB_FILE); StatusManager::initialize(DEFAULT_STATUSDB_FILE); @@ -305,6 +309,9 @@ int main(int argc, char *argv[]) // Initialize world timer worldTimer.start(); + // Account connection lost flag + bool accountServerLost = false; + while (running) { elapsedWorldTicks = worldTimer.poll(); @@ -327,6 +334,8 @@ int main(int argc, char *argv[]) if (accountHandler->isConnected()) { + accountServerLost = false; + // Handle all messages that are in the message queues accountHandler->process(); @@ -346,6 +355,16 @@ int main(int argc, char *argv[]) } else { + // If the connection to the account server is lost. + // Every players have to be logged out + if (!accountServerLost) + { + LOG_WARN("Lost connection to the server account. So disconnect players"); + gameHandler->disconnectAll(); + accountServerLost = true; + } + + // Try to reconnect every 200 ticks if (worldTime % 200 == 0) { accountHandler->start(); |