refactor: extract markPlayerDead to deduplicate death/corpse caching

Both the health==0 and dynFlags UNIT_DYNFLAG_DEAD paths duplicated the
same corpse-position caching and death-state logic with a subtle
asymmetry (only health path called stopAutoAttack). Extracted into
markPlayerDead() so coordinate swapping and state changes happen in one
place. stopAutoAttack remains at the health==0 call site since the
dynFlags path doesn't need it.
This commit is contained in:
Kelsi 2026-03-29 17:59:44 -07:00
parent dc500fede9
commit 298974ebc2
2 changed files with 23 additions and 21 deletions

View file

@ -169,6 +169,9 @@ private:
void detectPlayerMountChange(uint32_t newMountDisplayId,
const std::map<uint16_t, uint32_t>& blockFields);
// Shared player-death handler: caches corpse position, sets death state.
void markPlayerDead(const char* source);
// --- Phase 4: Field index cache structs ---
// Cached field indices resolved once per handler call to avoid repeated lookups.
struct UnitFieldIndices {