From a0c626fe411336871505c2c414143ae4b2f73259 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Tue, 6 Mar 2012 18:40:37 -0800 Subject: PATH-205,PATH-304: More work to handle downloading of out-of-date navmeshes. --- indra/newview/llpathfindingmanager.cpp | 39 ++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 16 deletions(-) (limited to 'indra/newview/llpathfindingmanager.cpp') diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index 7fbf9ba62c..8597498a76 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -204,15 +204,15 @@ bool LLPathfindingManager::isAllowViewTerrainProperties() const return (gAgent.isGodlike() || ((region != NULL) && region->canManageEstate())); } -LLPathfindingNavMesh::navmesh_slot_t LLPathfindingManager::registerNavMeshListenerForCurrentRegion(LLPathfindingNavMesh::navmesh_callback_t pNavMeshCallback) +LLPathfindingNavMesh::navmesh_slot_t LLPathfindingManager::registerNavMeshListenerForRegion(LLViewerRegion *pRegion, LLPathfindingNavMesh::navmesh_callback_t pNavMeshCallback) { - LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForCurrentRegion(); + LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pRegion); return navMeshPtr->registerNavMeshListener(pNavMeshCallback); } -void LLPathfindingManager::requestGetNavMeshForCurrentRegion() +void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion) { - LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForCurrentRegion(); + LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pRegion); if (navMeshPtr->hasNavMeshVersion(mNavMeshVersionXXX)) { @@ -220,14 +220,13 @@ void LLPathfindingManager::requestGetNavMeshForCurrentRegion() } else { - LLViewerRegion *region = getCurrentRegion(); - if (region == NULL) + if (pRegion == NULL) { navMeshPtr->handleNavMeshNotEnabled(); } else { - std::string navMeshURL = getRetrieveNavMeshURLForCurrentRegion(); + std::string navMeshURL = getRetrieveNavMeshURLForRegion(pRegion); if (navMeshURL.empty()) { navMeshPtr->handleNavMeshNotEnabled(); @@ -239,7 +238,7 @@ void LLPathfindingManager::requestGetNavMeshForCurrentRegion() LLSD postData; postData["agent_id"] = gAgent.getID(); - postData["region_id"] = region->getRegionID(); + postData["region_id"] = pRegion->getRegionID(); LLHTTPClient::post(navMeshURL, postData, responder); } } @@ -371,14 +370,13 @@ LLPathfindingManager::ELinksetsRequestStatus LLPathfindingManager::requestSetLin return status; } -LLPathfindingNavMeshPtr LLPathfindingManager::getNavMeshForCurrentRegion() +LLPathfindingNavMeshPtr LLPathfindingManager::getNavMeshForRegion(LLViewerRegion *pRegion) { LLUUID regionUUID; - LLViewerRegion *region = getCurrentRegion(); - if (region != NULL) + if (pRegion != NULL) { - regionUUID = region->getRegionID(); + regionUUID = pRegion->getRegionID(); } LLPathfindingNavMeshPtr navMeshPtr; @@ -469,6 +467,11 @@ std::string LLPathfindingManager::getRetrieveNavMeshURLForCurrentRegion() const return getCapabilityURLForCurrentRegion(CAP_SERVICE_RETRIEVE_NAVMESH); } +std::string LLPathfindingManager::getRetrieveNavMeshURLForRegion(LLViewerRegion *pRegion) const +{ + return getCapabilityURLForRegion(pRegion, CAP_SERVICE_RETRIEVE_NAVMESH); +} + std::string LLPathfindingManager::getAgentStateURLForCurrentRegion() const { return getCapabilityURLForCurrentRegion(CAP_SERVICE_AGENT_STATE); @@ -485,19 +488,23 @@ std::string LLPathfindingManager::getTerrainLinksetsURLForCurrentRegion() const } std::string LLPathfindingManager::getCapabilityURLForCurrentRegion(const std::string &pCapabilityName) const +{ + return getCapabilityURLForRegion(getCurrentRegion(), pCapabilityName); +} + +std::string LLPathfindingManager::getCapabilityURLForRegion(LLViewerRegion *pRegion, const std::string &pCapabilityName) const { std::string capabilityURL(""); - LLViewerRegion* region = getCurrentRegion(); - if (region != NULL) + if (pRegion != NULL) { - capabilityURL = region->getCapability(pCapabilityName); + capabilityURL = pRegion->getCapability(pCapabilityName); } if (capabilityURL.empty()) { llwarns << "cannot find capability '" << pCapabilityName << "' for current region '" - << ((region != NULL) ? region->getName() : "") << "'" << llendl; + << ((pRegion != NULL) ? pRegion->getName() : "") << "'" << llendl; } return capabilityURL; -- cgit v1.2.3