mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 10:31:29 +00:00
[Performance] Re-use OP_PlayerStateAdd packet memory (#4626)
This commit is contained in:
parent
f939f25aa1
commit
bdcded7d45
26
zone/mob.cpp
26
zone/mob.cpp
@ -7710,28 +7710,26 @@ bool Mob::CanRaceEquipItem(uint32 item_id)
|
|||||||
|
|
||||||
void Mob::SendAddPlayerState(PlayerState new_state)
|
void Mob::SendAddPlayerState(PlayerState new_state)
|
||||||
{
|
{
|
||||||
auto app = new EQApplicationPacket(OP_PlayerStateAdd, sizeof(PlayerState_Struct));
|
static EQApplicationPacket p(OP_PlayerStateAdd, sizeof(PlayerState_Struct));
|
||||||
auto ps = (PlayerState_Struct *)app->pBuffer;
|
auto b = (PlayerState_Struct *) p.pBuffer;
|
||||||
|
|
||||||
ps->spawn_id = GetID();
|
b->spawn_id = GetID();
|
||||||
ps->state = static_cast<uint32>(new_state);
|
b->state = static_cast<uint32>(new_state);
|
||||||
|
|
||||||
AddPlayerState(ps->state);
|
AddPlayerState(b->state);
|
||||||
entity_list.QueueClients(nullptr, app);
|
entity_list.QueueClients(nullptr, &p);
|
||||||
safe_delete(app);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mob::SendRemovePlayerState(PlayerState old_state)
|
void Mob::SendRemovePlayerState(PlayerState old_state)
|
||||||
{
|
{
|
||||||
auto app = new EQApplicationPacket(OP_PlayerStateRemove, sizeof(PlayerState_Struct));
|
static EQApplicationPacket p(OP_PlayerStateRemove, sizeof(PlayerState_Struct));
|
||||||
auto ps = (PlayerState_Struct *)app->pBuffer;
|
auto b = (PlayerState_Struct *) p.pBuffer;
|
||||||
|
|
||||||
ps->spawn_id = GetID();
|
b->spawn_id = GetID();
|
||||||
ps->state = static_cast<uint32>(old_state);
|
b->state = static_cast<uint32>(old_state);
|
||||||
|
|
||||||
RemovePlayerState(ps->state);
|
RemovePlayerState(b->state);
|
||||||
entity_list.QueueClients(nullptr, app);
|
entity_list.QueueClients(nullptr, &p);
|
||||||
safe_delete(app);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 Mob::GetMeleeMitigation() {
|
int32 Mob::GetMeleeMitigation() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user