From 8761ad9301a3715fecd7abf61fe95097f00bc894 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Fri, 20 Mar 2026 17:19:18 -0700 Subject: [PATCH] fix: clean up combat text, cast bars, and aura cache on entity destroy When SMSG_DESTROY_OBJECT removes an entity, now also purge combat text entries targeting that GUID (prevents floating damage numbers on despawned mobs), erase unit cast state (prevents stale cast bars), and clear cached auras (prevents stale buff/debuff data for destroyed units). --- src/game/game_handler.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index eb6208fb..0d1253d4 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -13018,8 +13018,21 @@ void GameHandler::handleDestroyObject(network::Packet& packet) { // Clean up quest giver status npcQuestStatus_.erase(data.guid); + // Remove combat text entries referencing the destroyed entity so floating + // damage numbers don't linger after the source/target despawns. + combatText.erase( + std::remove_if(combatText.begin(), combatText.end(), + [&data](const CombatTextEntry& e) { + return e.dstGuid == data.guid; + }), + combatText.end()); + + // Clean up unit cast state (cast bar) for the destroyed unit + unitCastStates_.erase(data.guid); + // Clean up cached auras + unitAurasCache_.erase(data.guid); + tabCycleStale = true; - // Entity count logging disabled } void GameHandler::sendChatMessage(ChatType type, const std::string& message, const std::string& target) {