diff options
Diffstat (limited to 'src/game-server')
-rw-r--r-- | src/game-server/accountconnection.cpp | 14 | ||||
-rw-r--r-- | src/game-server/attributemanager.cpp | 4 | ||||
-rw-r--r-- | src/game-server/main-game.cpp | 14 |
3 files changed, 18 insertions, 14 deletions
diff --git a/src/game-server/accountconnection.cpp b/src/game-server/accountconnection.cpp index 128e3df0..e68d9c3b 100644 --- a/src/game-server/accountconnection.cpp +++ b/src/game-server/accountconnection.cpp @@ -104,19 +104,21 @@ void AccountConnection::processMessage(MessageIn &msg) if (msg.readShort() != DATA_VERSION_OK) { LOG_ERROR("Item database is outdated! Please update to " - "prevent inconsistencies"); - stop(); // disconnect gracefully from account server - exit(1); // stop gameserver to prevent inconsistencies + "prevent inconsistencies"); + stop(); // Disconnect gracefully from account server. + // Stop gameserver to prevent inconsistencies. + exit(EXIT_DB_EXCEPTION); } else { - LOG_DEBUG("Local item database is in sync with account server."); + LOG_DEBUG("Local item database is " + "in sync with account server."); } if (msg.readShort() != PASSWORD_OK) { - LOG_ERROR("This game server sent a invaild password"); + LOG_ERROR("This game server sent a invalid password"); stop(); - exit(1); + exit(EXIT_BAD_CONFIG_PARAMETER); } } break; diff --git a/src/game-server/attributemanager.cpp b/src/game-server/attributemanager.cpp index d24c2645..7e32d4dc 100644 --- a/src/game-server/attributemanager.cpp +++ b/src/game-server/attributemanager.cpp @@ -43,7 +43,7 @@ void AttributeManager::reload() { LOG_FATAL("Attribute Manager: Could not find " << mAttributeReferenceFile << "!"); - exit(3); + exit(EXIT_XML_NOT_FOUND); } XML::Document doc(absPathFile, int()); @@ -52,7 +52,7 @@ void AttributeManager::reload() { LOG_FATAL("Attribute Manager: " << mAttributeReferenceFile << " is not a valid database file!"); - exit(3); + exit(EXIT_XML_BAD_PARAMETER); } LOG_INFO("Loading attribute reference..."); diff --git a/src/game-server/main-game.cpp b/src/game-server/main-game.cpp index 364745d4..db118325 100644 --- a/src/game-server/main-game.cpp +++ b/src/game-server/main-game.cpp @@ -132,7 +132,7 @@ static void initializeConfiguration(std::string configPath = std::string()) { LOG_FATAL("Refusing to run without configuration!" << std::endl << "Invalid config path: " << configPath << "."); - exit(1); + exit(EXIT_CONFIG_NOT_FOUND); } } @@ -142,7 +142,7 @@ static void initializeConfiguration(std::string configPath = std::string()) if (Configuration::getValue("net_password", "") == "") { LOG_FATAL("SECURITY WARNING: 'net_password' not set!"); - exit(3); + exit(EXIT_BAD_CONFIG_PARAMETER); } } @@ -179,7 +179,7 @@ static void initializeServer() if (MapManager::initialize(DEFAULT_MAPSDB_FILE) < 1) { LOG_FATAL("The Game Server can't find any valid/available maps."); - exit(2); + exit(EXIT_MAP_FILE_NOT_FOUND); } attributeManager->initialize(); SkillManager::initialize(DEFAULT_SKILLSDB_FILE); @@ -203,7 +203,7 @@ static void initializeServer() if (enet_initialize() != 0) { LOG_FATAL("An error occurred while initializing ENet"); - exit(2); + exit(EXIT_NET_EXCEPTION); } // Set enet to quit on exit. @@ -263,7 +263,7 @@ static void printHelp() << " - 4. Plus debugging information." << std::endl << " --port <n> : Set the default port to listen on." << std::endl; - exit(0); + exit(EXIT_NORMAL); } struct CommandLineOptions @@ -383,7 +383,7 @@ int main(int argc, char *argv[]) if (!gameHandler->startListen(options.port)) { LOG_FATAL("Unable to create an ENet server host."); - return 3; + return EXIT_NET_EXCEPTION; } // Initialize world timer @@ -463,4 +463,6 @@ int main(int argc, char *argv[]) gameHandler->stopListen(); accountHandler->stop(); deinitializeServer(); + + return EXIT_NORMAL; } |