Jump to content

[Patch]Prevent Disappear Fly NPC


Recommended Posts

Posted

Prevent fall NPC to far depth when getHeight( ) function can`t process valid height

diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
index 0c6da8e..08ecfb8 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -1416,10 +1416,11 @@ bool Creature::FallGround()
    // use larger distance for vmap height search than in most other cases
    float tz = GetMap()->GetHeight(GetPositionX(), GetPositionY(), GetPositionZ(), true, MAX_FALL_DISTANCE);

-    if (tz < INVALID_HEIGHT)
+    if (tz <= INVALID_HEIGHT)
    {
        DEBUG_LOG("FallGround: creature %u at map %u (x: %f, y: %f, z: %f), not able to retrive a proper GetHeight (z: %f).",
            GetEntry(), GetMap()->GetId(), GetPositionX(), GetPositionX(), GetPositionZ(), tz);
+        return false;
    }

    // Abort too if the ground is very near

  • 1 year later...
Posted

This don't must be case o.O

Someone break expected height check in matser also :((

INVALID_HEIGHT must be by original design used _only_ for checks. in past exist special greter by abs() value mark real invalid height...

Look at still exist vmap mirror:

    #define VMAP_INVALID_HEIGHT       -100000.0f            // for check
   #define VMAP_INVALID_HEIGHT_VALUE -200000.0f            // real assigned value in unknown height case

Posted

hm...grep'ing gives:

GridMap.cpp:47: m_gridHeight = INVALID_HEIGHT;

GridMap.cpp:58: m_liquidLevel = INVALID_HEIGHT;

GridMap.cpp:481: return INVALID_HEIGHT;

GridMap.cpp:484: return INVALID_HEIGHT;

Is this expected?

Posted

Maybe not expected, but using that value still works.

Checks are done in such a way that INVALID_HEIGHT is invalid height ;)

(except for that one case in Creature::FallGround() above)

Should maybe create IsValidHeight helper function

  • 1 month later...
×
×
  • 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