Skip to content

Commit 4aabcc3

Browse files
committed
Core/Player: moved the periodic group update mechanic into heartbeat handling
(cherry-picked from commit 80d72a2)
1 parent 5da26d1 commit 4aabcc3

2 files changed

Lines changed: 10 additions & 12 deletions

File tree

src/server/game/Entities/Player/Player.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,6 @@ Player::Player(WorldSession* session): Unit(true)
332332

333333
m_achievementMgr = new AchievementMgr(this);
334334
m_reputationMgr = new ReputationMgr(this);
335-
336-
m_groupUpdateTimer.Reset(5000);
337335
}
338336

339337
Player::~Player()
@@ -1218,14 +1216,6 @@ void Player::Update(uint32 p_time)
12181216
}
12191217
}
12201218

1221-
// group update
1222-
m_groupUpdateTimer.Update(p_time);
1223-
if (m_groupUpdateTimer.Passed())
1224-
{
1225-
SendUpdateToOutOfRangeGroupMembers();
1226-
m_groupUpdateTimer.Reset(5000);
1227-
}
1228-
12291219
Pet* pet = GetPet();
12301220
if (pet && !pet->IsWithinDistInMap(this, GetMap()->GetVisibilityRange()) && !pet->isPossessed())
12311221
//if (pet && !pet->IsWithinDistInMap(this, GetMap()->GetVisibilityDistance()) && (GetCharmGUID() && (pet->GetGUID() != GetCharmGUID())))
@@ -1247,6 +1237,14 @@ void Player::Update(uint32 p_time)
12471237
TeleportTo(m_teleport_dest, m_teleport_options);
12481238
}
12491239

1240+
void Player::Heartbeat()
1241+
{
1242+
Unit::Heartbeat();
1243+
1244+
// Group update
1245+
SendUpdateToOutOfRangeGroupMembers();
1246+
}
1247+
12501248
void Player::setDeathState(DeathState s)
12511249
{
12521250
uint32 ressSpellId = 0;

src/server/game/Entities/Player/Player.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -957,6 +957,8 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
957957

958958
void Update(uint32 time) override;
959959

960+
void Heartbeat() override;
961+
960962
static bool BuildEnumData(PreparedQueryResult result, WorldPacket* data);
961963

962964
bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, SpellEffectInfo const& spellEffectInfo, WorldObject const* caster, bool requireImmunityPurgesEffectAttribute = false) const override;
@@ -2507,8 +2509,6 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
25072509

25082510
bool m_needsZoneUpdate;
25092511

2510-
TimeTracker m_groupUpdateTimer;
2511-
25122512
private:
25132513
// internal common parts for CanStore/StoreItem functions
25142514
InventoryResult CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec& dest, ItemTemplate const* pProto, uint32& count, bool swap, Item* pSrcItem) const;

0 commit comments

Comments
 (0)