summaryrefslogtreecommitdiff
path: root/src/game-server
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2010-09-22 00:02:05 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2010-09-22 00:02:05 +0200
commit4b0892691729e5efba27c796e29002b1e1d54166 (patch)
tree80daf14e04fdb7dbc76a16759ed310fec20d5ce7 /src/game-server
parent4c0ba5cf58f09926f5b06ed0e91a5f7d6878c1f8 (diff)
downloadmanaserv-4b0892691729e5efba27c796e29002b1e1d54166.tar.gz
manaserv-4b0892691729e5efba27c796e29002b1e1d54166.tar.bz2
manaserv-4b0892691729e5efba27c796e29002b1e1d54166.tar.xz
manaserv-4b0892691729e5efba27c796e29002b1e1d54166.zip
Centralized the servers' exit values.
Also made random code format clean-ups. Resolves: Mana-Mantis #217 Reviewed-by: Jaxad0127.
Diffstat (limited to 'src/game-server')
-rw-r--r--src/game-server/accountconnection.cpp14
-rw-r--r--src/game-server/attributemanager.cpp4
-rw-r--r--src/game-server/main-game.cpp14
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;
}