fix: correct corpse retrieval coordinate mismatch and detect corpse objects

- canReclaimCorpse() and getCorpseDistance() compared canonical movementInfo
  (x=north=server_y, y=west=server_x) against raw server corpseX_/Y_ causing
  the proximity check to always report wrong distance even when standing on corpse
- Fix: use corpseY_ for canonical north and corpseX_ for canonical west
- Also detect OBJECT_TYPE_CORPSE update blocks owned by the player to set
  corpse coordinates at login-as-ghost (before SMSG_DEATH_RELEASE_LOC arrives)
This commit is contained in:
Kelsi 2026-03-13 00:59:43 -07:00
parent acf99354b3
commit 022d387d95
2 changed files with 30 additions and 5 deletions

View file

@ -1106,8 +1106,10 @@ public:
/** Distance (yards) from ghost to corpse, or -1 if no corpse data. */
float getCorpseDistance() const {
if (corpseMapId_ == 0 || currentMapId_ != corpseMapId_) return -1.0f;
float dx = movementInfo.x - corpseX_;
float dy = movementInfo.y - corpseY_;
// movementInfo is canonical (x=north=server_y, y=west=server_x);
// corpse coords are raw server (x=west, y=north) — swap to compare.
float dx = movementInfo.x - corpseY_;
float dy = movementInfo.y - corpseX_;
float dz = movementInfo.z - corpseZ_;
return std::sqrt(dx*dx + dy*dy + dz*dz);
}