Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts: sql/old/3.3.5a/TDB52_to_TDB53_updates/world/2013_07_24_00_world_spell_script_names.sql sql/updates/world/2013_07_24_00_world_spell_script_names.sql sql/updates/world/2013_07_24_00_world_spell_script_names_335.sql src/server/game/Achievements/AchievementMgr.cpp src/server/game/Achievements/AchievementMgr.h src/server/game/Battlegrounds/ArenaTeamMgr.cpp src/server/game/Chat/ChatLink.cpp src/server/game/DataStores/DBCStores.cpp src/server/game/DataStores/DBCStructure.h src/server/game/DataStores/DBCfmt.h src/server/game/Entities/DynamicObject/DynamicObject.h src/server/game/Entities/Object/Object.cpp src/server/game/Entities/Player/Player.cpp src/server/game/Entities/Unit/StatSystem.cpp src/server/game/Entities/Unit/Unit.cpp src/server/game/Entities/Unit/Unit.h src/server/game/Groups/Group.cpp src/server/game/Handlers/QuestHandler.cpp src/server/game/Miscellaneous/SharedDefines.h src/server/game/Spells/Auras/SpellAuraEffects.cpp src/server/game/Spells/Auras/SpellAuras.cpp src/server/game/World/World.h src/server/scripts/Commands/cs_character.cpp src/server/scripts/Commands/cs_lookup.cpp src/server/scripts/Commands/cs_titles.cpp src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp src/server/scripts/EasternKingdoms/ZulAman/boss_zuljin.cpp src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp src/server/scripts/Kalimdor/zone_darkshore.cpp src/server/scripts/Kalimdor/zone_mulgore.cpp src/server/scripts/Kalimdor/zone_tanaris.cpp src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp src/server/scripts/Spells/spell_dk.cpp src/server/scripts/Spells/spell_mage.cpp src/server/scripts/Spells/spell_rogue.cpp src/server/shared/Database/Implementation/CharacterDatabase.cpp src/server/shared/Database/Implementation/CharacterDatabase.h src/tools/vmap4_extractor/mpq_libmpq04.h
This commit is contained in:
commit
e4b14b943d
1018 files changed
+106417
-3858
No files matched your search
@@ -30,7 +30,7 @@
|
||||
////////////////// PathGenerator //////////////////
|
||||
PathGenerator::PathGenerator(const Unit* owner) :
|
||||
_polyLength(0), _type(PATHFIND_BLANK), _useStraightPath(false),
|
||||
_forceDestination(false), _pointPathLimit(MAX_POINT_PATH_LENGTH),
|
||||
_forceDestination(false), _pointPathLimit(MAX_POINT_PATH_LENGTH), _straightLine(false),
|
||||
_endPosition(G3D::Vector3::zero()), _sourceUnit(owner), _navMesh(NULL),
|
||||
_navMeshQuery(NULL)
|
||||
{
|
||||
@@ -54,7 +54,7 @@ PathGenerator::~PathGenerator()
|
||||
TC_LOG_DEBUG("maps", "++ PathGenerator::~PathGenerator() for %u \n", _sourceUnit->GetGUIDLow());
|
||||
}
|
||||
|
||||
bool PathGenerator::CalculatePath(float destX, float destY, float destZ, bool forceDest)
|
||||
bool PathGenerator::CalculatePath(float destX, float destY, float destZ, bool forceDest, bool straightLine)
|
||||
{
|
||||
float x, y, z;
|
||||
_sourceUnit->GetPosition(x, y, z);
|
||||
@@ -69,6 +69,7 @@ bool PathGenerator::CalculatePath(float destX, float destY, float destZ, bool fo
|
||||
SetStartPosition(start);
|
||||
|
||||
_forceDestination = forceDest;
|
||||
_straightLine = straightLine;
|
||||
|
||||
TC_LOG_DEBUG("maps", "++ PathGenerator::CalculatePath() for %u \n", _sourceUnit->GetGUIDLow());
|
||||
|
||||
@@ -100,7 +101,7 @@ dtPolyRef PathGenerator::GetPathPolyByPosition(dtPolyRef const* polyPath, uint32
|
||||
for (uint32 i = 0; i < polyPathSize; ++i)
|
||||
{
|
||||
float closestPoint[VERTEX_SIZE];
|
||||
if (dtStatusFailed(_navMeshQuery->closestPointOnPoly(polyPath[i], point, closestPoint)))
|
||||
if (dtStatusFailed(_navMeshQuery->closestPointOnPoly(polyPath[i], point, closestPoint, NULL)))
|
||||
continue;
|
||||
|
||||
float d = dtVdist2DSqr(point, closestPoint);
|
||||
@@ -231,7 +232,7 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con
|
||||
{
|
||||
float closestPoint[VERTEX_SIZE];
|
||||
// we may want to use closestPointOnPolyBoundary instead
|
||||
if (dtStatusSucceed(_navMeshQuery->closestPointOnPoly(endPoly, endPoint, closestPoint)))
|
||||
if (dtStatusSucceed(_navMeshQuery->closestPointOnPoly(endPoly, endPoint, closestPoint, NULL)))
|
||||
{
|
||||
dtVcopy(endPoint, closestPoint);
|
||||
SetActualEndPosition(G3D::Vector3(endPoint[2], endPoint[0], endPoint[1]));
|
||||
@@ -270,8 +271,16 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con
|
||||
{
|
||||
for (; pathStartIndex < _polyLength; ++pathStartIndex)
|
||||
{
|
||||
// here to carch few bugs
|
||||
ASSERT(_pathPolyRefs[pathStartIndex] != INVALID_POLYREF);
|
||||
// here to catch few bugs
|
||||
if (_pathPolyRefs[pathStartIndex] == INVALID_POLYREF)
|
||||
{
|
||||
TC_LOG_ERROR("maps", "Invalid poly ref in BuildPolyPath. _polyLength: %u, pathStartIndex: %u,"
|
||||
" startPos: %s, endPos: %s, mapid: %u",
|
||||
_polyLength, pathStartIndex, startPos.toString().c_str(), endPos.toString().c_str(),
|
||||
_sourceUnit->GetMapId());
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (_pathPolyRefs[pathStartIndex] == startPoly)
|
||||
{
|
||||
@@ -322,13 +331,13 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con
|
||||
|
||||
// we need any point on our suffix start poly to generate poly-path, so we need last poly in prefix data
|
||||
float suffixEndPoint[VERTEX_SIZE];
|
||||
if (dtStatusFailed(_navMeshQuery->closestPointOnPoly(suffixStartPoly, endPoint, suffixEndPoint)))
|
||||
if (dtStatusFailed(_navMeshQuery->closestPointOnPoly(suffixStartPoly, endPoint, suffixEndPoint, NULL)))
|
||||
{
|
||||
// we can hit offmesh connection as last poly - closestPointOnPoly() don't like that
|
||||
// try to recover by using prev polyref
|
||||
--prefixPolyLength;
|
||||
suffixStartPoly = _pathPolyRefs[prefixPolyLength-1];
|
||||
if (dtStatusFailed(_navMeshQuery->closestPointOnPoly(suffixStartPoly, endPoint, suffixEndPoint)))
|
||||
if (dtStatusFailed(_navMeshQuery->closestPointOnPoly(suffixStartPoly, endPoint, suffixEndPoint, NULL)))
|
||||
{
|
||||
// suffixStartPoly is still invalid, error state
|
||||
BuildShortcut();
|
||||
@@ -339,15 +348,45 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con
|
||||
|
||||
// generate suffix
|
||||
uint32 suffixPolyLength = 0;
|
||||
dtStatus dtResult = _navMeshQuery->findPath(
|
||||
suffixStartPoly, // start polygon
|
||||
endPoly, // end polygon
|
||||
suffixEndPoint, // start position
|
||||
endPoint, // end position
|
||||
&_filter, // polygon search filter
|
||||
_pathPolyRefs + prefixPolyLength - 1, // [out] path
|
||||
(int*)&suffixPolyLength,
|
||||
MAX_PATH_LENGTH-prefixPolyLength); // max number of polygons in output path
|
||||
|
||||
dtStatus dtResult;
|
||||
if (_straightLine)
|
||||
{
|
||||
float hit = 0;
|
||||
float hitNormal[3];
|
||||
memset(hitNormal, 0, sizeof(hitNormal));
|
||||
|
||||
dtResult = _navMeshQuery->raycast(
|
||||
suffixStartPoly,
|
||||
suffixEndPoint,
|
||||
endPoint,
|
||||
&_filter,
|
||||
&hit,
|
||||
hitNormal,
|
||||
_pathPolyRefs + prefixPolyLength - 1,
|
||||
(int*)&suffixPolyLength,
|
||||
MAX_PATH_LENGTH - prefixPolyLength);
|
||||
|
||||
// raycast() sets hit to FLT_MAX if there is a ray between start and end
|
||||
if (hit != FLT_MAX)
|
||||
{
|
||||
// the ray hit something, return no path instead of the incomplete one
|
||||
_type = PATHFIND_NOPATH;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dtResult = _navMeshQuery->findPath(
|
||||
suffixStartPoly, // start polygon
|
||||
endPoly, // end polygon
|
||||
suffixEndPoint, // start position
|
||||
endPoint, // end position
|
||||
&_filter, // polygon search filter
|
||||
_pathPolyRefs + prefixPolyLength - 1, // [out] path
|
||||
(int*)&suffixPolyLength,
|
||||
MAX_PATH_LENGTH - prefixPolyLength); // max number of polygons in output path
|
||||
}
|
||||
|
||||
if (!suffixPolyLength || dtStatusFailed(dtResult))
|
||||
{
|
||||
@@ -373,15 +412,44 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con
|
||||
// free and invalidate old path data
|
||||
Clear();
|
||||
|
||||
dtStatus dtResult = _navMeshQuery->findPath(
|
||||
startPoly, // start polygon
|
||||
endPoly, // end polygon
|
||||
startPoint, // start position
|
||||
endPoint, // end position
|
||||
&_filter, // polygon search filter
|
||||
_pathPolyRefs, // [out] path
|
||||
(int*)&_polyLength,
|
||||
MAX_PATH_LENGTH); // max number of polygons in output path
|
||||
dtStatus dtResult;
|
||||
if (_straightLine)
|
||||
{
|
||||
float hit = 0;
|
||||
float hitNormal[3];
|
||||
memset(hitNormal, 0, sizeof(hitNormal));
|
||||
|
||||
dtResult = _navMeshQuery->raycast(
|
||||
startPoly,
|
||||
startPoint,
|
||||
endPoint,
|
||||
&_filter,
|
||||
&hit,
|
||||
hitNormal,
|
||||
_pathPolyRefs,
|
||||
(int*)&_polyLength,
|
||||
MAX_PATH_LENGTH);
|
||||
|
||||
// raycast() sets hit to FLT_MAX if there is a ray between start and end
|
||||
if (hit != FLT_MAX)
|
||||
{
|
||||
// the ray hit something, return no path instead of the incomplete one
|
||||
_type = PATHFIND_NOPATH;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dtResult = _navMeshQuery->findPath(
|
||||
startPoly, // start polygon
|
||||
endPoly, // end polygon
|
||||
startPoint, // start position
|
||||
endPoint, // end position
|
||||
&_filter, // polygon search filter
|
||||
_pathPolyRefs, // [out] path
|
||||
(int*)&_polyLength,
|
||||
MAX_PATH_LENGTH); // max number of polygons in output path
|
||||
}
|
||||
|
||||
if (!_polyLength || dtStatusFailed(dtResult))
|
||||
{
|
||||
@@ -408,7 +476,15 @@ void PathGenerator::BuildPointPath(const float *startPoint, const float *endPoin
|
||||
float pathPoints[MAX_POINT_PATH_LENGTH*VERTEX_SIZE];
|
||||
uint32 pointCount = 0;
|
||||
dtStatus dtResult = DT_FAILURE;
|
||||
if (_useStraightPath)
|
||||
if (_straightLine)
|
||||
{
|
||||
// if the path is a straight line then start and end position are enough
|
||||
dtResult = DT_SUCCESS;
|
||||
pointCount = 2;
|
||||
memcpy(&pathPoints[0], startPoint, sizeof(float)* 3);
|
||||
memcpy(&pathPoints[3], endPoint, sizeof(float)* 3);
|
||||
}
|
||||
else if (_useStraightPath)
|
||||
{
|
||||
dtResult = _navMeshQuery->findStraightPath(
|
||||
startPoint, // start position
|
||||
|
||||
Reference in new issue
Block a user