summaryrefslogtreecommitdiff
path: root/src/game-server
diff options
context:
space:
mode:
Diffstat (limited to 'src/game-server')
-rw-r--r--src/game-server/accountconnection.cpp4
-rw-r--r--src/game-server/being.cpp2
-rw-r--r--src/game-server/gamehandler.cpp6
-rw-r--r--src/game-server/itemmanager.cpp51
-rw-r--r--src/game-server/main-game.cpp26
-rw-r--r--src/game-server/mapmanager.cpp14
-rw-r--r--src/game-server/mapreader.cpp10
7 files changed, 44 insertions, 69 deletions
diff --git a/src/game-server/accountconnection.cpp b/src/game-server/accountconnection.cpp
index 68a1430f..d681cb64 100644
--- a/src/game-server/accountconnection.cpp
+++ b/src/game-server/accountconnection.cpp
@@ -40,7 +40,7 @@ bool AccountConnection::start()
{
return false;
}
- LOG_INFO("Connection established to the account server.", 0);
+ LOG_INFO("Connection established to the account server.");
MessageOut msg(GAMSG_REGISTER);
msg.writeString(config.getValue("gameServerAddress", "localhost"));
msg.writeShort(int(config.getValue("gameServerPort", DEFAULT_SERVER_PORT + 3)));
@@ -94,7 +94,7 @@ void AccountConnection::processMessage(MessageIn &msg)
} break;
default:
- LOG_WARN("Invalid message type", 0);
+ LOG_WARN("Invalid message type");
break;
}
}
diff --git a/src/game-server/being.cpp b/src/game-server/being.cpp
index da8f1f2c..516732aa 100644
--- a/src/game-server/being.cpp
+++ b/src/game-server/being.cpp
@@ -32,7 +32,7 @@ void Being::damage(Damage damage)
mHitpoints -= HPloss;
mHitsTaken.push_back(HPloss);
- LOG_DEBUG("Being " << getPublicID() << " got hit", 0);
+ LOG_DEBUG("Being " << getPublicID() << " got hit");
}
void Being::performAttack(MapComposite *map)
diff --git a/src/game-server/gamehandler.cpp b/src/game-server/gamehandler.cpp
index ae18e893..98a10938 100644
--- a/src/game-server/gamehandler.cpp
+++ b/src/game-server/gamehandler.cpp
@@ -112,7 +112,7 @@ void registerGameClient(std::string const &token, Player *ch)
bool GameHandler::startListen(enet_uint16 port)
{
- LOG_INFO("Game handler started:", 0);
+ LOG_INFO("Game handler started:");
return ConnectionHandler::startListen(port);
}
@@ -298,13 +298,13 @@ void GameHandler::processMessage(NetComputer *comp, MessageIn &message)
case PGMSG_ATTACK:
{
LOG_DEBUG("Player " << computer.character->getPublicID()
- << " attacks", 0);
+ << " attacks");
computer.character->setDirection(message.readByte());
computer.character->setAction(PLAYER_ATTACK);
} break;
default:
- LOG_WARN("Invalid message type", 0);
+ LOG_WARN("Invalid message type");
result.writeShort(XXMSG_INVALID);
break;
}
diff --git a/src/game-server/itemmanager.cpp b/src/game-server/itemmanager.cpp
index 08adb9de..b80f295b 100644
--- a/src/game-server/itemmanager.cpp
+++ b/src/game-server/itemmanager.cpp
@@ -33,7 +33,7 @@ ItemManager::ItemManager(std::string const &itemReferenceFile)
char *data = (char *)resman->loadFile(itemReferenceFile, size);
if (!data) {
- LOG_ERROR("Item Manager: Could not find " << itemReferenceFile << "!", 0);
+ LOG_ERROR("Item Manager: Could not find " << itemReferenceFile << "!");
free(data);
return;
}
@@ -44,7 +44,7 @@ ItemManager::ItemManager(std::string const &itemReferenceFile)
if (!doc)
{
LOG_ERROR("Item Manager: Error while parsing item database ("
- << itemReferenceFile << ")!", 0);
+ << itemReferenceFile << ")!");
return;
}
@@ -52,16 +52,17 @@ ItemManager::ItemManager(std::string const &itemReferenceFile)
if (!node || !xmlStrEqual(node->name, BAD_CAST "items"))
{
LOG_ERROR("Item Manager: " << itemReferenceFile
- << " is not a valid database file!", 0);
+ << " is not a valid database file!");
xmlFreeDoc(doc);
return;
}
- LOG_INFO("Loading item reference...", 0);
+ LOG_INFO("Loading item reference...");
unsigned nbItems = 0;
for (node = node->xmlChildrenNode; node != NULL; node = node->next)
{
- if (!xmlStrEqual(node->name, BAD_CAST "item")) {
+ if (!xmlStrEqual(node->name, BAD_CAST "item"))
+ {
continue;
}
@@ -70,7 +71,7 @@ ItemManager::ItemManager(std::string const &itemReferenceFile)
if (id == 0)
{
LOG_WARN("Item Manager: An (ignored) item has no ID in "
- << itemReferenceFile << "!", 0);
+ << itemReferenceFile << "!");
continue;
}
@@ -113,47 +114,21 @@ ItemManager::ItemManager(std::string const &itemReferenceFile)
if (maxPerSlot == 0)
{
LOG_WARN("Item Manager: Missing max per slot properties for item: "
- << id << " in " << itemReferenceFile << ".", 0);
+ << id << " in " << itemReferenceFile << ".");
}
if (weight == 0)
{
LOG_WARN("Item Manager: Missing weight for item: "
- << id << " in " << itemReferenceFile << ".", 0);
+ << id << " in " << itemReferenceFile << ".");
}
- LOG_INFO("Item: ID: " << id << ", itemType: " << itemType
- << ", weight: " << weight << ", value: " << value <<
- ", scriptName: " << scriptName << ", maxPerSlot: " << maxPerSlot << ".", 3);
- // Log level 5
- LOG_INFO("Modifiers:: element: " << modifiers.element <<
- ", lifetime: " << modifiers.lifetime
- << std::endl <<
- ", strength: " << modifiers.rawStats[STAT_STRENGTH] <<
- ", agility: " << modifiers.rawStats[STAT_AGILITY] <<
- ", vitality: " << modifiers.rawStats[STAT_VITALITY]
- << std::endl <<
- ", intelligence: " << modifiers.rawStats[STAT_INTELLIGENCE] <<
- ", dexterity: " << modifiers.rawStats[STAT_DEXTERITY] <<
- ", luck: " << modifiers.rawStats[STAT_LUCK]
- << std::endl <<
- ", heat: " << modifiers.computedStats[STAT_HEAT] <<
- ", attack: " << modifiers.computedStats[STAT_ATTACK] <<
- ", defence: " << modifiers.computedStats[STAT_DEFENCE]
- << std::endl <<
- ", magic: " << modifiers.computedStats[STAT_MAGIC] <<
- ", accuracy: " << modifiers.computedStats[STAT_ACCURACY] <<
- ", speed: " << modifiers.computedStats[STAT_SPEED] <<
- std::endl <<
- ", hp: " << modifiers.hp <<
- ", mp: " << modifiers.mp <<
- std::endl <<
- ", range: " << modifiers.range <<
- ", weapon_type: " << modifiers.weaponType <<
- ", status_effect: " << modifiers.beingStateEffect, 5);
+ LOG_DEBUG("Item: ID: " << id << ", itemType: " << itemType
+ << ", weight: " << weight << ", value: " << value <<
+ ", scriptName: " << scriptName << ", maxPerSlot: " << maxPerSlot << ".");
}
LOG_INFO("Loaded " << nbItems << " items from "
- << itemReferenceFile << ".", 0);
+ << itemReferenceFile << ".");
xmlFreeDoc(doc);
}
diff --git a/src/game-server/main-game.cpp b/src/game-server/main-game.cpp
index 62a0c0e1..63e1f66e 100644
--- a/src/game-server/main-game.cpp
+++ b/src/game-server/main-game.cpp
@@ -144,14 +144,14 @@ void initialize()
// Initialize the logger.
using namespace utils;
- Logger::instance().setLogFile(logPath);
+ Logger::setLogFile(logPath);
// Write the messages to both the screen and the log file.
- Logger::instance().setTeeMode(true);
+ Logger::setTeeMode(true);
config.init(configPath);
- LOG_INFO("Using config file: " << configPath, 0);
- LOG_INFO("Using log file: " << logPath, 0);
+ LOG_INFO("Using config file: " << configPath);
+ LOG_INFO("Using log file: " << logPath);
// --- Initialize the managers
// Initialize the slang's and double quotes filter.
@@ -178,7 +178,7 @@ void initialize()
// --- Initialize scripting subsystem.
#ifdef RUBY_SUPPORT
- LOG_INFO("Script language: " << scriptLanguage, 0);
+ LOG_INFO("Script language: " << scriptLanguage);
// Initialize ruby
ruby_init();
@@ -192,7 +192,7 @@ void initialize()
rb_load_file("scripts/init.rb");
rubyStatus = ruby_exec();
#else
- LOG_WARN("No scripting language support.", 0);
+ LOG_WARN("No scripting language support.");
#endif
}
@@ -271,15 +271,15 @@ void parseOptions(int argc, char *argv[])
// Set Verbosity to level
unsigned short verbosityLevel;
verbosityLevel = atoi(optarg);
- utils::Logger::instance().setVerbosity(verbosityLevel);
- LOG_INFO("Setting log verbosity level to " << verbosityLevel, 0);
+ utils::Logger::setVerbosity(utils::Logger::Level(verbosityLevel));
+ LOG_INFO("Setting log verbosity level to " << verbosityLevel);
break;
case 'p':
// Change the port to listen on.
unsigned short portToListenOn;
portToListenOn = atoi(optarg);
config.setValue("gameServerPort", portToListenOn);
- LOG_INFO("Setting default port to " << portToListenOn, 0);
+ LOG_INFO("Setting default port to " << portToListenOn);
break;
}
}
@@ -293,7 +293,7 @@ int main(int argc, char *argv[])
{
int elapsedWorldTicks;
- LOG_INFO("The Mana World Server v" << PACKAGE_VERSION, 0);
+ LOG_INFO("The Mana World Game Server v" << PACKAGE_VERSION);
// Parse command line options
parseOptions(argc, argv);
@@ -330,12 +330,12 @@ int main(int argc, char *argv[])
{
LOG_WARN(elapsedWorldTicks -1 << " World Tick(s) skipped "
"because of insufficient time. Please buy a faster "
- "machine ;-)", 0);
+ "machine ;-)");
};
// Print world time at 10 second intervals to show we're alive
if (worldTime % 100 == 0) {
- LOG_INFO("World time: " << worldTime, 0);
+ LOG_INFO("World time: " << worldTime);
}
// Handle all messages that are in the message queues
@@ -349,7 +349,7 @@ int main(int argc, char *argv[])
worldTimer.sleep();
}
- LOG_INFO("Received: Quit signal, closing down...", 0);
+ LOG_INFO("Received: Quit signal, closing down...");
gameHandler->stopListen();
accountHandler->stop();
delete gameState;
diff --git a/src/game-server/mapmanager.cpp b/src/game-server/mapmanager.cpp
index accf7ca0..1bceb8e2 100644
--- a/src/game-server/mapmanager.cpp
+++ b/src/game-server/mapmanager.cpp
@@ -37,7 +37,7 @@ MapManager::MapManager(std::string const &mapReferenceFile)
char *data = (char *)resman->loadFile(mapReferenceFile, size);
if (!data) {
- LOG_ERROR("Map Manager: Could not find " << mapReferenceFile << "!", 0);
+ LOG_ERROR("Map Manager: Could not find " << mapReferenceFile << "!");
free(data);
return;
}
@@ -48,7 +48,7 @@ MapManager::MapManager(std::string const &mapReferenceFile)
if (!doc)
{
LOG_ERROR("Map Manager: Error while parsing map database ("
- << mapReferenceFile << ")!", 0);
+ << mapReferenceFile << ")!");
return;
}
@@ -56,12 +56,12 @@ MapManager::MapManager(std::string const &mapReferenceFile)
if (!node || !xmlStrEqual(node->name, BAD_CAST "maps"))
{
LOG_ERROR("Map Manager: " << mapReferenceFile
- << " is not a valid database file!", 0);
+ << " is not a valid database file!");
xmlFreeDoc(doc);
return;
}
- LOG_INFO("Loading map reference...", 0);
+ LOG_INFO("Loading map reference...");
for (node = node->xmlChildrenNode; node != NULL; node = node->next)
{
if (!xmlStrEqual(node->name, BAD_CAST "map")) {
@@ -99,10 +99,10 @@ Map *MapManager::getMap(int mapId)
map = MapReader::readMap("maps/" + file);
if (!map)
{
- LOG_ERROR("Unable to load map \"" << file << "\" (id " << mapId << ")", 0);
+ LOG_ERROR("Unable to load map \"" << file << "\" (id " << mapId << ")");
return NULL;
}
- LOG_INFO("Loaded map \"" << file << "\" (id " << mapId << ")", 0);
+ LOG_INFO("Loaded map \"" << file << "\" (id " << mapId << ")");
}
return map;
}
@@ -119,7 +119,7 @@ void MapManager::raiseActive(int mapId)
Maps::iterator i = maps.find(mapId);
assert(i != maps.end());
i->second.isActive = true;
- LOG_INFO("Activating map \"" << i->second.fileName << "\" (id " << i->first << ")", 0);
+ LOG_INFO("Activating map \"" << i->second.fileName << "\" (id " << i->first << ")");
}
bool MapManager::isActive(int mapId) const
diff --git a/src/game-server/mapreader.cpp b/src/game-server/mapreader.cpp
index 63d81a64..cc26f03f 100644
--- a/src/game-server/mapreader.cpp
+++ b/src/game-server/mapreader.cpp
@@ -44,7 +44,7 @@ Map *MapReader::readMap(const std::string &filename)
if (buffer == NULL)
{
- LOG_ERROR("Error: Map file not found (" << filename.c_str() << ")", 0);
+ LOG_ERROR("Error: Map file not found (" << filename.c_str() << ")");
return NULL;
}
@@ -64,7 +64,7 @@ Map *MapReader::readMap(const std::string &filename)
if (!doc)
{
- LOG_ERROR("Error while parsing map file (" << filename << ")!", 0);
+ LOG_ERROR("Error while parsing map file (" << filename << ")!");
return NULL;
}
@@ -78,7 +78,7 @@ Map *MapReader::readMap(const std::string &filename)
}
else
{
- LOG_ERROR("Error: Not a map file (" << filename << ")!", 0);
+ LOG_ERROR("Error: Not a map file (" << filename << ")!");
}
xmlFreeDoc(doc);
@@ -122,7 +122,7 @@ static Map *readMap(xmlNodePtr node, std::string const &path)
{
if (xmlHasProp(node, BAD_CAST "source"))
{
- LOG_WARN("Warning: External tilesets not supported yet.", 0);
+ LOG_WARN("Warning: External tilesets not supported yet.");
}
else
{
@@ -163,7 +163,7 @@ static void readLayer(xmlNodePtr node, Map *map)
{
if (xmlHasProp(node, BAD_CAST "compression"))
{
- LOG_WARN("Warning: no layer compression supported!", 0);
+ LOG_WARN("Warning: no layer compression supported!");
return;
}