summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/Grids/GridDefines.h2
-rw-r--r--src/game/Maps/Map.cpp4
-rw-r--r--src/game/Movement/MovementGenerators/PathGenerator.cpp2
-rw-r--r--src/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp3
-rw-r--r--src/game/Spells/Spell.cpp2
-rw-r--r--src/game/World/World.cpp7
6 files changed, 15 insertions, 5 deletions
diff --git a/src/game/Grids/GridDefines.h b/src/game/Grids/GridDefines.h
index d6b4a36ca1..5554a731e4 100644
--- a/src/game/Grids/GridDefines.h
+++ b/src/game/Grids/GridDefines.h
@@ -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)
diff --git a/src/game/Maps/Map.cpp b/src/game/Maps/Map.cpp
index a18ebf84ef..4e6a595a55 100644
--- a/src/game/Maps/Map.cpp
+++ b/src/game/Maps/Map.cpp
@@ -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;
}
diff --git a/src/game/Movement/MovementGenerators/PathGenerator.cpp b/src/game/Movement/MovementGenerators/PathGenerator.cpp
index f5e9210b0c..0a55b66d23 100644
--- a/src/game/Movement/MovementGenerators/PathGenerator.cpp
+++ b/src/game/Movement/MovementGenerators/PathGenerator.cpp
@@ -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;
diff --git a/src/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp b/src/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp
index 52323722f2..97ffaa4437 100644
--- a/src/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp
+++ b/src/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp
@@ -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;
diff --git a/src/game/Spells/Spell.cpp b/src/game/Spells/Spell.cpp
index d44e0556fc..fda0183b97 100644
--- a/src/game/Spells/Spell.cpp
+++ b/src/game/Spells/Spell.cpp
@@ -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;
diff --git a/src/game/World/World.cpp b/src/game/World/World.cpp
index 32da6e7475..63150afb1d 100644
--- a/src/game/World/World.cpp
+++ b/src/game/World/World.cpp
@@ -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();