summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/being/localplayer.cpp2
-rw-r--r--src/configuration.cpp7
-rw-r--r--src/eventsmanager.cpp17
-rw-r--r--src/game.cpp9
-rw-r--r--src/gui/sdlinput.cpp2
-rw-r--r--src/gui/windows/minimap.cpp4
-rw-r--r--src/input/inputmanager.cpp18
-rw-r--r--src/input/joystick.cpp8
-rw-r--r--src/input/keyboardconfig.cpp2
-rw-r--r--src/localconsts.h2
-rw-r--r--src/net/download.cpp1
-rw-r--r--src/net/ea/beinghandler.cpp114
-rw-r--r--src/net/ea/inventoryhandler.cpp32
-rw-r--r--src/net/net.cpp2
-rw-r--r--src/net/tmwa/beinghandler.cpp35
-rw-r--r--src/resources/atlasmanager.cpp18
-rw-r--r--src/resources/imagehelper.cpp3
-rw-r--r--src/resources/map/map.cpp20
-rw-r--r--src/resources/mapreader.cpp15
19 files changed, 309 insertions, 2 deletions
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index cc3e327cb..28b08a558 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -2774,6 +2774,7 @@ void LocalPlayer::loadHomes()
void LocalPlayer::setMap(Map *const map)
{
+ BLOCK_START("LocalPlayer::setMap")
if (map)
{
if (socialWindow)
@@ -2785,6 +2786,7 @@ void LocalPlayer::setMap(Map *const map)
Being::setMap(map);
updateNavigateList();
+ BLOCK_END("LocalPlayer::setMap")
}
void LocalPlayer::setHome()
diff --git a/src/configuration.cpp b/src/configuration.cpp
index 550c61243..766684d5c 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -813,8 +813,12 @@ void Configuration::writeUpdated()
void Configuration::write()
{
+ BLOCK_START("Configuration::write")
if (mConfigPath.empty())
+ {
+ BLOCK_END("Configuration::write")
return;
+ }
mUpdated = false;
// Do not attempt to write to file that cannot be opened for writing
@@ -823,6 +827,7 @@ void Configuration::write()
{
logger->log("Configuration::write() couldn't open %s for writing",
mConfigPath.c_str());
+ BLOCK_END("Configuration::write")
return;
}
else
@@ -836,6 +841,7 @@ void Configuration::write()
if (!writer)
{
logger->log1("Configuration::write() error while creating writer");
+ BLOCK_END("Configuration::write")
return;
}
@@ -850,6 +856,7 @@ void Configuration::write()
xmlTextWriterEndDocument(writer);
xmlFreeTextWriter(writer);
+ BLOCK_END("Configuration::write")
}
void Configuration::addListener(const std::string &key,
diff --git a/src/eventsmanager.cpp b/src/eventsmanager.cpp
index e7b2eb977..15197c087 100644
--- a/src/eventsmanager.cpp
+++ b/src/eventsmanager.cpp
@@ -69,6 +69,7 @@ void EventsManager::shutdown()
bool EventsManager::handleCommonEvents(const SDL_Event &event) const
{
+ BLOCK_START("EventsManager::handleCommonEvents")
if (mLogInput)
logEvent(event);
@@ -77,23 +78,28 @@ bool EventsManager::handleCommonEvents(const SDL_Event &event) const
case SDL_QUIT:
client->setState(STATE_EXIT);
logger->log1("force exit");
+ BLOCK_END("EventsManager::handleCommonEvents")
return true;
#ifdef USE_SDL2
case SDL_WINDOWEVENT:
handleSDL2WindowEvent(event);
+ BLOCK_END("EventsManager::handleCommonEvents")
return true;
#else
case SDL_VIDEORESIZE:
WindowManager::resizeVideo(event.resize.w,
event.resize.h,
false);
+ BLOCK_END("EventsManager::handleCommonEvents")
return true;
case SDL_ACTIVEEVENT:
handleActive(event);
+ BLOCK_END("EventsManager::handleCommonEvents")
return true;
#ifdef ANDROID
case SDL_KEYBOARDSHOW:
WindowManager::updateScreenKeyboard(event.user.code);
+ BLOCK_END("EventsManager::handleCommonEvents")
return true;
case SDL_ACCELEROMETER:
break;
@@ -104,13 +110,18 @@ bool EventsManager::handleCommonEvents(const SDL_Event &event) const
}
if (inputManager.handleEvent(event))
+ {
+ BLOCK_END("EventsManager::handleCommonEvents")
return true;
+ }
+ BLOCK_END("EventsManager::handleCommonEvents")
return false;
}
bool EventsManager::handleEvents() const
{
+ BLOCK_START("EventsManager::handleEvents")
if (Game::instance())
{
// Let the game handle the events while it is active
@@ -156,13 +167,18 @@ bool EventsManager::handleEvents() const
#endif
}
if (client->getState() == STATE_EXIT)
+ {
+ BLOCK_END("EventsManager::handleEvents")
return true;
+ }
}
+ BLOCK_END("EventsManager::handleEvents")
return false;
}
void EventsManager::handleGameEvents() const
{
+ BLOCK_START("EventsManager::handleGameEvents")
Game *const game = Game::instance();
// Events
@@ -176,6 +192,7 @@ void EventsManager::handleGameEvents() const
if (handleCommonEvents(event))
break;
} // End while
+ BLOCK_END("EventsManager::handleGameEvents")
}
void EventsManager::optionChanged(const std::string &name)
diff --git a/src/game.cpp b/src/game.cpp
index 63bafe187..2535f539d 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -794,8 +794,12 @@ void Game::resetAdjustLevel()
void Game::handleMove()
{
+ BLOCK_START("Game::handleMove")
if (!player_node)
+ {
+ BLOCK_END("Game::handleMove")
return;
+ }
// Moving player around
if (player_node->isAlive()
@@ -806,7 +810,10 @@ void Game::handleMove()
{
NpcDialog *const dialog = NpcDialog::getActive();
if (dialog)
+ {
+ BLOCK_END("Game::handleMove")
return;
+ }
// Ignore input if either "ignore" key is pressed
// Stops the character moving about if the user's window manager
@@ -814,6 +821,7 @@ void Game::handleMove()
if (inputManager.isActionActive(InputAction::IGNORE_INPUT_1) ||
inputManager.isActionActive(InputAction::IGNORE_INPUT_2))
{
+ BLOCK_END("Game::handleMove")
return;
}
@@ -859,6 +867,7 @@ void Game::handleMove()
if (!inputManager.isActionActive(InputAction::EMOTE) || direction == 0)
moveInDirection(direction);
}
+ BLOCK_END("Game::handleMove")
}
void Game::moveInDirection(const unsigned char direction)
diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp
index 05518e9a6..eca3b5733 100644
--- a/src/gui/sdlinput.cpp
+++ b/src/gui/sdlinput.cpp
@@ -127,6 +127,7 @@ MouseInput SDLInput::dequeueMouseInput()
void SDLInput::pushInput(const SDL_Event &event)
{
+ BLOCK_START("SDLInput::pushInput")
KeyInput keyInput;
MouseInput mouseInput;
@@ -286,6 +287,7 @@ void SDLInput::pushInput(const SDL_Event &event)
default:
break;
} // end switch
+ BLOCK_END("SDLInput::pushInput")
}
void SDLInput::convertKeyEventToKey(const SDL_Event &event, KeyInput &keyInput)
diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp
index fbbb895f1..859d45b9e 100644
--- a/src/gui/windows/minimap.cpp
+++ b/src/gui/windows/minimap.cpp
@@ -112,6 +112,7 @@ void Minimap::deleteMapImage()
void Minimap::setMap(const Map *const map)
{
+ BLOCK_START("Minimap::setMap")
std::string caption;
if (map)
@@ -137,6 +138,7 @@ void Minimap::setMap(const Map *const map)
{
if (!isSticky())
setVisible(false);
+ BLOCK_END("Minimap::setMap")
return;
}
@@ -147,6 +149,7 @@ void Minimap::setMap(const Map *const map)
{
if (!isSticky())
setVisible(false);
+ BLOCK_END("Minimap::setMap")
return;
}
const int size = surface->h * surface->w;
@@ -225,6 +228,7 @@ void Minimap::setMap(const Map *const map)
if (!isSticky())
setVisible(false);
}
+ BLOCK_END("Minimap::setMap")
}
void Minimap::toggle()
diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp
index 813880209..75656114f 100644
--- a/src/input/inputmanager.cpp
+++ b/src/input/inputmanager.cpp
@@ -505,6 +505,7 @@ bool InputManager::handleAssignKey(const SDL_Event &event, const int type)
bool InputManager::handleEvent(const SDL_Event &event)
{
+ BLOCK_START("InputManager::handleEvent")
switch (event.type)
{
case SDL_KEYDOWN:
@@ -512,7 +513,10 @@ bool InputManager::handleEvent(const SDL_Event &event)
keyboard.refreshActiveKeys();
updateConditionMask();
if (handleAssignKey(event, InputType::KEYBOARD))
+ {
+ BLOCK_END("InputManager::handleEvent")
return true;
+ }
keyboard.handleActicateKey(event);
// send straight to gui for certain windows
@@ -523,6 +527,7 @@ bool InputManager::handleEvent(const SDL_Event &event)
guiInput->pushInput(event);
if (gui)
gui->handleInput();
+ BLOCK_END("InputManager::handleEvent")
return true;
}
break;
@@ -539,7 +544,10 @@ bool InputManager::handleEvent(const SDL_Event &event)
updateConditionMask();
// joystick.handleActicateButton(event);
if (handleAssignKey(event, InputType::JOYSTICK))
+ {
+ BLOCK_END("InputManager::handleEvent")
return true;
+ }
break;
}
case SDL_JOYBUTTONUP:
@@ -573,21 +581,30 @@ bool InputManager::handleEvent(const SDL_Event &event)
{
const bool res = gui->handleInput();
if (res && event.type == SDL_KEYDOWN)
+ {
+ BLOCK_END("InputManager::handleEvent")
return true;
+ }
}
switch (event.type)
{
case SDL_KEYDOWN:
if (triggerAction(keyboard.getActionVector(event)))
+ {
+ BLOCK_END("InputManager::handleEvent")
return true;
+ }
break;
case SDL_JOYBUTTONDOWN:
if (joystick && joystick->validate())
{
if (triggerAction(joystick->getActionVector(event)))
+ {
return true;
+ BLOCK_END("InputManager::handleEvent")
+ }
}
break;
#ifdef ANDROID
@@ -602,6 +619,7 @@ bool InputManager::handleEvent(const SDL_Event &event)
break;
}
+ BLOCK_END("InputManager::handleEvent")
return false;
}
diff --git a/src/input/joystick.cpp b/src/input/joystick.cpp
index 1357bc608..b7d34e6ec 100644
--- a/src/input/joystick.cpp
+++ b/src/input/joystick.cpp
@@ -159,15 +159,20 @@ void Joystick::setNumber(const int n)
void Joystick::logic()
{
+ BLOCK_START("Joystick::logic")
// When calibrating, don't bother the outside with our state
if (mCalibrating)
{
doCalibration();
+ BLOCK_END("Joystick::logic")
return;
};
if (!mEnabled || !mCalibrated)
+ {
+ BLOCK_END("Joystick::logic")
return;
+ }
mDirection = 0;
@@ -228,6 +233,7 @@ void Joystick::logic()
for (int i = 0; i < mButtonsNumber; i++)
mActiveButtons[i] = false;
}
+ BLOCK_END("Joystick::logic")
}
void Joystick::startCalibration()
@@ -345,6 +351,7 @@ bool Joystick::validate() const
void Joystick::handleRepeat(const int time)
{
+ BLOCK_START("Joystick::handleRepeat")
FOR_EACH (KeyTimeMapIter, it, mKeyTimeMap)
{
bool repeat(false);
@@ -365,6 +372,7 @@ void Joystick::handleRepeat(const int time)
}
}
}
+ BLOCK_END("Joystick::handleRepeat")
}
void Joystick::resetRepeat(const int key)
diff --git a/src/input/keyboardconfig.cpp b/src/input/keyboardconfig.cpp
index 49bcb831f..7642e260c 100644
--- a/src/input/keyboardconfig.cpp
+++ b/src/input/keyboardconfig.cpp
@@ -250,6 +250,7 @@ void KeyboardConfig::handleDeActicateKey(const int key)
void KeyboardConfig::handleRepeat(const int time)
{
+ BLOCK_START("KeyboardConfig::handleRepeat")
FOR_EACH (KeyTimeMapIter, it, mKeyTimeMap)
{
bool repeat(false);
@@ -275,6 +276,7 @@ void KeyboardConfig::handleRepeat(const int time)
}
}
}
+ BLOCK_END("KeyboardConfig::handleRepeat")
}
void KeyboardConfig::resetRepeat(const int key)
diff --git a/src/localconsts.h b/src/localconsts.h
index 549838619..089b512eb 100644
--- a/src/localconsts.h
+++ b/src/localconsts.h
@@ -111,7 +111,7 @@
// #define ANDROID_LOG 1
// profiler
-// #define USE_PROFILER 1
+#define USE_PROFILER 1
// draw calls
// #define DEBUG_DRAW_CALLS 1
diff --git a/src/net/download.cpp b/src/net/download.cpp
index 069290cde..d831578b2 100644
--- a/src/net/download.cpp
+++ b/src/net/download.cpp
@@ -154,6 +154,7 @@ unsigned long Download::fadler32(FILE *const file)
unsigned long Download::adlerBuffer(const char *const buffer, int size)
{
+ FUNC_BLOCK("Download::adlerBuffer", 1)
unsigned long adler = adler32(0L, Z_NULL, 0);
return adler32(static_cast<uInt>(adler),
reinterpret_cast<const Bytef*>(buffer), size);
diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp
index 8366d1dc4..002d7cb43 100644
--- a/src/net/ea/beinghandler.cpp
+++ b/src/net/ea/beinghandler.cpp
@@ -118,8 +118,12 @@ void BeingHandler::setSprite(Being *const being, const unsigned int slot,
void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg,
const bool visible)
{
+ BLOCK_START("BeingHandler::processBeingVisibleOrMove")
if (!actorManager)
+ {
+ BLOCK_END("BeingHandler::processBeingVisibleOrMove")
return;
+ }
int spawnId;
@@ -154,15 +158,24 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg,
// Being with id >= 110000000 and job 0 are better
// known as ghosts, so don't create those.
if (job == 0 && id >= 110000000)
+ {
+ BLOCK_END("BeingHandler::processBeingVisibleOrMove")
return;
+ }
if (actorManager->isBlocked(id) == true)
+ {
+ BLOCK_END("BeingHandler::processBeingVisibleOrMove")
return;
+ }
dstBeing = createBeing(id, job);
if (!dstBeing)
+ {
+ BLOCK_END("BeingHandler::processBeingVisibleOrMove")
return;
+ }
if (job == 1022 && killStats)
killStats->jackoAlive(dstBeing->getId());
@@ -339,12 +352,17 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg,
(statusEffects >> 16) & 0xffff));
dstBeing->setStatusEffectBlock(16, static_cast<uint16_t>(
statusEffects & 0xffff));
+ BLOCK_END("BeingHandler::processBeingVisibleOrMove")
}
void BeingHandler::processBeingMove2(Net::MessageIn &msg) const
{
+ BLOCK_START("BeingHandler::processBeingMove2")
if (!actorManager)
+ {
+ BLOCK_END("BeingHandler::processBeingMove2")
return;
+ }
/*
* A simplified movement packet, used by the
@@ -360,7 +378,10 @@ void BeingHandler::processBeingMove2(Net::MessageIn &msg) const
*/
if (!dstBeing)
+ {
+ BLOCK_END("BeingHandler::processBeingMove2")
return;
+ }
uint16_t srcX, srcY, dstX, dstY;
msg.readCoordinatePair(srcX, srcY, dstX, dstY);
@@ -371,10 +392,12 @@ void BeingHandler::processBeingMove2(Net::MessageIn &msg) const
dstBeing->setDestination(dstX, dstY);
if (dstBeing->getType() == ActorType::PLAYER)
dstBeing->setMoveTime();
+ BLOCK_END("BeingHandler::processBeingMove2")
}
void BeingHandler::processBeingSpawn(Net::MessageIn &msg)
{
+ BLOCK_START("BeingHandler::processBeingSpawn")
// skipping this packet
mSpawnId = msg.readInt32(); // id
msg.readInt16(); // speed
@@ -382,19 +405,27 @@ void BeingHandler::processBeingSpawn(Net::MessageIn &msg)
msg.readInt16(); // opt2
msg.readInt16(); // option
msg.readInt16(); // disguise
+ BLOCK_END("BeingHandler::processBeingSpawn")
}
void BeingHandler::processBeingRemove(Net::MessageIn &msg) const
{
+ BLOCK_START("BeingHandler::processBeingRemove")
if (!actorManager || !player_node)
+ {
+ BLOCK_END("BeingHandler::processBeingRemove")
return;
+ }
// A being should be removed or has died
const int id = msg.readInt32();
Being *const dstBeing = actorManager->findBeing(id);
if (!dstBeing)
+ {
+ BLOCK_END("BeingHandler::processBeingRemove")
return;
+ }
player_node->followMoveTo(dstBeing, player_node->getNextDestX(),
player_node->getNextDestY());
@@ -424,19 +455,27 @@ void BeingHandler::processBeingRemove(Net::MessageIn &msg) const
}
actorManager->destroy(dstBeing);
}
+ BLOCK_END("BeingHandler::processBeingRemove")
}
void BeingHandler::processBeingResurrect(Net::MessageIn &msg) const
{
+ BLOCK_START("BeingHandler::processBeingResurrect")
if (!actorManager || !player_node)
+ {
+ BLOCK_END("BeingHandler::processBeingResurrect")
return;
+ }
// A being changed mortality status
const int id = msg.readInt32();
Being *const dstBeing = actorManager->findBeing(id);
if (!dstBeing)
+ {
+ BLOCK_END("BeingHandler::processBeingResurrect")
return;
+ }
// If this is player's current target, clear it.
if (dstBeing == player_node->getTarget())
@@ -444,13 +483,17 @@ void BeingHandler::processBeingResurrect(Net::MessageIn &msg) const
if (msg.readInt8() == 1)
dstBeing->setAction(BeingAction::STAND, 0);
+ BLOCK_END("BeingHandler::processBeingResurrect")
}
-
void BeingHandler::processSkillDamage(Net::MessageIn &msg) const
{
+ BLOCK_START("BeingHandler::processSkillDamage")
if (!actorManager)
+ {
+ BLOCK_END("BeingHandler::processSkillDamage")
return;
+ }
const int id = msg.readInt16(); // Skill Id
Being *const srcBeing = actorManager->findBeing(msg.readInt32());
@@ -466,12 +509,17 @@ void BeingHandler::processSkillDamage(Net::MessageIn &msg) const
srcBeing->handleSkill(dstBeing, param1, id, level);
if (dstBeing)
dstBeing->takeDamage(srcBeing, param1, Being::SKILL, id);
+ BLOCK_END("BeingHandler::processSkillDamage")
}
void BeingHandler::processBeingAction(Net::MessageIn &msg) const
{
+ BLOCK_START("BeingHandler::processBeingAction")
if (!actorManager)
+ {
+ BLOCK_END("BeingHandler::processBeingAction")
return;
+ }
Being *const srcBeing = actorManager->findBeing(msg.readInt32());
Being *const dstBeing = actorManager->findBeing(msg.readInt32());
@@ -550,17 +598,25 @@ void BeingHandler::processBeingAction(Net::MessageIn &msg) const
logger->log("type: " + toString(type));
break;
}
+ BLOCK_END("BeingHandler::processBeingAction")
}
void BeingHandler::processBeingSelfEffect(Net::MessageIn &msg) const
{
+ BLOCK_START("BeingHandler::processBeingSelfEffect")
if (!effectManager || !actorManager)
+ {
+ BLOCK_END("BeingHandler::processBeingSelfEffect")
return;
+ }
const int id = static_cast<uint32_t>(msg.readInt32());
Being *const being = actorManager->findBeing(id);
if (!being)
+ {
+ BLOCK_END("BeingHandler::processBeingSelfEffect")
return;
+ }
const int effectType = msg.readInt32();
@@ -573,16 +629,24 @@ void BeingHandler::processBeingSelfEffect(Net::MessageIn &msg) const
{ // reset received damage
socialWindow->resetDamage(being->getName());
}
+ BLOCK_END("BeingHandler::processBeingSelfEffect")
}
void BeingHandler::processBeingEmotion(Net::MessageIn &msg) const
{
+ BLOCK_START("BeingHandler::processBeingEmotion")
if (!player_node || !actorManager)
+ {
+ BLOCK_END("BeingHandler::processBeingEmotion")
return;
+ }
Being *const dstBeing = actorManager->findBeing(msg.readInt32());
if (!dstBeing)
+ {
+ BLOCK_END("BeingHandler::processBeingEmotion")
return;
+ }
if (player_relations.hasPermission(dstBeing, PlayerRelation::EMOTE))
{
@@ -595,12 +659,17 @@ void BeingHandler::processBeingEmotion(Net::MessageIn &msg) const
}
if (dstBeing->getType() == ActorType::PLAYER)
dstBeing->setOtherTime();
+ BLOCK_END("BeingHandler::processBeingEmotion")
}
void BeingHandler::processNameResponse(Net::MessageIn &msg) const
{
+ BLOCK_START("BeingHandler::processNameResponse")
if (!player_node || !actorManager)
+ {
+ BLOCK_END("BeingHandler::processNameResponse")
return;
+ }
const int beingId = msg.readInt32();
Being *const dstBeing = actorManager->findBeing(beingId);
@@ -635,22 +704,32 @@ void BeingHandler::processNameResponse(Net::MessageIn &msg) const
}
}
}
+ BLOCK_END("BeingHandler::processNameResponse")
}
void BeingHandler::processIpResponse(Net::MessageIn &msg) const
{
+ BLOCK_START("BeingHandler::processIpResponse")
if (!actorManager)
+ {
+ BLOCK_END("BeingHandler::processIpResponse")
return;
+ }
Being *const dstBeing = actorManager->findBeing(msg.readInt32());
if (dstBeing)
dstBeing->setIp(ipToString(msg.readInt32()));
+ BLOCK_END("BeingHandler::processIpResponse")
}
void BeingHandler::processPlayerGuilPartyInfo(Net::MessageIn &msg) const
{
+ BLOCK_START("BeingHandler::processPlayerGuilPartyInfo")
if (!actorManager)
+ {
+ BLOCK_END("BeingHandler::processPlayerGuilPartyInfo")
return;
+ }
Being *const dstBeing = actorManager->findBeing(msg.readInt32());
@@ -669,17 +748,25 @@ void BeingHandler::processPlayerGuilPartyInfo(Net::MessageIn &msg) const
dstBeing->addToCache();
msg.readString(24); // Discard this
}
+ BLOCK_END("BeingHandler::processPlayerGuilPartyInfo")
}
void BeingHandler::processBeingChangeDirection(Net::MessageIn &msg) const
{
+ BLOCK_START("BeingHandler::processBeingChangeDirection")
if (!actorManager)
+ {
+ BLOCK_END("BeingHandler::processBeingChangeDirection")
return;
+ }
Being *const dstBeing = actorManager->findBeing(msg.readInt32());
if (!dstBeing)
+ {
+ BLOCK_END("BeingHandler::processBeingChangeDirection")
return;
+ }
msg.readInt16(); // unused
@@ -688,12 +775,17 @@ void BeingHandler::processBeingChangeDirection(Net::MessageIn &msg) const
dstBeing->setDirection(dir);
if (player_node)
player_node->imitateDirection(dstBeing, dir);
+ BLOCK_END("BeingHandler::processBeingChangeDirection")
}
void BeingHandler::processPlayerStop(Net::MessageIn &msg) const
{
+ BLOCK_START("BeingHandler::processPlayerStop")
if (!actorManager || !player_node)
+ {
+ BLOCK_END("BeingHandler::processPlayerStop")
return;
+ }
const int id = msg.readInt32();
@@ -709,11 +801,13 @@ void BeingHandler::processPlayerStop(Net::MessageIn &msg) const
dstBeing->setAction(BeingAction::STAND, 0);
}
}
+ BLOCK_END("BeingHandler::processPlayerStop")
}
void BeingHandler::processPlayerMoveToAttack(Net::MessageIn &msg A_UNUSED)
const
{
+ BLOCK_START("BeingHandler::processPlayerStop")
/*
* This is an *advisory* message, telling the client that
* it needs to move the character before attacking
@@ -722,12 +816,17 @@ void BeingHandler::processPlayerMoveToAttack(Net::MessageIn &msg A_UNUSED)
*/
if (player_node)
player_node->fixAttackTarget();
+ BLOCK_END("BeingHandler::processPlayerStop")
}
void BeingHandler::processPlaterStatusChange(Net::MessageIn &msg) const
{
+ BLOCK_START("BeingHandler::processPlayerStop")
if (!actorManager)
+ {
+ BLOCK_END("BeingHandler::processPlayerStop")
return;
+ }
// Change in players' flags
const int id = msg.readInt32();
@@ -745,12 +844,17 @@ void BeingHandler::processPlaterStatusChange(Net::MessageIn &msg) const
(statusEffects >> 16) & 0xffff));
dstBeing->setStatusEffectBlock(16, static_cast<uint16_t>(
statusEffects & 0xffff));
+ BLOCK_END("BeingHandler::processPlayerStop")
}
void BeingHandler::processBeingStatusChange(Net::MessageIn &msg) const
{
+ BLOCK_START("BeingHandler::processBeingStatusChange")
if (!actorManager)
+ {
+ BLOCK_END("BeingHandler::processBeingStatusChange")
return;
+ }
// Status change
const uint16_t status = msg.readInt16();
@@ -760,6 +864,7 @@ void BeingHandler::processBeingStatusChange(Net::MessageIn &msg) const
Being *const dstBeing = actorManager->findBeing(id);
if (dstBeing)
dstBeing->setStatusEffect(status, flag);
+ BLOCK_END("BeingHandler::processBeingStatusChange")
}
void BeingHandler::processSkilCasting(Net::MessageIn &msg) const
@@ -784,17 +889,23 @@ void BeingHandler::processSkillNoDamage(Net::MessageIn &msg) const
void BeingHandler::processPvpMapMode(Net::MessageIn &msg) const
{
+ BLOCK_START("BeingHandler::processPvpMapMode")
const Game *const game = Game::instance();
if (!game)
+ {
+ BLOCK_END("BeingHandler::processPvpMapMode")
return;
+ }
Map *const map = game->getCurrentMap();
if (map)
map->setPvpMode(msg.readInt16());
+ BLOCK_END("BeingHandler::processPvpMapMode")
}
void BeingHandler::processPvpSet(Net::MessageIn &msg) const
{
+ BLOCK_START("BeingHandler::processPvpSet")
const int id = msg.readInt32(); // id
const int rank = msg.readInt32(); // rank
msg.readInt32(); // num
@@ -804,6 +915,7 @@ void BeingHandler::processPvpSet(Net::MessageIn &msg) const
if (dstBeing)
dstBeing->setPvpRank(rank);
}
+ BLOCK_END("BeingHandler::processPvpSet")
}
} // namespace Ea
diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp
index a508460d4..09b8b6bad 100644
--- a/src/net/ea/inventoryhandler.cpp
+++ b/src/net/ea/inventoryhandler.cpp
@@ -176,6 +176,7 @@ int InventoryHandler::getSlot(const int eAthenaSlot)
void InventoryHandler::processPlayerInventory(Net::MessageIn &msg,
const bool playerInvintory)
{
+ BLOCK_START("InventoryHandler::processPlayerInventory")
Inventory *const inventory = player_node
? PlayerInfo::getInventory() : nullptr;
if (playerInvintory)
@@ -239,10 +240,12 @@ void InventoryHandler::processPlayerInventory(Net::MessageIn &msg,
amount, 0, identified, false));
}
}
+ BLOCK_END("InventoryHandler::processPlayerInventory")
}
void InventoryHandler::processPlayerStorageEquip(Net::MessageIn &msg)
{
+ BLOCK_START("InventoryHandler::processPlayerStorageEquip")
msg.readInt16(); // length
const int number = (msg.getLength() - 4) / 20;
@@ -276,10 +279,12 @@ void InventoryHandler::processPlayerStorageEquip(Net::MessageIn &msg)
mInventoryItems.push_back(Ea::InventoryItem(index,
itemId, amount, refine, identified, false));
}
+ BLOCK_END("InventoryHandler::processPlayerStorageEquip")
}
void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg)
{
+ BLOCK_START("InventoryHandler::processPlayerInventoryAdd")
Inventory *const inventory = player_node
? PlayerInfo::getInventory() : nullptr;
@@ -341,10 +346,12 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg)
}
ArrowsListener::distributeEvent();
}
+ BLOCK_END("InventoryHandler::processPlayerInventoryAdd")
}
void InventoryHandler::processPlayerInventoryRemove(Net::MessageIn &msg)
{
+ BLOCK_START("InventoryHandler::processPlayerInventoryRemove")
Inventory *const inventory = player_node
? PlayerInfo::getInventory() : nullptr;
@@ -360,10 +367,12 @@ void InventoryHandler::processPlayerInventoryRemove(Net::MessageIn &msg)
ArrowsListener::distributeEvent();
}
}
+ BLOCK_END("InventoryHandler::processPlayerInventoryRemove")
}
void InventoryHandler::processPlayerInventoryUse(Net::MessageIn &msg)
{
+ BLOCK_START("InventoryHandler::processPlayerInventoryUse")
Inventory *const inventory = player_node
? PlayerInfo::getInventory() : nullptr;
@@ -383,10 +392,12 @@ void InventoryHandler::processPlayerInventoryUse(Net::MessageIn &msg)
inventory->removeItemAt(index);
}
}
+ BLOCK_END("InventoryHandler::processPlayerInventoryUse")
}
void InventoryHandler::processItemUseResponse(Net::MessageIn &msg)
{
+ BLOCK_START("InventoryHandler::processItemUseResponse")
Inventory *const inventory = player_node
? PlayerInfo::getInventory() : nullptr;
@@ -410,10 +421,12 @@ void InventoryHandler::processItemUseResponse(Net::MessageIn &msg)
}
}
}
+ BLOCK_END("InventoryHandler::processItemUseResponse")
}
void InventoryHandler::processPlayerStorageStatus(Net::MessageIn &msg)
{
+ BLOCK_START("InventoryHandler::processPlayerStorageStatus")
/*
* This is the closest we get to an "Open Storage" packet from the
* server. It always comes after the two SMSG_PLAYER_STORAGE_...
@@ -437,10 +450,12 @@ void InventoryHandler::processPlayerStorageStatus(Net::MessageIn &msg)
mStorageWindow = new InventoryWindow(mStorage);
mStorageWindow->postInit();
}
+ BLOCK_END("InventoryHandler::processPlayerStorageStatus")
}
void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg)
{
+ BLOCK_START("InventoryHandler::processPlayerStorageAdd")
// Move an item into storage
const int index = msg.readInt16() - STORAGE_OFFSET;
const int amount = msg.readInt32();
@@ -467,10 +482,12 @@ void InventoryHandler::processPlayerStorageAdd(Net::MessageIn &msg)
refine, identified, false);
}
}
+ BLOCK_END("InventoryHandler::processPlayerStorageAdd")
}
void InventoryHandler::processPlayerStorageRemove(Net::MessageIn &msg)
{
+ BLOCK_START("InventoryHandler::processPlayerStorageRemove")
// Move an item out of storage
const int index = msg.readInt16() - STORAGE_OFFSET;
const int amount = msg.readInt16();
@@ -483,10 +500,12 @@ void InventoryHandler::processPlayerStorageRemove(Net::MessageIn &msg)
mStorage->removeItemAt(index);
}
}
+ BLOCK_END("InventoryHandler::processPlayerStorageRemove")
}
void InventoryHandler::processPlayerStorageClose(Net::MessageIn &msg A_UNUSED)
{
+ BLOCK_START("InventoryHandler::processPlayerStorageClose")
// Storage access has been closed
// Storage window deletes itself
if (mStorageWindow)
@@ -500,10 +519,12 @@ void InventoryHandler::processPlayerStorageClose(Net::MessageIn &msg A_UNUSED)
mStorage->clear();
delete2(mStorage);
+ BLOCK_END("InventoryHandler::processPlayerStorageClose")
}
void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg)
{
+ BLOCK_START("InventoryHandler::processPlayerEquipment")
Inventory *const inventory = player_node
? PlayerInfo::getInventory() : nullptr;
@@ -547,10 +568,12 @@ void InventoryHandler::processPlayerEquipment(Net::MessageIn &msg)
if (equipType)
mEquips.setEquipment(getSlot(equipType), index);
}
+ BLOCK_END("InventoryHandler::processPlayerEquipment")
}
void InventoryHandler::processPlayerEquip(Net::MessageIn &msg)
{
+ BLOCK_START("InventoryHandler::processPlayerEquip")
const int index = msg.readInt16() - INVENTORY_OFFSET;
const int equipType = msg.readInt16();
const int flag = msg.readInt8();
@@ -559,10 +582,12 @@ void InventoryHandler::processPlayerEquip(Net::MessageIn &msg)
NotifyManager::notify(NotifyTypes::EQUIP_FAILED);
else
mEquips.setEquipment(getSlot(equipType), index);
+ BLOCK_END("InventoryHandler::processPlayerEquip")
}
void InventoryHandler::processPlayerUnEquip(Net::MessageIn &msg)
{
+ BLOCK_START("InventoryHandler::processPlayerUnEquip")
msg.readInt16(); // inder val - INVENTORY_OFFSET;
const int equipType = msg.readInt16();
const int flag = msg.readInt8();
@@ -571,19 +596,23 @@ void InventoryHandler::processPlayerUnEquip(Net::MessageIn &msg)
mEquips.setEquipment(getSlot(equipType), -1);
if (equipType & 0x8000)
ArrowsListener::distributeEvent();
+ BLOCK_END("InventoryHandler::processPlayerUnEquip")
}
void InventoryHandler::processPlayerAttackRange(Net::MessageIn &msg)
{
+ BLOCK_START("InventoryHandler::processPlayerAttackRange")
const int range = msg.readInt16();
if (player_node)
player_node->setAttackRange(range);
PlayerInfo::setStatBase(Attributes::ATTACK_RANGE, range);
PlayerInfo::setStatMod(Attributes::ATTACK_RANGE, 0);
+ BLOCK_END("InventoryHandler::processPlayerAttackRange")
}
void InventoryHandler::processPlayerArrowEquip(Net::MessageIn &msg)
{
+ BLOCK_START("InventoryHandler::processPlayerArrowEquip")
int index = msg.readInt16();
if (index <= 1)
return;
@@ -591,16 +620,19 @@ void InventoryHandler::processPlayerArrowEquip(Net::MessageIn &msg)
index -= INVENTORY_OFFSET;
mEquips.setEquipment(Equipment::EQUIP_PROJECTILE_SLOT, index);
ArrowsListener::distributeEvent();
+ BLOCK_END("InventoryHandler::processPlayerArrowEquip")
}
void InventoryHandler::closeStorage()
{
+ BLOCK_START("InventoryHandler::closeStorage")
if (mStorageWindow)
{
mStorageWindow->unsetInventory();
mStorageWindow->close();
mStorageWindow = nullptr;
}
+ BLOCK_END("InventoryHandler::closeStorage")
}
void InventoryHandler::forgotStorage()
diff --git a/src/net/net.cpp b/src/net/net.cpp
index 90cf9e16a..63a348bde 100644
--- a/src/net/net.cpp
+++ b/src/net/net.cpp
@@ -137,6 +137,7 @@ ServerInfo::Type networkType = ServerInfo::UNKNOWN;
void connectToServer(const ServerInfo &server)
{
+ BLOCK_START("Net::connectToServer")
if (networkType == server.type && getGeneralHandler())
{
getGeneralHandler()->reload();
@@ -175,6 +176,7 @@ void connectToServer(const ServerInfo &server)
getLoginHandler()->setServer(server);
getLoginHandler()->connect();
}
+ BLOCK_END("Net::connectToServer")
}
void unload()
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index 28c167e86..53ca71aca 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -250,8 +250,12 @@ void BeingHandler::undress(Being *const being) const
void BeingHandler::processBeingChangeLook(Net::MessageIn &msg,
const bool look2) const
{
+ BLOCK_START("BeingHandler::processBeingChangeLook")
if (!actorManager)
+ {
+ BLOCK_END("BeingHandler::processBeingChangeLook")
return;
+ }
/*
* SMSG_BEING_CHANGE_LOOKS (0x00c3) and
@@ -267,7 +271,10 @@ void BeingHandler::processBeingChangeLook(Net::MessageIn &msg,
Being *const dstBeing = actorManager->findBeing(msg.readInt32());
if (!dstBeing)
+ {
+ BLOCK_END("BeingHandler::processBeingChangeLook")
return;
+ }
const int type = msg.readInt8();
int id = 0;
@@ -292,7 +299,10 @@ void BeingHandler::processBeingChangeLook(Net::MessageIn &msg,
dstBeing->setOtherTime();
if (!player_node)
+ {
+ BLOCK_END("BeingHandler::processBeingChangeLook")
return;
+ }
switch (type)
{
@@ -388,12 +398,17 @@ void BeingHandler::processBeingChangeLook(Net::MessageIn &msg,
logger->log("name: " + toString(dstBeing->getName()));
break;
}
+ BLOCK_END("BeingHandler::processBeingChangeLook")
}
void BeingHandler::processNameResponse2(Net::MessageIn &msg)
{
+ BLOCK_START("BeingHandler::processNameResponse2")
if (!actorManager || !player_node)
+ {
+ BLOCK_END("BeingHandler::processNameResponse2")
return;
+ }
const int len = msg.readInt16();
const int beingId = msg.readInt32();
@@ -429,13 +444,18 @@ void BeingHandler::processNameResponse2(Net::MessageIn &msg)
}
}
}
+ BLOCK_END("BeingHandler::processNameResponse2")
}
void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg,
const int msgType) const
{
+ BLOCK_START("BeingHandler::processPlayerMoveUpdate")
if (!actorManager || !player_node)
+ {
+ BLOCK_END("BeingHandler::processPlayerMoveUpdate")
return;
+ }
// An update about a player, potentially including movement.
const int id = msg.readInt32();
@@ -453,12 +473,18 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg,
if (!dstBeing)
{
if (actorManager->isBlocked(id) == true)
+ {
+ BLOCK_END("BeingHandler::processPlayerMoveUpdate")
return;
+ }
dstBeing = createBeing(id, job);
if (!dstBeing)
+ {
+ BLOCK_END("BeingHandler::processPlayerMoveUpdate")
return;
+ }
}
else if (disguiseId)
{
@@ -651,12 +677,17 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg,
if (msgType == 3 && dstBeing->getType() == ActorType::PLAYER)
dstBeing->setMoveTime();
+ BLOCK_END("BeingHandler::processPlayerMoveUpdate")
}
void BeingHandler::processBeingMove3(Net::MessageIn &msg)
{
+ BLOCK_START("BeingHandler::processBeingMove3")
if (serverVersion < 10)
+ {
+ BLOCK_END("BeingHandler::processBeingMove3")
return;
+ }
static const int16_t dirx[8] = {0, -1, -1, -1, 0, 1, 1, 1};
static const int16_t diry[8] = {1, 1, 0, -1, -1, -1, 0, 1};
@@ -664,7 +695,10 @@ void BeingHandler::processBeingMove3(Net::MessageIn &msg)
const int len = msg.readInt16() - 14;
Being *const dstBeing = actorManager->findBeing(msg.readInt32());
if (!dstBeing)
+ {
+ BLOCK_END("BeingHandler::processBeingMove3")
return;
+ }
const int16_t speed = msg.readInt16();
dstBeing->setWalkSpeed(Vector(speed, speed, 0));
int16_t x = msg.readInt16();
@@ -690,6 +724,7 @@ void BeingHandler::processBeingMove3(Net::MessageIn &msg)
delete [] moves;
}
dstBeing->setPath(path);
+ BLOCK_END("BeingHandler::processBeingMove3")
}
} // namespace TmwAthena
diff --git a/src/resources/atlasmanager.cpp b/src/resources/atlasmanager.cpp
index 50e8cbc80..cadf917f9 100644
--- a/src/resources/atlasmanager.cpp
+++ b/src/resources/atlasmanager.cpp
@@ -50,6 +50,7 @@ AtlasManager::AtlasManager()
AtlasResource *AtlasManager::loadTextureAtlas(const std::string &name,
const StringVect &files)
{
+ BLOCK_START("AtlasManager::loadTextureAtlas")
std::vector<TextureAtlas*> atlases;
std::vector<Image*> images;
AtlasResource *resource = new AtlasResource;
@@ -91,12 +92,14 @@ AtlasResource *AtlasManager::loadTextureAtlas(const std::string &name,
resource->atlases.push_back(atlas);
}
+ BLOCK_END("AtlasManager::loadTextureAtlas")
return resource;
}
void AtlasManager::loadImages(const StringVect &files,
std::vector<Image*> &images)
{
+ BLOCK_START("AtlasManager::loadImages")
ResourceManager *const resman = ResourceManager::getInstance();
FOR_EACH (StringVectCIter, it, files)
@@ -139,6 +142,7 @@ void AtlasManager::loadImages(const StringVect &files,
}
delete d;
}
+ BLOCK_END("AtlasManager::loadImages")
}
void AtlasManager::simpleSort(const std::string &restrict name,
@@ -146,6 +150,7 @@ void AtlasManager::simpleSort(const std::string &restrict name,
const std::vector<Image*> &restrict images,
int size)
{
+ BLOCK_START("AtlasManager::simpleSort")
int x = 0;
int y = 0;
int tempHeight = 0;
@@ -208,10 +213,12 @@ void AtlasManager::simpleSort(const std::string &restrict name,
atlases.push_back(atlas);
else
delete atlas;
+ BLOCK_END("AtlasManager::simpleSort")
}
SDL_Surface *AtlasManager::createSDLAtlas(TextureAtlas *const atlas)
{
+ BLOCK_START("AtlasManager::createSDLAtlas")
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
const unsigned int rmask = 0xff000000;
const unsigned int gmask = 0x00ff0000;
@@ -226,7 +233,10 @@ SDL_Surface *AtlasManager::createSDLAtlas(TextureAtlas *const atlas)
// do not create atlas based on only one image
if (atlas->items.size() == 1)
+ {
+ BLOCK_END("AtlasManager::createSDLAtlas")
return nullptr;
+ }
// using only power of two sizes.
atlas->width = powerOfTwo(atlas->width);
@@ -234,11 +244,16 @@ SDL_Surface *AtlasManager::createSDLAtlas(TextureAtlas *const atlas)
const int width = atlas->width;
const int height = atlas->height;
+ BLOCK_START("AtlasManager::createSDLAtlas create surface")
// temp SDL surface for atlas
SDL_Surface *const surface = MSDL_CreateRGBSurface(SDL_SWSURFACE,
width, height, 32U, rmask, gmask, bmask, amask);
if (!surface)
+ {
+ BLOCK_END("AtlasManager::createSDLAtlas")
return nullptr;
+ }
+ BLOCK_END("AtlasManager::createSDLAtlas create surface")
SurfaceGraphics *const graphics = new SurfaceGraphics();
graphics->setTarget(surface);
@@ -254,6 +269,7 @@ SDL_Surface *AtlasManager::createSDLAtlas(TextureAtlas *const atlas)
{
if (image->mSDLSurface)
{
+ BLOCK_START("AtlasManager::createSDLAtlas set surface attr")
#ifdef USE_SDL2
SDL_SetSurfaceAlphaMod(image->mSDLSurface, SDL_ALPHA_OPAQUE);
SDL_SetSurfaceBlendMode(image->mSDLSurface,
@@ -261,6 +277,7 @@ SDL_Surface *AtlasManager::createSDLAtlas(TextureAtlas *const atlas)
#else
SDL_SetAlpha(image->mSDLSurface, 0, SDL_ALPHA_OPAQUE);
#endif
+ BLOCK_END("AtlasManager::createSDLAtlas set surface attr")
graphics->drawImage(image, item->x, item->y);
}
}
@@ -268,6 +285,7 @@ SDL_Surface *AtlasManager::createSDLAtlas(TextureAtlas *const atlas)
delete graphics;
atlas->surface = surface;
+ BLOCK_END("AtlasManager::createSDLAtlas")
return surface;
}
diff --git a/src/resources/imagehelper.cpp b/src/resources/imagehelper.cpp
index 329a487da..43c1d5d1c 100644
--- a/src/resources/imagehelper.cpp
+++ b/src/resources/imagehelper.cpp
@@ -57,10 +57,12 @@ Image *ImageHelper::load(SDL_RWops *const rw)
Image *ImageHelper::load(SDL_RWops *const rw, Dye const &dye)
{
+ BLOCK_START("ImageHelper::load")
SDL_Surface *const tmpImage = loadPng(rw);
if (!tmpImage)
{
logger->log("Error, image load failed: %s", IMG_GetError());
+ BLOCK_END("ImageHelper::load")
return nullptr;
}
@@ -114,6 +116,7 @@ Image *ImageHelper::load(SDL_RWops *const rw, Dye const &dye)
Image *const image = load(surf);
MSDL_FreeSurface(surf);
+ BLOCK_END("ImageHelper::load")
return image;
}
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp
index 279262124..3d13ba2e5 100644
--- a/src/resources/map/map.cpp
+++ b/src/resources/map/map.cpp
@@ -743,6 +743,7 @@ Path Map::findPath(const int startX, const int startY,
const int destX, const int destY,
const unsigned char walkmask, const int maxCost)
{
+ BLOCK_START("Map::findPath")
// The basic walking cost of a tile.
static const int basicCost = 100;
const int basicCost2 = 100 * 362 / 256;
@@ -752,16 +753,25 @@ Path Map::findPath(const int startX, const int startY,
Path path;
if (startX >= mWidth || startY >= mHeight || startX < 0 || startY < 0)
+ {
+ BLOCK_END("Map::findPath")
return path;
+ }
// Return when destination not walkable
if (!getWalk(destX, destY, walkmask))
+ {
+ BLOCK_END("Map::findPath")
return path;
+ }
// Reset starting tile's G cost to 0
MetaTile *const startTile = &mMetaTiles[startX + startY * mWidth];
if (!startTile)
+ {
+ BLOCK_END("Map::findPath")
return path;
+ }
startTile->Gcost = 0;
@@ -960,6 +970,7 @@ Path Map::findPath(const int startX, const int startY,
}
}
+ BLOCK_END("Map::findPath")
return path;
}
@@ -977,8 +988,12 @@ void Map::addParticleEffect(const std::string &effectFile,
void Map::initializeParticleEffects(Particle *const engine)
{
+ BLOCK_START("Map::initializeParticleEffects")
if (!engine)
+ {
+ BLOCK_END("Map::initializeParticleEffects")
return;
+ }
if (config.getBoolValue("particleeffects"))
{
@@ -991,13 +1006,16 @@ void Map::initializeParticleEffects(Particle *const engine)
p->adjustEmitterSize(i->w, i->h);
}
}
+ BLOCK_END("Map::initializeParticleEffects")
}
void Map::addExtraLayer()
{
+ BLOCK_START("Map::addExtraLayer")
if (!mSpecialLayer)
{
logger->log1("No special layer");
+ BLOCK_END("Map::addExtraLayer")
return;
}
const std::string mapFileName = getUserMapDirectory().append(
@@ -1011,6 +1029,7 @@ void Map::addExtraLayer()
if (!mapFile.is_open())
{
mapFile.close();
+ BLOCK_END("Map::addExtraLayer")
return;
}
char line[201];
@@ -1062,6 +1081,7 @@ void Map::addExtraLayer()
}
mapFile.close();
}
+ BLOCK_END("Map::addExtraLayer")
}
void Map::saveExtraLayer() const
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index f8515d021..95321fc0f 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -273,7 +273,9 @@ Map *MapReader::readMap(const std::string &restrict filename,
void MapReader::loadLayers(const std::string &path)
{
+ BLOCK_START("MapReader::loadLayers")
loadXmlDir2(path, addLayerToList, ".tmx");
+ BLOCK_END("MapReader::loadLayers")
}
void MapReader::unloadTempLayers()
@@ -326,6 +328,7 @@ Map *MapReader::readMap(XmlNodePtrConst node, const std::string &path)
ResourceManager *const resman = ResourceManager::getInstance();
#ifdef USE_OPENGL
+ BLOCK_START("MapReader::readMap load atlas")
if (graphicsManager.getUseAtlases())
{
const MapInfo *const info = MapDB::getMapAtlas(fileName);
@@ -335,6 +338,7 @@ Map *MapReader::readMap(XmlNodePtrConst node, const std::string &path)
info->atlas, *info->files));
}
}
+ BLOCK_END("MapReader::readMap load atlas")
#endif
for_each_xml_child_node(childNode, node)
@@ -460,8 +464,12 @@ Map *MapReader::readMap(XmlNodePtrConst node, const std::string &path)
void MapReader::readProperties(const XmlNodePtrConst node,
Properties *const props)
{
+ BLOCK_START("MapReader::readProperties")
if (!node || !props)
+ {
+ BLOCK_END("MapReader::readProperties")
return;
+ }
for_each_xml_child_node(childNode, node)
{
@@ -475,6 +483,7 @@ void MapReader::readProperties(const XmlNodePtrConst node,
if (!name.empty() && !value.empty())
props->setProperty(name, value);
}
+ BLOCK_END("MapReader::readProperties")
}
inline static void setTile(Map *const map, MapLayer *const layer,
@@ -863,8 +872,12 @@ Tileset *MapReader::readTileset(XmlNodePtr node,
const std::string &path,
Map *const map)
{
+ BLOCK_START("MapReader::readTileset")
if (!map)
+ {
+ BLOCK_END("MapReader::readTileset")
return nullptr;
+ }
const int firstGid = XML::getProperty(node, "firstgid", 0);
const int margin = XML::getProperty(node, "margin", 0);
@@ -884,6 +897,7 @@ Tileset *MapReader::readTileset(XmlNodePtr node,
if (!node)
{
delete doc;
+ BLOCK_END("MapReader::readTileset")
return nullptr;
}
@@ -1029,6 +1043,7 @@ Tileset *MapReader::readTileset(XmlNodePtr node,
if (set)
set->setProperties(props);
+ BLOCK_END("MapReader::readTileset")
return set;
}