summaryrefslogtreecommitdiff
path: root/src/net/manaserv
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/manaserv')
-rw-r--r--src/net/manaserv/chathandler.cpp17
-rw-r--r--src/net/manaserv/effecthandler.cpp24
-rw-r--r--src/net/manaserv/gamehandler.cpp3
-rw-r--r--src/net/manaserv/guildhandler.cpp12
-rw-r--r--src/net/manaserv/loginhandler.cpp21
-rw-r--r--src/net/manaserv/network.cpp9
-rw-r--r--src/net/manaserv/playerhandler.cpp6
-rw-r--r--src/net/manaserv/tradehandler.cpp5
8 files changed, 54 insertions, 43 deletions
diff --git a/src/net/manaserv/chathandler.cpp b/src/net/manaserv/chathandler.cpp
index 4efde53a..36e57278 100644
--- a/src/net/manaserv/chathandler.cpp
+++ b/src/net/manaserv/chathandler.cpp
@@ -127,7 +127,8 @@ void ChatHandler::handleMessage(Net::MessageIn &msg)
}
else
{
- switch (errMsg) {
+ switch (errMsg)
+ {
case ERRMSG_NO_LOGIN:
errorMessage = "Chatserver: Not logged in";
break;
@@ -169,7 +170,7 @@ void ChatHandler::handleGameChatMessage(Net::MessageIn &msg)
void ChatHandler::handleEnterChannelResponse(Net::MessageIn &msg)
{
- if(msg.readInt8() == ERRMSG_OK)
+ if (msg.readInt8() == ERRMSG_OK)
{
short channelId = msg.readInt16();
std::string channelName = msg.readString();
@@ -182,7 +183,7 @@ void ChatHandler::handleEnterChannelResponse(Net::MessageIn &msg)
std::string user;
std::string userModes;
tab->chatLog(_("Players in this channel:"), BY_CHANNEL);
- while(msg.getUnreadLength())
+ while (msg.getUnreadLength())
{
user = msg.readString();
if (user == "")
@@ -205,7 +206,7 @@ void ChatHandler::handleEnterChannelResponse(Net::MessageIn &msg)
void ChatHandler::handleListChannelsResponse(Net::MessageIn &msg)
{
localChatTab->chatLog(_("Listing channels."), BY_SERVER);
- while(msg.getUnreadLength())
+ while (msg.getUnreadLength())
{
std::string channelName = msg.readString();
if (channelName == "")
@@ -245,7 +246,7 @@ void ChatHandler::handleChatMessage(Net::MessageIn &msg)
void ChatHandler::handleQuitChannelResponse(Net::MessageIn &msg)
{
- if(msg.readInt8() == ERRMSG_OK)
+ if (msg.readInt8() == ERRMSG_OK)
{
short channelId = msg.readInt16();
Channel *channel = channelManager->findById(channelId);
@@ -260,7 +261,7 @@ void ChatHandler::handleListChannelUsersResponse(Net::MessageIn &msg)
std::string userModes;
Channel *channel = channelManager->findByName(channelName);
channel->getTab()->chatLog(_("Players in this channel:"), BY_CHANNEL);
- while(msg.getUnreadLength())
+ while (msg.getUnreadLength())
{
userNick = msg.readString();
if (userNick == "")
@@ -283,7 +284,7 @@ void ChatHandler::handleChannelEvent(Net::MessageIn &msg)
std::string line = msg.readString();
Channel *channel = channelManager->findById(channelId);
- if(channel)
+ if (channel)
{
switch(eventId)
{
@@ -334,7 +335,7 @@ void ChatHandler::handleWhoResponse(Net::MessageIn &msg)
{
std::string userNick;
- while(msg.getUnreadLength())
+ while (msg.getUnreadLength())
{
userNick = msg.readString();
if (userNick == "")
diff --git a/src/net/manaserv/effecthandler.cpp b/src/net/manaserv/effecthandler.cpp
index f9504ebb..39bc9cba 100644
--- a/src/net/manaserv/effecthandler.cpp
+++ b/src/net/manaserv/effecthandler.cpp
@@ -58,23 +58,21 @@ void EffectHandler::handleMessage(Net::MessageIn &msg)
void EffectHandler::handleCreateEffectPos(Net::MessageIn &msg)
{
- int id = msg.readInt16();
- Uint16 x = msg.readInt16();
- Uint16 y = msg.readInt16();
- effectManager->trigger(id, x, y);
+ int id = msg.readInt16();
+ Uint16 x = msg.readInt16();
+ Uint16 y = msg.readInt16();
+ effectManager->trigger(id, x, y);
}
void EffectHandler::handleCreateEffectBeing(Net::MessageIn &msg)
{
- int eid = msg.readInt16();
- int bid = msg.readInt16();
- Being* b = beingManager->findBeing(bid);
- if (b)
- {
- effectManager->trigger(eid, b);
- } else {
- logger->log("Warning: CreateEffect called for unknown being #%d", bid);
- }
+ int eid = msg.readInt16();
+ int bid = msg.readInt16();
+ Being* b = beingManager->findBeing(bid);
+ if (b)
+ effectManager->trigger(eid, b);
+ else
+ logger->log("Warning: CreateEffect called for unknown being #%d", bid);
}
} // namespace ManaServ
diff --git a/src/net/manaserv/gamehandler.cpp b/src/net/manaserv/gamehandler.cpp
index 8b8b9d0f..51b9d1c9 100644
--- a/src/net/manaserv/gamehandler.cpp
+++ b/src/net/manaserv/gamehandler.cpp
@@ -72,7 +72,8 @@ void GameHandler::handleMessage(Net::MessageIn &msg)
// Logout failed
else
{
- switch (errMsg) {
+ switch (errMsg)
+ {
case ERRMSG_NO_LOGIN:
errorMessage = "Gameserver: Not logged in";
break;
diff --git a/src/net/manaserv/guildhandler.cpp b/src/net/manaserv/guildhandler.cpp
index c87671ea..79f76320 100644
--- a/src/net/manaserv/guildhandler.cpp
+++ b/src/net/manaserv/guildhandler.cpp
@@ -74,7 +74,7 @@ void GuildHandler::handleMessage(Net::MessageIn &msg)
case CPMSG_GUILD_CREATE_RESPONSE:
{
logger->log("Received CPMSG_GUILD_CREATE_RESPONSE");
- if(msg.readInt8() == ERRMSG_OK)
+ if (msg.readInt8() == ERRMSG_OK)
{
// TODO - Acknowledge guild was created
localChatTab->chatLog(_("Guild created."));
@@ -89,7 +89,7 @@ void GuildHandler::handleMessage(Net::MessageIn &msg)
case CPMSG_GUILD_INVITE_RESPONSE:
{
logger->log("Received CPMSG_GUILD_INVITE_RESPONSE");
- if(msg.readInt8() == ERRMSG_OK)
+ if (msg.readInt8() == ERRMSG_OK)
{
// TODO - Acknowledge invite was sent
localChatTab->chatLog(_("Invite sent."));
@@ -99,7 +99,7 @@ void GuildHandler::handleMessage(Net::MessageIn &msg)
case CPMSG_GUILD_ACCEPT_RESPONSE:
{
logger->log("Received CPMSG_GUILD_ACCEPT_RESPONSE");
- if(msg.readInt8() == ERRMSG_OK)
+ if (msg.readInt8() == ERRMSG_OK)
{
// TODO - Acknowledge accepted into guild
joinedGuild(msg);
@@ -109,7 +109,7 @@ void GuildHandler::handleMessage(Net::MessageIn &msg)
case CPMSG_GUILD_GET_MEMBERS_RESPONSE:
{
logger->log("Received CPMSG_GUILD_GET_MEMBERS_RESPONSE");
- if(msg.readInt8() == ERRMSG_OK)
+ if (msg.readInt8() == ERRMSG_OK)
{
std::string name;
bool online;
@@ -124,11 +124,11 @@ void GuildHandler::handleMessage(Net::MessageIn &msg)
guild->clearMembers();
- while(msg.getUnreadLength())
+ while (msg.getUnreadLength())
{
name = msg.readString();
online = msg.readInt8();
- if(name != "")
+ if (name != "")
{
member = new GuildMember(guildId, name);
member->setOnline(online);
diff --git a/src/net/manaserv/loginhandler.cpp b/src/net/manaserv/loginhandler.cpp
index 34202411..91d9171b 100644
--- a/src/net/manaserv/loginhandler.cpp
+++ b/src/net/manaserv/loginhandler.cpp
@@ -78,7 +78,8 @@ void LoginHandler::handleMessage(Net::MessageIn &msg)
// Login failed
else
{
- switch (errMsg) {
+ switch (errMsg)
+ {
case ERRMSG_INVALID_ARGUMENT:
errorMessage = _("Wrong magic_token.");
break;
@@ -108,7 +109,8 @@ void LoginHandler::handleMessage(Net::MessageIn &msg)
// pass change failed
else
{
- switch (errMsg) {
+ switch (errMsg)
+ {
case ERRMSG_INVALID_ARGUMENT:
errorMessage = _("New password incorrect.");
break;
@@ -138,7 +140,8 @@ void LoginHandler::handleMessage(Net::MessageIn &msg)
// pass change failed
else
{
- switch (errMsg) {
+ switch (errMsg)
+ {
case ERRMSG_INVALID_ARGUMENT:
errorMessage = _("New email address incorrect.");
break;
@@ -171,7 +174,8 @@ void LoginHandler::handleMessage(Net::MessageIn &msg)
// Logout failed
else
{
- switch (errMsg) {
+ switch (errMsg)
+ {
case ERRMSG_NO_LOGIN:
errorMessage = "Accountserver: Not logged in";
break;
@@ -194,7 +198,8 @@ void LoginHandler::handleMessage(Net::MessageIn &msg)
// Unregistration failed
else
{
- switch (errMsg) {
+ switch (errMsg)
+ {
case ERRMSG_INVALID_ARGUMENT:
errorMessage =
"Accountserver: Wrong username or password";
@@ -249,7 +254,8 @@ void LoginHandler::handleLoginResponse(Net::MessageIn &msg)
}
else
{
- switch (errMsg) {
+ switch (errMsg)
+ {
case LOGIN_INVALID_VERSION:
errorMessage = _("Client version is too old.");
break;
@@ -285,7 +291,8 @@ void LoginHandler::handleRegisterResponse(Net::MessageIn &msg)
}
else
{
- switch (errMsg) {
+ switch (errMsg)
+ {
case REGISTER_INVALID_VERSION:
errorMessage = _("Client version is too old.");
break;
diff --git a/src/net/manaserv/network.cpp b/src/net/manaserv/network.cpp
index 0ca61fc2..83d78e06 100644
--- a/src/net/manaserv/network.cpp
+++ b/src/net/manaserv/network.cpp
@@ -66,7 +66,8 @@ void finalize()
if (!client)
return; // Wasn't initialized at all
- if (connections) {
+ if (connections)
+ {
logger->error("Tried to shutdown the network subsystem while there "
"are network connections left!");
}
@@ -120,12 +121,14 @@ namespace
MessageHandlerIterator iter = mMessageHandlers.find(msg.getId());
- if (iter != mMessageHandlers.end()) {
+ if (iter != mMessageHandlers.end())
+ {
//logger->log("Received packet %x (%i B)",
// msg.getId(), msg.getLength());
iter->second->handleMessage(msg);
}
- else {
+ else
+ {
logger->log("Unhandled packet %x (%i B)",
msg.getId(), msg.getLength());
}
diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp
index b0f299b6..671d02a3 100644
--- a/src/net/manaserv/playerhandler.cpp
+++ b/src/net/manaserv/playerhandler.cpp
@@ -278,7 +278,8 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg)
{
Sint16 type = msg.readInt16();
- switch (type) {
+ switch (type)
+ {
case 0:
localChatTab->chatLog(_("Equip arrows first."),
BY_SERVER);
@@ -314,7 +315,8 @@ void PlayerHandler::handleMapChangeMessage(Net::MessageIn &msg)
/* Scroll if neccessary */
if (!nearby
|| (abs(x - (int) playerPos.x) > MAP_TELEPORT_SCROLL_DISTANCE)
- || (abs(y - (int) playerPos.y) > MAP_TELEPORT_SCROLL_DISTANCE)) {
+ || (abs(y - (int) playerPos.y) > MAP_TELEPORT_SCROLL_DISTANCE))
+ {
scrollOffsetX = x - (int) playerPos.x;
scrollOffsetY = y - (int) playerPos.y;
}
diff --git a/src/net/manaserv/tradehandler.cpp b/src/net/manaserv/tradehandler.cpp
index cbcc29dc..08fc354c 100644
--- a/src/net/manaserv/tradehandler.cpp
+++ b/src/net/manaserv/tradehandler.cpp
@@ -92,11 +92,10 @@ TradeHandler::TradeHandler():
void TradeHandler::setAcceptTradeRequests(bool acceptTradeRequests)
{
mAcceptTradeRequests = acceptTradeRequests;
- if (mAcceptTradeRequests) {
+ if (mAcceptTradeRequests)
localChatTab->chatLog(_("Accepting incoming trade requests."), BY_SERVER);
- } else {
+ else
localChatTab->chatLog(_("Ignoring incoming trade requests."), BY_SERVER);
- }
}
void TradeHandler::handleMessage(Net::MessageIn &msg)