Jump to content

[fix][8489] UpdateVisibilityForPlayer

Guest SilverIce

Recommended Posts

What bug does the patch fix?

This patch fixes incorrect cell calculation: since player has viewPoint we need compute cells using that point.

Who has been writing this patch? Me

diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp
index 79b9d9c..268e07c 100644
--- a/src/game/ObjectAccessor.cpp
+++ b/src/game/ObjectAccessor.cpp
@@ -451,7 +451,8 @@ ObjectAccessor::UpdateObjectVisibility(WorldObject *obj)

void ObjectAccessor::UpdateVisibilityForPlayer( Player* player )
-    CellPair p = MaNGOS::ComputeCellPair(player->GetPositionX(), player->GetPositionY());
+    WorldObject* viewPoint = player->GetViewPoint();
+    CellPair p(MaNGOS::ComputeCellPair(viwPoint->GetPositionX(), viwPoint->GetPositionY()));
    Cell cell(p);
    Map* m = player->GetMap();

Link to comment
Share on other sites

That why it compared.

UpdateObjectsVisibilityFor expected to be call for view points and your fix targeted correctly to fix this case.

It include also update update players visibility around view point.


UpdatePlayerVisibility update visibility of player itself and expected to be in player position without deopendencr is viewPoint same to player or not.

So we have 2 cases for UpdateObjectsVisibilityFor (1) player = viewPoint and we can use same cell coordinates as for player already used.

(2) need initilize new cell coordinates for viewPoint (!= player). If-check just avoud like second point creating.

Link to comment
Share on other sites


  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use