From 685a672b74550ca0dbf8a816257c84c9c44fd34d Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Thu, 28 Jun 2012 15:37:55 -0700 Subject: Cleaning up new files in preparation for merge into viewer-release. --- indra/newview/llpathfindingmanager.cpp | 47 ++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 19 deletions(-) (limited to 'indra/newview/llpathfindingmanager.cpp') diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index 90199a9cae..2dd01e931e 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -33,7 +33,9 @@ #include #include +#include #include +#include #include #include "llagent.h" @@ -53,7 +55,6 @@ #include "lluuid.h" #include "llviewerregion.h" #include "llweb.h" -#include "llenvmanager.h" #define CAP_SERVICE_RETRIEVE_NAVMESH "RetrieveNavMeshSrc" @@ -366,12 +367,6 @@ void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion, b } } -LLPathfindingManager::agent_state_slot_t LLPathfindingManager::registerAgentStateListener(agent_state_callback_t pAgentStateCallback) -{ - return mAgentStateSignal.connect(pAgentStateCallback); -} - - void LLPathfindingManager::requestGetLinksets(request_id_t pRequestId, object_request_callback_t pLinksetsCallback) const { LLPathfindingObjectListPtr emptyLinksetListPtr; @@ -495,6 +490,11 @@ void LLPathfindingManager::requestGetCharacters(request_id_t pRequestId, object_ } } +LLPathfindingManager::agent_state_slot_t LLPathfindingManager::registerAgentStateListener(agent_state_callback_t pAgentStateCallback) +{ + return mAgentStateSignal.connect(pAgentStateCallback); +} + void LLPathfindingManager::requestGetAgentState() { LLViewerRegion *currentRegion = getCurrentRegion(); @@ -525,14 +525,24 @@ void LLPathfindingManager::requestGetAgentState() void LLPathfindingManager::requestRebakeNavMesh(rebake_navmesh_callback_t pRebakeNavMeshCallback) { - std::string navMeshStatusURL = getNavMeshStatusURLForCurrentRegion(); - llassert(!navMeshStatusURL.empty()) - if (!navMeshStatusURL.empty()) + LLViewerRegion *currentRegion = getCurrentRegion(); + + if (currentRegion == NULL) + { + pRebakeNavMeshCallback(false); + } + else if (!isPathfindingEnabledForRegion(currentRegion)) { - LLSD mPostData; - mPostData["command"] = "rebuild"; + pRebakeNavMeshCallback(false); + } + else + { + std::string navMeshStatusURL = getNavMeshStatusURLForCurrentRegion(); + llassert(!navMeshStatusURL.empty()); + LLSD postData; + postData["command"] = "rebuild"; LLHTTPClient::ResponderPtr responder = new NavMeshRebakeResponder(navMeshStatusURL, pRebakeNavMeshCallback); - LLHTTPClient::post(navMeshStatusURL, mPostData, responder); + LLHTTPClient::post(navMeshStatusURL, postData, responder); } } @@ -673,11 +683,6 @@ LLPathfindingNavMeshPtr LLPathfindingManager::getNavMeshForRegion(LLViewerRegion return getNavMeshForRegion(regionUUID); } -std::string LLPathfindingManager::getAgentStateURLForRegion(LLViewerRegion *pRegion) const -{ - return getCapabilityURLForRegion(pRegion, CAP_SERVICE_AGENT_STATE); -} - std::string LLPathfindingManager::getNavMeshStatusURLForCurrentRegion() const { return getNavMeshStatusURLForRegion(getCurrentRegion()); @@ -708,6 +713,11 @@ std::string LLPathfindingManager::getCharactersURLForCurrentRegion() const return getCapabilityURLForCurrentRegion(CAP_SERVICE_CHARACTERS); } +std::string LLPathfindingManager::getAgentStateURLForRegion(LLViewerRegion *pRegion) const +{ + return getCapabilityURLForRegion(pRegion, CAP_SERVICE_AGENT_STATE); +} + std::string LLPathfindingManager::getCapabilityURLForCurrentRegion(const std::string &pCapabilityName) const { return getCapabilityURLForRegion(getCurrentRegion(), pCapabilityName); @@ -1037,4 +1047,3 @@ void CharactersResponder::error(U32 pStatus, const std::string &pReason) LLPathfindingObjectListPtr characterListPtr = LLPathfindingObjectListPtr(new LLPathfindingCharacterList()); mCharactersCallback(mRequestId, LLPathfindingManager::kRequestError, characterListPtr); } - -- cgit v1.2.3