void LLPathfindingManager::handleNavMeshStatusUpdate(const LLPathfindingNavMeshStatus &pNavMeshStatus)
{
	LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pNavMeshStatus.getRegionUUID());

	if (!pNavMeshStatus.isValid())
	{
		navMeshPtr->handleNavMeshError();
	}
	else
	{
		navMeshPtr->handleNavMeshNewVersion(pNavMeshStatus);
	}
}
void LLPathfindingNavMesh::handleNavMeshNewVersion(const LLPathfindingNavMeshStatus &pNavMeshStatus)
{
	llassert(mNavMeshStatus.getRegionUUID() == pNavMeshStatus.getRegionUUID());
	if (mNavMeshStatus.getVersion() == pNavMeshStatus.getVersion())
	{
		mNavMeshStatus = pNavMeshStatus;
		sendStatus();
	}
	else
	{
		mNavMeshData.clear();
		mNavMeshStatus = pNavMeshStatus;
		setRequestStatus(kNavMeshRequestNeedsUpdate);
	}
}
void LLPathfindingNavMesh::handleRefresh(const LLPathfindingNavMeshStatus &pNavMeshStatus)
{
	llassert(mNavMeshStatus.getRegionUUID() == pNavMeshStatus.getRegionUUID());
	llassert(mNavMeshStatus.getVersion() == pNavMeshStatus.getVersion());
	mNavMeshStatus = pNavMeshStatus;
	if (mNavMeshRequestStatus == kNavMeshRequestChecking)
	{
		llassert(!mNavMeshData.empty());
		setRequestStatus(kNavMeshRequestCompleted);
	}
	else
	{
		sendStatus();
	}
}
void LLPathfindingNavMeshZone::NavMeshLocation::handleNavMesh(LLPathfindingNavMesh::ENavMeshRequestStatus pNavMeshRequestStatus, const LLPathfindingNavMeshStatus &pNavMeshStatus, const LLSD::Binary &pNavMeshData)
{
	llassert(mRegionUUID == pNavMeshStatus.getRegionUUID());

	if ((pNavMeshRequestStatus == LLPathfindingNavMesh::kNavMeshRequestCompleted) &&
		(!mHasNavMesh || (mNavMeshVersion != pNavMeshStatus.getVersion())))
	{
		llassert(!pNavMeshData.empty());
		mHasNavMesh = true;
		mNavMeshVersion = pNavMeshStatus.getVersion();
		llassert(LLPathingLib::getInstance() != NULL);
		if (LLPathingLib::getInstance() != NULL)
		{
			LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD(pNavMeshData, mDirection);
		}
	}

	mRequestStatus = pNavMeshRequestStatus;
	mNavMeshStatus = pNavMeshStatus.getStatus();
	mLocationCallback();
}
void LLPathfindingManager::handleNavMeshStatusRequest(const LLPathfindingNavMeshStatus &pNavMeshStatus, LLViewerRegion *pRegion, bool pIsGetStatusOnly)
{
	LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pNavMeshStatus.getRegionUUID());

	if (!pNavMeshStatus.isValid())
	{
		navMeshPtr->handleNavMeshError();
	}
	else
	{
		if (navMeshPtr->hasNavMeshVersion(pNavMeshStatus))
		{
			navMeshPtr->handleRefresh(pNavMeshStatus);
		}
		else if (pIsGetStatusOnly)
		{
			navMeshPtr->handleNavMeshNewVersion(pNavMeshStatus);
		}
		else
		{
			sendRequestGetNavMeshForRegion(navMeshPtr, pRegion, pNavMeshStatus);
		}
	}
}
void LLPathfindingNavMesh::handleNavMeshStart(const LLPathfindingNavMeshStatus &pNavMeshStatus)
{
	llassert(mNavMeshStatus.getRegionUUID() == pNavMeshStatus.getRegionUUID());
	mNavMeshStatus = pNavMeshStatus;
	setRequestStatus(kNavMeshRequestStarted);
}