summaryrefslogtreecommitdiff
path: root/src/net/ea
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-06-22 20:58:13 +0300
committerAndrei Karas <akaras@inbox.ru>2014-06-22 20:58:13 +0300
commit8ad99cc3f4dd98f0b73a2ece9323f01099a81e80 (patch)
tree33115940e6efabec34efb71e0be6b6d7dfd7e4df /src/net/ea
parent04f47f060f94ec0e2dfc3cccf62cff167e0ecd68 (diff)
downloadplus-8ad99cc3f4dd98f0b73a2ece9323f01099a81e80.tar.gz
plus-8ad99cc3f4dd98f0b73a2ece9323f01099a81e80.tar.bz2
plus-8ad99cc3f4dd98f0b73a2ece9323f01099a81e80.tar.xz
plus-8ad99cc3f4dd98f0b73a2ece9323f01099a81e80.zip
Add profiler lines into some functions.
Diffstat (limited to 'src/net/ea')
-rw-r--r--src/net/ea/beinghandler.cpp114
-rw-r--r--src/net/ea/inventoryhandler.cpp32
2 files changed, 145 insertions, 1 deletions
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()