summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-06-20 12:18:10 +0300
committerAndrei Karas <akaras@inbox.ru>2013-06-20 12:18:10 +0300
commit811b0152c0e3911a58c357ec84fac9f84dbe911a (patch)
tree6658623c25525417918503d8b69c9ebd29bebadd /src
parent91f1d79f268b657c834c8df2c24368fc6067df81 (diff)
downloadmv-811b0152c0e3911a58c357ec84fac9f84dbe911a.tar.gz
mv-811b0152c0e3911a58c357ec84fac9f84dbe911a.tar.bz2
mv-811b0152c0e3911a58c357ec84fac9f84dbe911a.tar.xz
mv-811b0152c0e3911a58c357ec84fac9f84dbe911a.zip
Add more profiler labels.
Diffstat (limited to 'src')
-rw-r--r--src/game.cpp4
-rw-r--r--src/gui/beingpopup.cpp7
-rw-r--r--src/gui/beingpopup.h4
-rw-r--r--src/gui/botcheckerwindow.cpp9
-rw-r--r--src/gui/botcheckerwindow.h4
-rw-r--r--src/gui/chatwindow.cpp9
-rw-r--r--src/gui/chatwindow.h4
-rw-r--r--src/gui/debugwindow.cpp9
-rw-r--r--src/gui/debugwindow.h4
-rw-r--r--src/gui/ministatuswindow.cpp9
-rw-r--r--src/gui/ministatuswindow.h4
-rw-r--r--src/gui/shortcutwindow.cpp9
-rw-r--r--src/gui/shortcutwindow.h4
-rw-r--r--src/gui/socialwindow.cpp9
-rw-r--r--src/gui/socialwindow.h4
-rw-r--r--src/gui/whoisonline.cpp2
-rw-r--r--src/gui/widgets/progressindicator.cpp2
-rw-r--r--src/gui/widgets/window.cpp7
-rw-r--r--src/gui/widgets/window.h4
-rw-r--r--src/gui/windowmenu.cpp9
-rw-r--r--src/gui/windowmenu.h4
-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
-rw-r--r--src/resources/mapreader.cpp6
29 files changed, 211 insertions, 2 deletions
diff --git a/src/game.cpp b/src/game.cpp
index f90814ccd..177e24464 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -1015,8 +1015,9 @@ void Game::handleInput()
*/
void Game::changeMap(const std::string &mapPath)
{
- resetAdjustLevel();
+ BLOCK_START("Game::changeMap")
+ resetAdjustLevel();
ResourceManager *const resman = ResourceManager::getInstance();
resman->cleanProtected();
@@ -1105,6 +1106,7 @@ void Game::changeMap(const std::string &mapPath)
mumbleManager->setMap(mapPath);
#endif
Net::getGameHandler()->mapLoadedEvent();
+ BLOCK_END("Game::changeMap")
}
void Game::updateHistory(const SDL_Event &event)
diff --git a/src/gui/beingpopup.cpp b/src/gui/beingpopup.cpp
index ac35f5a57..e5fda9ecf 100644
--- a/src/gui/beingpopup.cpp
+++ b/src/gui/beingpopup.cpp
@@ -202,3 +202,10 @@ void BeingPopup::show(const int x, const int y, Being *const b)
position(x, y);
return;
}
+
+#ifdef USE_PROFILER
+void BeingPopup::logic()
+{
+ logicChildren();
+}
+#endif
diff --git a/src/gui/beingpopup.h b/src/gui/beingpopup.h
index 440242778..3ac46d30c 100644
--- a/src/gui/beingpopup.h
+++ b/src/gui/beingpopup.h
@@ -50,6 +50,10 @@ class BeingPopup final : public Popup
*/
void show(const int x, const int y, Being *const b);
+#ifdef USE_PROFILER
+ void logic();
+#endif
+
private:
Label *mBeingName;
Label *mBeingParty;
diff --git a/src/gui/botcheckerwindow.cpp b/src/gui/botcheckerwindow.cpp
index ad5535559..97e01b4b2 100644
--- a/src/gui/botcheckerwindow.cpp
+++ b/src/gui/botcheckerwindow.cpp
@@ -416,3 +416,12 @@ void BotCheckerWindow::optionChanged(const std::string &name)
if (name == "enableBotCheker")
mEnabled = config.getBoolValue("enableBotCheker");
}
+
+#ifdef USE_PROFILER
+void BotCheckerWindow::logicChildren()
+{
+ BLOCK_START("BotCheckerWindow::logicChildren")
+ BasicContainer::logicChildren();
+ BLOCK_END("BotCheckerWindow::logicChildren")
+}
+#endif
diff --git a/src/gui/botcheckerwindow.h b/src/gui/botcheckerwindow.h
index 53eeca01c..70304b25e 100644
--- a/src/gui/botcheckerwindow.h
+++ b/src/gui/botcheckerwindow.h
@@ -75,6 +75,10 @@ class BotCheckerWindow final : public Window,
void optionChanged(const std::string &name) override;
+#ifdef USE_PROFILER
+ void logicChildren();
+#endif
+
private:
UsersTableModel *mTableModel;
GuiTable *mTable;
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp
index 5d0c76b91..05595fe89 100644
--- a/src/gui/chatwindow.cpp
+++ b/src/gui/chatwindow.cpp
@@ -1704,3 +1704,12 @@ void ChatWindow::unHideWindow()
{
mHaveMouse = true;
}
+
+#ifdef USE_PROFILER
+void ChatWindow::logicChildren()
+{
+ BLOCK_START("ChatWindow::logicChildren")
+ BasicContainer::logicChildren();
+ BLOCK_END("ChatWindow::logicChildren")
+}
+#endif
diff --git a/src/gui/chatwindow.h b/src/gui/chatwindow.h
index 9c7ae9596..85856776a 100644
--- a/src/gui/chatwindow.h
+++ b/src/gui/chatwindow.h
@@ -292,6 +292,10 @@ class ChatWindow final : public Window,
void widgetResized(const gcn::Event &event) override;
+#ifdef USE_PROFILER
+ void logicChildren();
+#endif
+
protected:
friend class ChatTab;
friend class WhisperTab;
diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp
index 4fe4fbe1b..b154a59bc 100644
--- a/src/gui/debugwindow.cpp
+++ b/src/gui/debugwindow.cpp
@@ -148,6 +148,15 @@ void DebugWindow::widgetResized(const gcn::Event &event)
mDimension.width, mDimension.height));
}
+#ifdef USE_PROFILER
+void DebugWindow::logicChildren()
+{
+ BLOCK_START("DebugWindow::logicChildren")
+ BasicContainer::logicChildren();
+ BLOCK_END("DebugWindow::logicChildren")
+}
+#endif
+
MapDebugTab::MapDebugTab(const Widget2 *const widget) :
DebugTab(widget),
// TRANSLATORS: debug window label
diff --git a/src/gui/debugwindow.h b/src/gui/debugwindow.h
index 972378708..cce158ca2 100644
--- a/src/gui/debugwindow.h
+++ b/src/gui/debugwindow.h
@@ -153,6 +153,10 @@ class DebugWindow final : public Window
void widgetResized(const gcn::Event &event) override;
+#ifdef USE_PROFILER
+ void logicChildren();
+#endif
+
private:
TabbedArea *mTabs;
MapDebugTab *mMapWidget;
diff --git a/src/gui/ministatuswindow.cpp b/src/gui/ministatuswindow.cpp
index 91b0f956b..7a1a95fcc 100644
--- a/src/gui/ministatuswindow.cpp
+++ b/src/gui/ministatuswindow.cpp
@@ -513,3 +513,12 @@ gcn::Rectangle MiniStatusWindow::getChildrenArea()
rect.width - padding2,
rect.height - padding2);
}
+
+#ifdef USE_PROFILER
+void MiniStatusWindow::logicChildren()
+{
+ BLOCK_START("MiniStatusWindow::logicChildren")
+ BasicContainer::logicChildren();
+ BLOCK_END("MiniStatusWindow::logicChildren")
+}
+#endif
diff --git a/src/gui/ministatuswindow.h b/src/gui/ministatuswindow.h
index 023276e94..5c0b36a38 100644
--- a/src/gui/ministatuswindow.h
+++ b/src/gui/ministatuswindow.h
@@ -89,6 +89,10 @@ class MiniStatusWindow final : public Popup,
gcn::Rectangle getChildrenArea() override A_WARN_UNUSED;
+#ifdef USE_PROFILER
+ void logicChildren();
+#endif
+
private:
bool isInBar(ProgressBar *bar, int x, int y) const;
diff --git a/src/gui/shortcutwindow.cpp b/src/gui/shortcutwindow.cpp
index ef893c1ba..87b43e758 100644
--- a/src/gui/shortcutwindow.cpp
+++ b/src/gui/shortcutwindow.cpp
@@ -230,3 +230,12 @@ void ShortcutWindow::widgetMoved(const gcn::Event& event)
FOR_EACH (std::vector<ShortcutContainer*>::iterator, it, mPages)
(*it)->setRedraw(true);
}
+
+#ifdef USE_PROFILER
+void ShortcutWindow::logicChildren()
+{
+ BLOCK_START("ShortcutWindow::logicChildren")
+ BasicContainer::logicChildren();
+ BLOCK_END("ShortcutWindow::logicChildren")
+}
+#endif
diff --git a/src/gui/shortcutwindow.h b/src/gui/shortcutwindow.h
index 57e399f17..cc2ba97b0 100644
--- a/src/gui/shortcutwindow.h
+++ b/src/gui/shortcutwindow.h
@@ -68,6 +68,10 @@ class ShortcutWindow final : public Window
void mouseDragged(gcn::MouseEvent &event) override;
+#ifdef USE_PROFILER
+ void logicChildren();
+#endif
+
private:
ShortcutWindow();
ShortcutContainer *mItems;
diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp
index b2e1e20aa..83569416a 100644
--- a/src/gui/socialwindow.cpp
+++ b/src/gui/socialwindow.cpp
@@ -1712,3 +1712,12 @@ void SocialWindow::widgetResized(const gcn::Event &event)
if (mTabs)
mTabs->fixSize();
}
+
+#ifdef USE_PROFILER
+void SocialWindow::logicChildren()
+{
+ BLOCK_START("SocialWindow::logicChildren")
+ BasicContainer::logicChildren();
+ BLOCK_END("SocialWindow::logicChildren")
+}
+#endif
diff --git a/src/gui/socialwindow.h b/src/gui/socialwindow.h
index 33891c92a..b8ed73655 100644
--- a/src/gui/socialwindow.h
+++ b/src/gui/socialwindow.h
@@ -120,6 +120,10 @@ public:
void widgetResized(const gcn::Event &event) override;
+#ifdef USE_PROFILER
+ void logicChildren();
+#endif
+
protected:
friend class SocialTab;
diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp
index b2810aa0b..e5eb90cd1 100644
--- a/src/gui/whoisonline.cpp
+++ b/src/gui/whoisonline.cpp
@@ -595,7 +595,9 @@ void WhoIsOnline::download()
void WhoIsOnline::logic()
{
+ BLOCK_START("WhoIsOnline::logic")
mScrollArea->logic();
+ BLOCK_END("WhoIsOnline::logic")
}
void WhoIsOnline::slowLogic()
diff --git a/src/gui/widgets/progressindicator.cpp b/src/gui/widgets/progressindicator.cpp
index d3d398c87..c33fa6bfe 100644
--- a/src/gui/widgets/progressindicator.cpp
+++ b/src/gui/widgets/progressindicator.cpp
@@ -60,8 +60,10 @@ ProgressIndicator::~ProgressIndicator()
void ProgressIndicator::logic()
{
+ BLOCK_START("ProgressIndicator::logic")
if (mIndicator)
mIndicator->update(10);
+ BLOCK_END("ProgressIndicator::logic")
}
void ProgressIndicator::draw(gcn::Graphics *graphics)
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 4e921a287..94937cac6 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -1195,3 +1195,10 @@ bool Window::getOptionBool(const std::string &name) const
return mSkin->getOption(name) != 0;
return 0;
}
+
+#ifdef USE_PROFILER
+void Window::logic()
+{
+ logicChildren();
+}
+#endif
diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h
index 11b30eba9..139dbcb1d 100644
--- a/src/gui/widgets/window.h
+++ b/src/gui/widgets/window.h
@@ -417,6 +417,10 @@ class Window : public gcn::Window,
bool isWindowVisible() const A_WARN_UNUSED
{ return mVisible; }
+#ifdef USE_PROFILER
+ virtual void logic();
+#endif
+
protected:
bool canMove() const A_WARN_UNUSED;
diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp
index 57feba81c..bc7e0f736 100644
--- a/src/gui/windowmenu.cpp
+++ b/src/gui/windowmenu.cpp
@@ -427,3 +427,12 @@ void WindowMenu::optionChanged(const std::string &name)
if (name == "autohideButtons")
mAutoHide = config.getIntValue("autohideButtons");
}
+
+#ifdef USE_PROFILER
+void WindowMenu::logicChildren()
+{
+ BLOCK_START("WindowMenu::logicChildren")
+ BasicContainer::logicChildren();
+ BLOCK_END("WindowMenu::logicChildren")
+}
+#endif
diff --git a/src/gui/windowmenu.h b/src/gui/windowmenu.h
index b3b77b16f..8519a17ba 100644
--- a/src/gui/windowmenu.h
+++ b/src/gui/windowmenu.h
@@ -113,6 +113,10 @@ class WindowMenu final : public Container,
void optionChanged(const std::string &name) override;
+#ifdef USE_PROFILER
+ void logicChildren();
+#endif
+
protected:
void drawChildren(gcn::Graphics* graphics) override;
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
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 75238e828..7481ad948 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -181,6 +181,7 @@ int inflateMemory(unsigned char *const in, const unsigned int inLength,
Map *MapReader::readMap(const std::string &filename,
const std::string &realFilename)
{
+ BLOCK_START("MapReader::readMap")
logger->log("Attempting to read map %s", realFilename.c_str());
// Load the file through resource manager
const ResourceManager *const resman = ResourceManager::getInstance();
@@ -189,7 +190,10 @@ Map *MapReader::readMap(const std::string &filename,
Map *map = nullptr;
if (!buffer)
+ {
+ BLOCK_END("MapReader::readMap")
return createEmptyMap(filename, realFilename);
+ }
unsigned char *inflated;
unsigned int inflatedSize;
@@ -206,6 +210,7 @@ Map *MapReader::readMap(const std::string &filename,
{
logger->log("Could not decompress map file (%s)",
realFilename.c_str());
+ BLOCK_END("MapReader::readMap")
return nullptr;
}
}
@@ -243,6 +248,7 @@ Map *MapReader::readMap(const std::string &filename,
updateMusic(map);
}
+ BLOCK_END("MapReader::readMap")
return map;
}