diff options
author | Todd Stinson <stinson@lindenlab.com> | 2012-06-28 15:37:55 -0700 |
---|---|---|
committer | Todd Stinson <stinson@lindenlab.com> | 2012-06-28 15:37:55 -0700 |
commit | 685a672b74550ca0dbf8a816257c84c9c44fd34d (patch) | |
tree | 32111fe89d793ce9720940e7cd99afb52f660400 /indra/newview/llpathfindingmanager.cpp | |
parent | df40282058b35e752ab9d7c60379c4e77b74410f (diff) |
Cleaning up new files in preparation for merge into viewer-release.
Diffstat (limited to 'indra/newview/llpathfindingmanager.cpp')
-rw-r--r-- | indra/newview/llpathfindingmanager.cpp | 47 |
1 files changed, 28 insertions, 19 deletions
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 <string> #include <map> +#include <boost/bind.hpp> #include <boost/function.hpp> +#include <boost/shared_ptr.hpp> #include <boost/signals2.hpp> #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); } - |