summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/net')
-rw-r--r--src/net/ea/charserverhandler.cpp17
-rw-r--r--src/net/ea/chathandler.cpp33
-rw-r--r--src/net/ea/network.cpp2
-rw-r--r--src/net/ea/playerhandler.cpp21
-rw-r--r--src/net/tmwa/charserverhandler.cpp3
-rw-r--r--src/net/tmwa/gamehandler.cpp4
-rw-r--r--src/net/tmwa/playerhandler.cpp6
7 files changed, 85 insertions, 1 deletions
diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp
index 857f59ef5..ef47cf99e 100644
--- a/src/net/ea/charserverhandler.cpp
+++ b/src/net/ea/charserverhandler.cpp
@@ -118,6 +118,7 @@ unsigned int CharServerHandler::maxSprite() const
void CharServerHandler::processCharLoginError(Net::MessageIn &msg) const
{
+ BLOCK_START("CharServerHandler::processCharLoginError")
switch (msg.readInt8())
{
case 0:
@@ -135,11 +136,13 @@ void CharServerHandler::processCharLoginError(Net::MessageIn &msg) const
break;
}
Client::setState(STATE_ERROR);
+ BLOCK_END("CharServerHandler::processCharLoginError")
}
void CharServerHandler::processCharCreate(Net::MessageIn &msg,
const bool withColors)
{
+ BLOCK_START("CharServerHandler::processCharCreate")
Net::Character *const character = new Net::Character;
readPlayerData(msg, character, withColors);
mCharacters.push_back(character);
@@ -152,10 +155,12 @@ void CharServerHandler::processCharCreate(Net::MessageIn &msg,
mCharCreateDialog->scheduleDelete();
mCharCreateDialog = nullptr;
}
+ BLOCK_END("CharServerHandler::processCharCreate")
}
void CharServerHandler::processCharCreateFailed(Net::MessageIn &msg)
{
+ BLOCK_START("CharServerHandler::processCharCreateFailed")
switch (msg.readInt8())
{
case 1:
@@ -194,10 +199,12 @@ void CharServerHandler::processCharCreateFailed(Net::MessageIn &msg)
new OkDialog(_("Error"), errorMessage, DIALOG_ERROR);
if (mCharCreateDialog)
mCharCreateDialog->unlock();
+ BLOCK_END("CharServerHandler::processCharCreateFailed")
}
void CharServerHandler::processCharDelete(Net::MessageIn &msg A_UNUSED)
{
+ BLOCK_START("CharServerHandler::processCharDelete")
delete mSelectedCharacter;
mCharacters.remove(mSelectedCharacter);
mSelectedCharacter = nullptr;
@@ -205,13 +212,16 @@ void CharServerHandler::processCharDelete(Net::MessageIn &msg A_UNUSED)
unlockCharSelectDialog();
// TRANSLATORS: info message
new OkDialog(_("Info"), _("Character deleted."));
+ BLOCK_END("CharServerHandler::processCharDelete")
}
void CharServerHandler::processCharDeleteFailed(Net::MessageIn &msg A_UNUSED)
{
+ BLOCK_START("CharServerHandler::processCharDeleteFailed")
unlockCharSelectDialog();
// TRANSLATORS: error message
new OkDialog(_("Error"), _("Failed to delete character."), DIALOG_ERROR);
+ BLOCK_END("CharServerHandler::processCharDeleteFailed")
}
void CharServerHandler::clear()
@@ -224,6 +234,7 @@ void CharServerHandler::processCharMapInfo(Net::MessageIn &msg,
Network *const network,
ServerInfo &server)
{
+ BLOCK_START("CharServerHandler::processCharMapInfo")
// msg.skip(4); // CharID, must be the same as player_node->charID
PlayerInfo::setCharId(msg.readInt32());
GameHandler *const gh = static_cast<GameHandler*>(Net::getGameHandler());
@@ -251,15 +262,20 @@ void CharServerHandler::processCharMapInfo(Net::MessageIn &msg,
if (network)
network->disconnect();
Client::setState(STATE_CONNECT_GAME);
+ BLOCK_END("CharServerHandler::processCharMapInfo")
}
void CharServerHandler::processChangeMapServer(Net::MessageIn &msg,
Network *const network,
ServerInfo &server) const
{
+ BLOCK_START("CharServerHandler::processChangeMapServer")
GameHandler *const gh = static_cast<GameHandler*>(Net::getGameHandler());
if (!gh || !network)
+ {
+ BLOCK_END("CharServerHandler::processChangeMapServer")
return;
+ }
gh->setMap(msg.readString(16));
const int x = msg.readInt16();
const int y = msg.readInt16();
@@ -273,6 +289,7 @@ void CharServerHandler::processChangeMapServer(Net::MessageIn &msg,
player_node->setTileCoords(x, y);
player_node->setMap(nullptr);
}
+ BLOCK_END("CharServerHandler::processChangeMapServer")
}
} // namespace Ea
diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp
index 0fdd7ecf3..72a1e49b7 100644
--- a/src/net/ea/chathandler.cpp
+++ b/src/net/ea/chathandler.cpp
@@ -57,8 +57,9 @@ void ChatHandler::me(const std::string &text, const std::string &channel) const
void ChatHandler::processWhisperResponse(Net::MessageIn &msg)
{
- std::string nick;
+ BLOCK_START("ChatHandler::processWhisperResponse")
+ std::string nick;
if (mSentWhispers.empty())
{
nick = "user";
@@ -101,20 +102,28 @@ void ChatHandler::processWhisperResponse(Net::MessageIn &msg)
+ toString(type));
}
}
+ BLOCK_END("ChatHandler::processWhisperResponse")
}
void ChatHandler::processWhisper(Net::MessageIn &msg) const
{
+ BLOCK_START("ChatHandler::processWhisper")
const int chatMsgLength = msg.readInt16() - 28;
std::string nick = msg.readString(24);
if (chatMsgLength <= 0)
+ {
+ BLOCK_END("ChatHandler::processWhisper")
return;
+ }
std::string chatMsg = msg.readString(chatMsgLength);
// ignoring future whisper messages
if (chatMsg.find("\302\202G") == 0 || chatMsg.find("\302\202A") == 0)
+ {
+ BLOCK_END("ChatHandler::processWhisper")
return;
+ }
// remove first unicode space if this is may be whisper command.
if (chatMsg.find("\302\202!") == 0)
chatMsg = chatMsg.substr(2);
@@ -124,6 +133,7 @@ void ChatHandler::processWhisper(Net::MessageIn &msg) const
if (guildManager && GuildManager::getEnableGuildBot()
&& nick == "guild" && guildManager->processGuildMessage(chatMsg))
{
+ BLOCK_END("ChatHandler::processWhisper")
return;
}
@@ -223,6 +233,7 @@ void ChatHandler::processWhisper(Net::MessageIn &msg) const
localChatTab->chatLog(chatMsg, BY_SERVER);
}
}
+ BLOCK_END("ChatHandler::processWhisper")
}
void ChatHandler::processBeingChat(Net::MessageIn &msg,
@@ -231,10 +242,14 @@ void ChatHandler::processBeingChat(Net::MessageIn &msg,
if (!actorSpriteManager)
return;
+ BLOCK_START("ChatHandler::processBeingChat")
int chatMsgLength = msg.readInt16() - 8;
Being *const being = actorSpriteManager->findBeing(msg.readInt32());
if (!being)
+ {
+ BLOCK_END("ChatHandler::processBeingChat")
return;
+ }
std::string channel;
if (channels)
@@ -246,7 +261,10 @@ void ChatHandler::processBeingChat(Net::MessageIn &msg,
}
if (chatMsgLength <= 0)
+ {
+ BLOCK_END("ChatHandler::processBeingChat")
return;
+ }
std::string chatMsg = msg.readRawString(chatMsgLength);
@@ -284,11 +302,13 @@ void ChatHandler::processBeingChat(Net::MessageIn &msg,
{
being->setSpeech(chatMsg, channel);
}
+ BLOCK_END("ChatHandler::processBeingChat")
}
void ChatHandler::processChat(Net::MessageIn &msg, const bool normalChat,
const bool channels) const
{
+ BLOCK_START("ChatHandler::processChat")
int chatMsgLength = msg.readInt16() - 4;
std::string channel;
if (channels)
@@ -299,7 +319,10 @@ void ChatHandler::processChat(Net::MessageIn &msg, const bool normalChat,
channel += msg.readInt8();
}
if (chatMsgLength <= 0)
+ {
+ BLOCK_END("ChatHandler::processChat")
return;
+ }
std::string chatMsg = msg.readRawString(chatMsgLength);
const size_t pos = chatMsg.find(" : ", 0);
@@ -334,10 +357,12 @@ void ChatHandler::processChat(Net::MessageIn &msg, const bool normalChat,
{
localChatTab->chatLog(chatMsg, BY_GM);
}
+ BLOCK_END("ChatHandler::processChat")
}
void ChatHandler::processMVP(Net::MessageIn &msg) const
{
+ BLOCK_START("ChatHandler::processMVP")
// Display MVP player
const int id = msg.readInt32(); // id
if (localChatTab && actorSpriteManager && config.getBoolValue("showMVP"))
@@ -348,14 +373,19 @@ void ChatHandler::processMVP(Net::MessageIn &msg) const
else
NotifyManager::notify(NotifyManager::MVP_PLAYER, being->getName());
}
+ BLOCK_END("ChatHandler::processMVP")
}
void ChatHandler::processIgnoreAllResponse(Net::MessageIn &msg) const
{
+ BLOCK_START("ChatHandler::processIgnoreAllResponse")
const int action = msg.readInt8();
const int fail = msg.readInt8();
if (!localChatTab)
+ {
+ BLOCK_END("ChatHandler::processIgnoreAllResponse")
return;
+ }
switch (action)
{
@@ -391,6 +421,7 @@ void ChatHandler::processIgnoreAllResponse(Net::MessageIn &msg) const
// unknown result
break;
}
+ BLOCK_END("ChatHandler::processIgnoreAllResponse")
}
} // namespace Ea
diff --git a/src/net/ea/network.cpp b/src/net/ea/network.cpp
index 085901743..f83eab629 100644
--- a/src/net/ea/network.cpp
+++ b/src/net/ea/network.cpp
@@ -126,6 +126,7 @@ bool Network::connect(ServerInfo server)
void Network::disconnect()
{
+ BLOCK_START("Network::disconnect")
mState = IDLE;
if (mWorkerThread && SDL_GetThreadID(mWorkerThread))
@@ -141,6 +142,7 @@ void Network::disconnect()
if (mSleep > 0)
SDL_Delay(mSleep);
}
+ BLOCK_END("Network::disconnect")
}
void Network::flush()
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp
index c52febaf9..5e847f88f 100644
--- a/src/net/ea/playerhandler.cpp
+++ b/src/net/ea/playerhandler.cpp
@@ -196,6 +196,7 @@ Vector PlayerHandler::getDefaultWalkSpeed() const
void PlayerHandler::processWalkResponse(Net::MessageIn &msg) const
{
+ BLOCK_START("PlayerHandler::processWalkResponse")
/*
* This client assumes that all walk messages succeed,
* and that the server will send a correction notice
@@ -206,10 +207,12 @@ void PlayerHandler::processWalkResponse(Net::MessageIn &msg) const
msg.readCoordinatePair(srcX, srcY, dstX, dstY);
if (player_node)
player_node->setRealPos(dstX, dstY);
+ BLOCK_END("PlayerHandler::processWalkResponse")
}
void PlayerHandler::processPlayerWarp(Net::MessageIn &msg) const
{
+ BLOCK_START("PlayerHandler::processPlayerWarp")
std::string mapPath = msg.readString(16);
int x = msg.readInt16();
int y = msg.readInt16();
@@ -280,14 +283,19 @@ void PlayerHandler::processPlayerWarp(Net::MessageIn &msg) const
miniStatusWindow->updateStatus();
viewport->scrollBy(scrollOffsetX, scrollOffsetY);
}
+ BLOCK_END("PlayerHandler::processPlayerWarp")
}
void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg) const
{
+ BLOCK_START("PlayerHandler::processPlayerStatUpdate1")
const int type = msg.readInt16();
const int value = msg.readInt32();
if (!player_node)
+ {
+ BLOCK_END("PlayerHandler::processPlayerStatUpdate1")
return;
+ }
switch (type)
{
@@ -464,10 +472,12 @@ void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg) const
player_node->recalcSpritesOrder();
}
}
+ BLOCK_END("PlayerHandler::processPlayerStatUpdate1")
}
void PlayerHandler::processPlayerStatUpdate2(Net::MessageIn &msg) const
{
+ BLOCK_START("PlayerHandler::processPlayerStatUpdate2")
const int type = msg.readInt16();
switch (type)
{
@@ -507,10 +517,12 @@ void PlayerHandler::processPlayerStatUpdate2(Net::MessageIn &msg) const
logger->log("QQQQ PLAYER_STAT_UPDATE_2 " + toString(type));
break;
}
+ BLOCK_END("PlayerHandler::processPlayerStatUpdate2")
}
void PlayerHandler::processPlayerStatUpdate3(Net::MessageIn &msg) const
{
+ BLOCK_START("PlayerHandler::processPlayerStatUpdate3")
const int type = msg.readInt32();
const int base = msg.readInt32();
const int bonus = msg.readInt32();
@@ -519,10 +531,12 @@ void PlayerHandler::processPlayerStatUpdate3(Net::MessageIn &msg) const
PlayerInfo::setStatMod(type, bonus);
if (type == EA_ATK || type == PlayerInfo::ATTACK_DELAY)
PlayerInfo::updateAttrs();
+ BLOCK_END("PlayerHandler::processPlayerStatUpdate3")
}
void PlayerHandler::processPlayerStatUpdate4(Net::MessageIn &msg) const
{
+ BLOCK_START("PlayerHandler::processPlayerStatUpdate4")
const int type = msg.readInt16();
const int ok = msg.readInt8();
const int value = msg.readInt8();
@@ -537,10 +551,12 @@ void PlayerHandler::processPlayerStatUpdate4(Net::MessageIn &msg) const
}
PlayerInfo::setStatBase(type, value);
+ BLOCK_END("PlayerHandler::processPlayerStatUpdate4")
}
void PlayerHandler::processPlayerStatUpdate5(Net::MessageIn &msg) const
{
+ BLOCK_START("PlayerHandler::processPlayerStatUpdate5")
PlayerInfo::setAttribute(PlayerInfo::CHAR_POINTS, msg.readInt16());
int val = msg.readInt8();
@@ -609,10 +625,12 @@ void PlayerHandler::processPlayerStatUpdate5(Net::MessageIn &msg) const
PlayerInfo::setStatBase(EA_CRIT, msg.readInt16());
msg.readInt16(); // manner
+ BLOCK_END("PlayerHandler::processPlayerStatUpdate5")
}
void PlayerHandler::processPlayerStatUpdate6(Net::MessageIn &msg) const
{
+ BLOCK_START("PlayerHandler::processPlayerStatUpdate6")
const int type = msg.readInt16();
if (statusWindow)
{
@@ -642,10 +660,12 @@ void PlayerHandler::processPlayerStatUpdate6(Net::MessageIn &msg) const
break;
}
}
+ BLOCK_END("PlayerHandler::processPlayerStatUpdate6")
}
void PlayerHandler::processPlayerArrowMessage(Net::MessageIn &msg) const
{
+ BLOCK_START("PlayerHandler::processPlayerArrowMessage")
const int type = msg.readInt16();
switch (type)
{
@@ -659,6 +679,7 @@ void PlayerHandler::processPlayerArrowMessage(Net::MessageIn &msg) const
logger->log("QQQQ 0x013b: Unhandled message %i", type);
break;
}
+ BLOCK_END("PlayerHandler::processPlayerArrowMessage")
}
bool PlayerHandler::canUseMagic() const
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp
index 64626becb..c4571969e 100644
--- a/src/net/tmwa/charserverhandler.cpp
+++ b/src/net/tmwa/charserverhandler.cpp
@@ -315,6 +315,8 @@ void CharServerHandler::connect()
void CharServerHandler::processCharLogin(Net::MessageIn &msg)
{
+ BLOCK_START("CharServerHandler::processCharLogin")
+
msg.skip(2); // Length word
const int slots = msg.readInt16();
if (slots > 0 && slots < 30)
@@ -346,6 +348,7 @@ void CharServerHandler::processCharLogin(Net::MessageIn &msg)
}
Client::setState(STATE_CHAR_SELECT);
+ BLOCK_END("CharServerHandler::processCharLogin")
}
} // namespace TmwAthena
diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp
index c92a83654..62457d718 100644
--- a/src/net/tmwa/gamehandler.cpp
+++ b/src/net/tmwa/gamehandler.cpp
@@ -98,6 +98,7 @@ void GameHandler::connect()
if (!mNetwork)
return;
+ BLOCK_START("GameHandler::connect")
mNetwork->connect(mapServer);
const Token &token = static_cast<LoginHandler*>(
Net::getLoginHandler())->getToken();
@@ -133,6 +134,7 @@ void GameHandler::connect()
*/
// We get 4 useless bytes before the real answer comes in (what are these?)
mNetwork->skip(4);
+ BLOCK_END("GameHandler::connect")
}
bool GameHandler::isConnected() const
@@ -144,8 +146,10 @@ bool GameHandler::isConnected() const
void GameHandler::disconnect()
{
+ BLOCK_START("GameHandler::disconnect")
if (mNetwork)
mNetwork->disconnect();
+ BLOCK_END("GameHandler::disconnect")
}
void GameHandler::quit() const
diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp
index b63be0a6d..645959fbc 100644
--- a/src/net/tmwa/playerhandler.cpp
+++ b/src/net/tmwa/playerhandler.cpp
@@ -222,6 +222,7 @@ void PlayerHandler::processOnlineList(Net::MessageIn &msg) const
if (!whoIsOnline)
return;
+ BLOCK_START("PlayerHandler::processOnlineList")
const int size = msg.readInt16() - 4;
std::vector<OnlinePlayer*> arr;
@@ -229,12 +230,16 @@ void PlayerHandler::processOnlineList(Net::MessageIn &msg) const
{
if (whoIsOnline)
whoIsOnline->loadList(arr);
+ BLOCK_END("PlayerHandler::processOnlineList")
return;
}
char *const start = reinterpret_cast<char*>(msg.readBytes(size));
if (!start)
+ {
+ BLOCK_END("PlayerHandler::processOnlineList")
return;
+ }
const char *buf = start;
@@ -278,6 +283,7 @@ void PlayerHandler::processOnlineList(Net::MessageIn &msg) const
if (whoIsOnline)
whoIsOnline->loadList(arr);
delete [] start;
+ BLOCK_END("PlayerHandler::processOnlineList")
}
void PlayerHandler::updateStatus(const uint8_t status) const