Core-side part for recastnav upgrade:

Corrected values, fixed compile, re-extraction of Mmaps it's required again, mmaps will be updated on wiki.
This commit is contained in:
sucofog
2017-11-15 18:55:04 +01:00
committed by GitHub
parent 17802ab6e5
commit c75ec13191
15 changed files with 95 additions and 56 deletions

View File

@@ -213,7 +213,7 @@ namespace Trinity
inline bool IsValidMapCoord(float x, float y, float z)
{
return IsValidMapCoord(x, y) && isfinite(z);
return IsValidMapCoord(x, y) && IsValidMapCoord(z);
}
inline bool IsValidMapCoord(float x, float y, float z, float o)

View File

@@ -2012,7 +2012,7 @@ uint32 Map::GetAreaId(float x, float y, float z, bool *isOutdoors) const
atEntry = sAreaTableStore.LookupEntry(wmoEntry->areaId);
}
uint16 areaId;
uint16 areaId = 0;
if (atEntry)
areaId = atEntry->ID;
@@ -2021,7 +2021,7 @@ uint32 Map::GetAreaId(float x, float y, float z, bool *isOutdoors) const
if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y))
areaId = gmap->getArea(x, y);
// this used while not all *.map files generated (instances)
else
if (!areaId)
areaId = i_mapEntry->linked_zone;
}

View File

@@ -909,7 +909,7 @@ dtStatus PathGenerator::FindSmoothPath(float const* startPos, float const* endPo
// Find movement delta.
float delta[VERTEX_SIZE];
dtVsub(delta, steerPos, iterPos);
float len = dtMathSqrtf(dtVdot(delta,delta));
float len = dtMathSqrtf(dtVdot(delta, delta));
// If the steer target is end of path or off-mesh link, do not move past the location.
if ((endOfPath || offMeshConnection) && len < SMOOTH_PATH_STEP_SIZE)
len = 1.0f;

View File

@@ -55,6 +55,9 @@ void TargetedMovementGeneratorMedium<T,D>::_setTargetLocation(T* owner, bool ini
if (!i_offset)
{
if (i_target->IsWithinDistInMap(owner, CONTACT_DISTANCE))
return;
float allowedRange = MELEE_RANGE;
if ((!initial || (owner->movespline->Finalized() && this->GetMovementGeneratorType() == CHASE_MOTION_TYPE)) && i_target->IsWithinMeleeRange(owner, allowedRange) && i_target->IsWithinLOS(owner->GetPositionX(), owner->GetPositionY(), owner->GetPositionZ()))
return;

View File

@@ -5788,7 +5788,7 @@ SpellCastResult Spell::CheckCast(bool strict)
m_pathFinder = new PathGenerator(m_caster);
m_pathFinder->CalculatePath(pos.m_positionX, pos.m_positionY, pos.m_positionZ+0.15f, false);
G3D::Vector3 endPos = m_pathFinder->GetEndPosition(); // also check distance between target and the point calculated by mmaps
if (m_pathFinder->GetPathType()&PATHFIND_NOPATH || target->GetExactDistSq(endPos.x, endPos.y, endPos.z) > maxdist*maxdist || m_pathFinder->getPathLength() > (40.0f + (m_caster->HasAura(58097) ? 5.0f : 0.0f)))
if (m_pathFinder->GetPathType() & (PATHFIND_NOPATH | PATHFIND_INCOMPLETE) || target->GetExactDistSq(endPos.x, endPos.y, endPos.z) > maxdist*maxdist || m_pathFinder->getPathLength() > (40.0f + (m_caster->HasAura(58097) ? 5.0f : 0.0f)))
return SPELL_FAILED_NOPATH;
}
break;

View File

@@ -75,6 +75,7 @@
#include "WhoListCache.h"
#include "AsyncAuctionListing.h"
#include "SavingSystem.h"
#include <VMapManager2.h>
ACE_Atomic_Op<ACE_Thread_Mutex, bool> World::m_stopEvent = false;
uint8 World::m_ExitCode = SHUTDOWN_EXIT_CODE;
@@ -1276,6 +1277,12 @@ void World::SetInitialWorldSettings()
sLog->outString("Initializing Scripts...");
sScriptMgr->Initialize();
///- Initialize VMapManager function pointers (to untangle game/collision circular deps)
if (VMAP::VMapManager2* vmmgr2 = dynamic_cast<VMAP::VMapManager2*>(VMAP::VMapFactory::createOrGetVMapManager()))
{
vmmgr2->GetLiquidFlagsPtr = &GetLiquidFlags;
}
///- Initialize config settings
LoadConfigSettings();