summaryrefslogtreecommitdiff
path: root/src/net/manaserv
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/manaserv')
-rw-r--r--src/net/manaserv/charhandler.cpp8
-rw-r--r--src/net/manaserv/chathandler.cpp6
-rw-r--r--src/net/manaserv/connection.cpp8
-rw-r--r--src/net/manaserv/effecthandler.cpp4
-rw-r--r--src/net/manaserv/guildhandler.cpp22
-rw-r--r--src/net/manaserv/inventoryhandler.cpp13
-rw-r--r--src/net/manaserv/loginhandler.cpp2
-rw-r--r--src/net/manaserv/network.cpp20
-rw-r--r--src/net/manaserv/partyhandler.cpp4
-rw-r--r--src/net/manaserv/playerhandler.cpp30
10 files changed, 58 insertions, 59 deletions
diff --git a/src/net/manaserv/charhandler.cpp b/src/net/manaserv/charhandler.cpp
index 98591669..cc0ea17e 100644
--- a/src/net/manaserv/charhandler.cpp
+++ b/src/net/manaserv/charhandler.cpp
@@ -264,10 +264,10 @@ void CharHandler::handleCharacterSelectResponse(MessageIn &msg)
chatServer.hostname.assign(msg.readString());
chatServer.port = msg.readInt16();
- logger->log("Game server: %s:%d", gameServer.hostname.c_str(),
- gameServer.port);
- logger->log("Chat server: %s:%d", chatServer.hostname.c_str(),
- chatServer.port);
+ Log::info("Game server: %s:%d", gameServer.hostname.c_str(),
+ gameServer.port);
+ Log::info("Chat server: %s:%d", chatServer.hostname.c_str(),
+ chatServer.port);
// Prevent the selected local player from being deleted
local_player = mSelectedCharacter->dummy;
diff --git a/src/net/manaserv/chathandler.cpp b/src/net/manaserv/chathandler.cpp
index dca556c2..436da820 100644
--- a/src/net/manaserv/chathandler.cpp
+++ b/src/net/manaserv/chathandler.cpp
@@ -158,8 +158,8 @@ void ChatHandler::handleGameChatMessage(MessageIn &msg)
if (!being)
{
- logger->log("Warning: Received GPMSG_SAY for unknown being with id %i."
- " (Message is: %s)", id, chatMsg.c_str());
+ Log::warn("Received GPMSG_SAY for unknown being with id %i."
+ " (Message is: %s)", id, chatMsg.c_str());
return;
}
@@ -262,7 +262,7 @@ void ChatHandler::handleChatMessage(MessageIn &msg)
else
{
// Can't find channel
- logger->log("Couldn't find chat channel id: %hi", channelId);
+ Log::info("Couldn't find chat channel id: %hi", channelId);
}
}
diff --git a/src/net/manaserv/connection.cpp b/src/net/manaserv/connection.cpp
index 1b6f757a..2eb5b4bf 100644
--- a/src/net/manaserv/connection.cpp
+++ b/src/net/manaserv/connection.cpp
@@ -44,13 +44,13 @@ Connection::~Connection()
bool Connection::connect(const std::string &address, enet_uint16 port)
{
- logger->log("Net::Connection::connect(%s, %i)", address.c_str(), port);
+ Log::info("Net::Connection::connect(%s, %i)", address.c_str(), port);
if (mConnection)
disconnect();
if (address.empty())
{
- logger->log("Net::Connection::connect() got empty address!");
+ Log::info("Net::Connection::connect() got empty address!");
mState = NET_ERROR;
return false;
}
@@ -65,7 +65,7 @@ bool Connection::connect(const std::string &address, enet_uint16 port)
if (!mConnection)
{
- logger->log("Unable to initiate connection to the server.");
+ Log::info("Unable to initiate connection to the server.");
mState = NET_ERROR;
return false;
}
@@ -96,7 +96,7 @@ void Connection::send(const ManaServ::MessageOut &msg)
{
if (!isConnected())
{
- logger->log("Warning: cannot send message to not connected server!");
+ Log::warn("Cannot send message to not connected server!");
return;
}
diff --git a/src/net/manaserv/effecthandler.cpp b/src/net/manaserv/effecthandler.cpp
index 22d1f9cf..afd7cd5c 100644
--- a/src/net/manaserv/effecthandler.cpp
+++ b/src/net/manaserv/effecthandler.cpp
@@ -82,7 +82,7 @@ void EffectHandler::handleCreateEffectBeing(MessageIn &msg)
if (b)
effectManager->trigger(eid, b);
else
- logger->log("Warning: CreateEffect called for unknown being #%d", bid);
+ Log::warn("CreateEffect called for unknown being #%d", bid);
}
void EffectHandler::handleCreateTextParticle(MessageIn &msg)
@@ -120,7 +120,7 @@ void EffectHandler::handleShake(MessageIn &msg)
viewport->shakeScreen(intensityX, intensityY, decay, duration);
break;
default:
- logger->log("Warning: Received GPMSG_SHAKE message with unexpected length of %d bytes", msg.getUnreadLength());
+ Log::warn("Received GPMSG_SHAKE message with unexpected length of %d bytes", msg.getUnreadLength());
}
}
diff --git a/src/net/manaserv/guildhandler.cpp b/src/net/manaserv/guildhandler.cpp
index 9fdbafc2..bae38c37 100644
--- a/src/net/manaserv/guildhandler.cpp
+++ b/src/net/manaserv/guildhandler.cpp
@@ -73,7 +73,7 @@ void GuildHandler::handleMessage(MessageIn &msg)
{
case CPMSG_GUILD_CREATE_RESPONSE:
{
- logger->log("Received CPMSG_GUILD_CREATE_RESPONSE");
+ Log::info("Received CPMSG_GUILD_CREATE_RESPONSE");
if (msg.readInt8() == ERRMSG_OK)
{
// TODO - Acknowledge guild was created
@@ -88,7 +88,7 @@ void GuildHandler::handleMessage(MessageIn &msg)
case CPMSG_GUILD_INVITE_RESPONSE:
{
- logger->log("Received CPMSG_GUILD_INVITE_RESPONSE");
+ Log::info("Received CPMSG_GUILD_INVITE_RESPONSE");
const unsigned char response = msg.readInt8();
if (response == ERRMSG_OK)
{
@@ -111,7 +111,7 @@ void GuildHandler::handleMessage(MessageIn &msg)
case CPMSG_GUILD_ACCEPT_RESPONSE:
{
- logger->log("Received CPMSG_GUILD_ACCEPT_RESPONSE");
+ Log::info("Received CPMSG_GUILD_ACCEPT_RESPONSE");
if (msg.readInt8() == ERRMSG_OK)
{
// TODO - Acknowledge accepted into guild
@@ -121,7 +121,7 @@ void GuildHandler::handleMessage(MessageIn &msg)
case CPMSG_GUILD_GET_MEMBERS_RESPONSE:
{
- logger->log("Received CPMSG_GUILD_GET_MEMBERS_RESPONSE");
+ Log::info("Received CPMSG_GUILD_GET_MEMBERS_RESPONSE");
if (msg.readInt8() == ERRMSG_OK)
{
std::string name;
@@ -152,7 +152,7 @@ void GuildHandler::handleMessage(MessageIn &msg)
case CPMSG_GUILD_UPDATE_LIST:
{
- logger->log("Received CPMSG_GUILD_UPDATE_LIST");
+ Log::info("Received CPMSG_GUILD_UPDATE_LIST");
short guildId = msg.readInt16();
std::string name = msg.readString();
char eventId = msg.readInt8();
@@ -189,14 +189,14 @@ void GuildHandler::handleMessage(MessageIn &msg)
break;
default:
- logger->log("Invalid guild event");
+ Log::info("Invalid guild event");
}
}
} break;
case CPMSG_GUILD_INVITED:
{
- logger->log("Received CPMSG_GUILD_INVITED");
+ Log::info("Received CPMSG_GUILD_INVITED");
std::string inviterName = msg.readString();
std::string guildName = msg.readString();
int guildId = msg.readInt16();
@@ -207,7 +207,7 @@ void GuildHandler::handleMessage(MessageIn &msg)
case CPMSG_GUILD_PROMOTE_MEMBER_RESPONSE:
{
- logger->log("Received CPMSG_GUILD_PROMOTE_MEMBER_RESPONSE");
+ Log::info("Received CPMSG_GUILD_PROMOTE_MEMBER_RESPONSE");
if (msg.readInt8() == ERRMSG_OK)
{
@@ -223,14 +223,14 @@ void GuildHandler::handleMessage(MessageIn &msg)
case CPMSG_GUILD_REJOIN:
{
- logger->log("Received CPMSG_GUILD_REJOIN");
+ Log::info("Received CPMSG_GUILD_REJOIN");
joinedGuild(msg);
} break;
case CPMSG_GUILD_QUIT_RESPONSE:
{
- logger->log("Received CPMSG_GUILD_QUIT_RESPONSE");
+ Log::info("Received CPMSG_GUILD_QUIT_RESPONSE");
if (msg.readInt8() == ERRMSG_OK)
{
@@ -247,7 +247,7 @@ void GuildHandler::handleMessage(MessageIn &msg)
} break;
case CPMSG_GUILD_KICK_NOTIFICATION:
{
- logger->log("Received CPMSG_GUILD_KICK_NOTIFICATION");
+ Log::info("Received CPMSG_GUILD_KICK_NOTIFICATION");
const int guildId = msg.readInt16();
std::string player = msg.readString();
diff --git a/src/net/manaserv/inventoryhandler.cpp b/src/net/manaserv/inventoryhandler.cpp
index 58a495af..fa31b32a 100644
--- a/src/net/manaserv/inventoryhandler.cpp
+++ b/src/net/manaserv/inventoryhandler.cpp
@@ -88,9 +88,8 @@ void EquipBackend::equip(int inventorySlot, int equipmentSlot)
auto slotIt = mSlots.find(equipmentSlot);
if (slotIt == mSlots.end())
{
- logger->log("ManaServ::EquipBackend: Equipment slot %i"
- " is not existing.",
- equipmentSlot);
+ Log::info("ManaServ::EquipBackend: Equipment slot %i"
+ " is not existing.", equipmentSlot);
return;
}
@@ -115,8 +114,8 @@ void EquipBackend::unequip(int inventorySlot)
}
}
- logger->log("ManaServ::EquipBackend: No equipped item found at inventory "
- "slot %i!", inventorySlot);
+ Log::info("ManaServ::EquipBackend: No equipped item found at inventory "
+ "slot %i!", inventorySlot);
}
void EquipBackend::event(Event::Channel, const Event &event)
@@ -134,8 +133,8 @@ void EquipBackend::readEquipFile()
if (!rootNode || rootNode.name() != "equip-slots")
{
- logger->log("ManaServ::EquipBackend: Error while reading "
- EQUIP_FILE "!");
+ Log::info("ManaServ::EquipBackend: Error while reading "
+ EQUIP_FILE "!");
return;
}
diff --git a/src/net/manaserv/loginhandler.cpp b/src/net/manaserv/loginhandler.cpp
index 1c398990..9828af29 100644
--- a/src/net/manaserv/loginhandler.cpp
+++ b/src/net/manaserv/loginhandler.cpp
@@ -342,7 +342,7 @@ void LoginHandler::readServerInfo(MessageIn &msg)
if (!updateHost.empty())
mLoginData->updateHost = updateHost;
else
- logger->log("Warning: server does not have an update host set!");
+ Log::warn("Server does not have an update host set!");
// Read the client data folder for dynamic data loading.
// This is only used by the Qt client.
diff --git a/src/net/manaserv/network.cpp b/src/net/manaserv/network.cpp
index d69d3397..cb9f76a0 100644
--- a/src/net/manaserv/network.cpp
+++ b/src/net/manaserv/network.cpp
@@ -48,14 +48,14 @@ void initialize()
{
if (enet_initialize())
{
- logger->error("Failed to initialize ENet.");
+ Log::critical("Failed to initialize ENet.");
}
client = enet_host_create(nullptr, 3, 0, 0, 0);
if (!client)
{
- logger->error("Failed to create the local host.");
+ Log::critical("Failed to create the local host.");
}
}
@@ -66,7 +66,7 @@ void finalize()
if (connections)
{
- logger->error("Tried to shutdown the network subsystem while there "
+ Log::critical("Tried to shutdown the network subsystem while there "
"are network connections left!");
}
@@ -78,7 +78,7 @@ Connection *getConnection()
{
if (!client)
{
- logger->error("Tried to instantiate a network object before "
+ Log::critical("Tried to instantiate a network object before "
"initializing the network subsystem!");
}
@@ -117,14 +117,14 @@ namespace
if (iter != mMessageHandlers.end())
{
- //logger->log("Received packet %x (%i B)",
- // msg.getId(), msg.getLength());
+ //Log::info("Received packet %x (%i B)",
+ // msg.getId(), msg.getLength());
iter->second->handleMessage(msg);
}
else
{
- logger->log("Unhandled packet %x (%i B)",
- msg.getId(), msg.getLength());
+ Log::info("Unhandled packet %x (%i B)",
+ msg.getId(), msg.getLength());
}
// Clean up the packet now that we're done using it.
@@ -142,7 +142,7 @@ void flush()
switch (event.type)
{
case ENET_EVENT_TYPE_CONNECT:
- logger->log("Connected to port %d.", event.peer->address.port);
+ Log::info("Connected to port %d.", event.peer->address.port);
// Store any relevant server information here.
event.peer->data = nullptr;
break;
@@ -152,7 +152,7 @@ void flush()
break;
case ENET_EVENT_TYPE_DISCONNECT:
- logger->log("Disconnected.");
+ Log::info("Disconnected.");
// Reset the server information.
event.peer->data = nullptr;
break;
diff --git a/src/net/manaserv/partyhandler.cpp b/src/net/manaserv/partyhandler.cpp
index e2a021cd..23ea7aa5 100644
--- a/src/net/manaserv/partyhandler.cpp
+++ b/src/net/manaserv/partyhandler.cpp
@@ -103,7 +103,7 @@ void PartyHandler::handleMessage(MessageIn &msg)
"inviter has left the game."));
break;
default:
- logger->log("Unknown CPMSG_PARTY_INVITE_ANSWER_RESPONSE.");
+ Log::info("Unknown CPMSG_PARTY_INVITE_ANSWER_RESPONSE.");
break;
}
} break;
@@ -161,7 +161,7 @@ void PartyHandler::handleMessage(MessageIn &msg)
name.c_str()));
break;
default:
- logger->log("Unknown CPMSG_PARTY_REJECTED.");
+ Log::info("Unknown CPMSG_PARTY_REJECTED.");
break;
}
} break;
diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp
index 8ee9ed80..edae6be6 100644
--- a/src/net/manaserv/playerhandler.cpp
+++ b/src/net/manaserv/playerhandler.cpp
@@ -96,7 +96,7 @@ void PlayerHandler::handleMessage(MessageIn &msg)
netToken = msg.readString(32);
std::string address = msg.readString();
int port = msg.readInt16();
- logger->log("Changing server to %s:%d", address.c_str(), port);
+ Log::info("Changing server to %s:%d", address.c_str(), port);
gameServer.hostname = address;
gameServer.port = port;
@@ -147,14 +147,14 @@ void PlayerHandler::handleMessage(MessageIn &msg)
} break;
case ATTRIBMOD_INVALID_ATTRIBUTE:
{
- logger->log("Warning: Server denied increase of attribute %d (unknown attribute) ", attrNum);
+ Log::warn("Server denied increase of attribute %d (unknown attribute) ", attrNum);
} break;
case ATTRIBMOD_NO_POINTS_LEFT:
{
// when the server says "you got no points" it
// has to be correct. The server is always right!
// undo attribute change and set points to 0
- logger->log("Warning: Server denied increase of attribute %d (no points left) ", attrNum);
+ Log::warn("Server denied increase of attribute %d (no points left) ", attrNum);
int attrValue = PlayerInfo::getStatBase(attrNum) - 1;
PlayerInfo::setAttribute(CHAR_POINTS, 0);
PlayerInfo::setStatBase(attrNum, attrValue);
@@ -162,7 +162,7 @@ void PlayerHandler::handleMessage(MessageIn &msg)
case ATTRIBMOD_DENIED:
{
// undo attribute change
- logger->log("Warning: Server denied increase of attribute %d (reason unknown) ", attrNum);
+ Log::warn("Server denied increase of attribute %d (reason unknown) ", attrNum);
int points = PlayerInfo::getAttribute(CHAR_POINTS) - 1;
PlayerInfo::setAttribute(CHAR_POINTS, points);
@@ -184,14 +184,14 @@ void PlayerHandler::handleMessage(MessageIn &msg)
} break;
case ATTRIBMOD_INVALID_ATTRIBUTE:
{
- logger->log("Warning: Server denied reduction of attribute %d (unknown attribute) ", attrNum);
+ Log::warn("Server denied reduction of attribute %d (unknown attribute) ", attrNum);
} break;
case ATTRIBMOD_NO_POINTS_LEFT:
{
// when the server says "you got no points" it
// has to be correct. The server is always right!
// undo attribute change and set points to 0
- logger->log("Warning: Server denied reduction of attribute %d (no points left) ", attrNum);
+ Log::warn("Server denied reduction of attribute %d (no points left) ", attrNum);
int attrValue = PlayerInfo::getStatBase(attrNum) + 1;
// TODO are these right?
PlayerInfo::setAttribute(CHAR_POINTS, 0);
@@ -201,7 +201,7 @@ void PlayerHandler::handleMessage(MessageIn &msg)
case ATTRIBMOD_DENIED:
{
// undo attribute change
- logger->log("Warning: Server denied reduction of attribute %d (reason unknown) ", attrNum);
+ Log::warn("Server denied reduction of attribute %d (reason unknown) ", attrNum);
int charaPoints = PlayerInfo::getAttribute(CHAR_POINTS) - 1;
PlayerInfo::setAttribute(CHAR_POINTS, charaPoints);
@@ -245,7 +245,7 @@ void PlayerHandler::handleMessage(MessageIn &msg)
BY_SERVER);
break;
default:
- logger->log("0x013b: Unhandled message %i", type);
+ Log::info("0x013b: Unhandled message %i", type);
break;
}
}
@@ -263,7 +263,7 @@ void PlayerHandler::handleMapChangeMessage(MessageIn &msg)
Game *game = Game::instance();
const bool sameMap = (game->getCurrentMapName() == mapName);
- logger->log("Changing map to %s (%d, %d)", mapName.c_str(), x, y);
+ Log::info("Changing map to %s (%d, %d)", mapName.c_str(), x, y);
// Switch the actual map, deleting the previous one
game->changeMap(mapName);
@@ -285,8 +285,8 @@ void PlayerHandler::handleMapChangeMessage(MessageIn &msg)
local_player->setPosition(x, y);
local_player->setDestination(x, y);
- logger->log("Adjust scrolling by %d,%d", (int) scrollOffsetX,
- (int) scrollOffsetY);
+ Log::info("Adjust scrolling by %d,%d", (int) scrollOffsetX,
+ (int) scrollOffsetY);
viewport->scrollBy(scrollOffsetX, scrollOffsetY);
}
@@ -295,7 +295,7 @@ void PlayerHandler::attack(int id)
auto ability = AbilityDB::find("Strike");
if (!ability)
{
- logger->log("PlayerHandler::attack: 'Strike' ability not found.");
+ Log::info("PlayerHandler::attack: 'Strike' ability not found.");
return;
}
@@ -304,7 +304,7 @@ void PlayerHandler::attack(int id)
abilityHandler->useOn(ability->id, id);
break;
case AbilityInfo::TARGET_POINT:
- logger->log("PlayerHandler::attack: Unsupported target mode 'point' for 'Strike' ability.");
+ Log::info("PlayerHandler::attack: Unsupported target mode 'point' for 'Strike' ability.");
break;
case AbilityInfo::TARGET_DIRECTION:
abilityHandler->useInDirection(ability->id, local_player->getDirection());
@@ -420,8 +420,8 @@ Vector PlayerHandler::getPixelsPerSecondMoveSpeed(const Vector &speed, Map *map)
if (!map)
{
- logger->log("Manaserv::PlayerHandler: Speed wasn't given back"
- " because Map not initialized.");
+ Log::info("Manaserv::PlayerHandler: Speed wasn't given back"
+ " because Map not initialized.");
return speedInPixels;
}