summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llpathfindingmanager.cpp118
-rw-r--r--indra/newview/llpathfindingmanager.h22
-rw-r--r--indra/newview/llpathfindingnavmeshzone.cpp2
3 files changed, 106 insertions, 36 deletions
diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp
index a77d6bcc4c..674a96a439 100644
--- a/indra/newview/llpathfindingmanager.cpp
+++ b/indra/newview/llpathfindingmanager.cpp
@@ -102,7 +102,7 @@ LLHTTPRegistration<LLAgentStateChangeNode> gHTTPRegistrationAgentStateChangeNode
class NavMeshStatusResponder : public LLHTTPClient::Responder
{
public:
- NavMeshStatusResponder(const std::string &pCapabilityURL, LLViewerRegion *pRegion);
+ NavMeshStatusResponder(const std::string &pCapabilityURL, LLViewerRegion *pRegion, bool pIsGetStatusOnly);
virtual ~NavMeshStatusResponder();
virtual void result(const LLSD &pContent);
@@ -114,6 +114,7 @@ private:
std::string mCapabilityURL;
LLViewerRegion *mRegion;
LLUUID mRegionUUID;
+ bool mIsGetStatusOnly;
};
//---------------------------------------------------------------------------
@@ -282,23 +283,30 @@ private:
LLPathfindingManager::LLPathfindingManager()
: LLSingleton<LLPathfindingManager>(),
mNavMeshMap(),
- mShowNavMeshRebake(false),
- mCrossingSlot()
+ mCrossingSlot(),
+ mAgentStateSignal(),
+ mNavMeshSlot()
{
-
}
void LLPathfindingManager::onRegionBoundaryCrossed()
{
+ if (mNavMeshSlot.connected())
+ {
+ mNavMeshSlot.disconnect();
+ }
+ LLViewerRegion *currentRegion = getCurrentRegion();
+ if (currentRegion != NULL)
+ {
+ mNavMeshSlot = registerNavMeshListenerForRegion(currentRegion, boost::bind(&LLPathfindingManager::handleNavMeshStatus, this, _1, _2));
+ requestGetNavMeshForRegion(currentRegion, true);
+ }
displayNavMeshRebakePanel();
}
LLPathfindingManager::~LLPathfindingManager()
{
- if (mCrossingSlot.connected())
- {
- mCrossingSlot.disconnect();
- }
+ quitSystem();
}
void LLPathfindingManager::initSystem()
@@ -307,6 +315,40 @@ void LLPathfindingManager::initSystem()
{
LLPathingLib::initSystem();
}
+
+ if ( !mCrossingSlot.connected() )
+ {
+ mCrossingSlot = LLEnvManagerNew::getInstance()->setRegionChangeCallback(boost::bind(&LLPathfindingManager::onRegionBoundaryCrossed, this));
+ }
+
+ if (mNavMeshSlot.connected())
+ {
+ mNavMeshSlot.disconnect();
+ }
+ LLViewerRegion *currentRegion = getCurrentRegion();
+ if (currentRegion != NULL)
+ {
+ mNavMeshSlot = registerNavMeshListenerForRegion(currentRegion, boost::bind(&LLPathfindingManager::handleNavMeshStatus, this, _1, _2));
+ requestGetNavMeshForRegion(currentRegion, true);
+ }
+}
+
+void LLPathfindingManager::quitSystem()
+{
+ if (mNavMeshSlot.connected())
+ {
+ mNavMeshSlot.disconnect();
+ }
+
+ if (mCrossingSlot.connected())
+ {
+ mCrossingSlot.disconnect();
+ }
+
+ if (LLPathingLib::getInstance() != NULL)
+ {
+ LLPathingLib::quitSystem();
+ }
}
bool LLPathfindingManager::isPathfindingEnabledForCurrentRegion() const
@@ -337,7 +379,7 @@ LLPathfindingNavMesh::navmesh_slot_t LLPathfindingManager::registerNavMeshListen
return navMeshPtr->registerNavMeshListener(pNavMeshCallback);
}
-void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion)
+void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion, bool pIsGetStatusOnly)
{
LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pRegion);
@@ -348,7 +390,7 @@ void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion)
else if (!pRegion->capabilitiesReceived())
{
navMeshPtr->handleNavMeshWaitForRegionLoad();
- pRegion->setCapabilitiesReceivedCallback(boost::bind(&LLPathfindingManager::handleDeferredGetNavMeshForRegion, this, _1));
+ pRegion->setCapabilitiesReceivedCallback(boost::bind(&LLPathfindingManager::handleDeferredGetNavMeshForRegion, this, _1, pIsGetStatusOnly));
}
else if (!isPathfindingEnabledForRegion(pRegion))
{
@@ -359,7 +401,7 @@ void LLPathfindingManager::requestGetNavMeshForRegion(LLViewerRegion *pRegion)
std::string navMeshStatusURL = getNavMeshStatusURLForRegion(pRegion);
llassert(!navMeshStatusURL.empty());
navMeshPtr->handleNavMeshCheckVersion();
- LLHTTPClient::ResponderPtr navMeshStatusResponder = new NavMeshStatusResponder(navMeshStatusURL, pRegion);
+ LLHTTPClient::ResponderPtr navMeshStatusResponder = new NavMeshStatusResponder(navMeshStatusURL, pRegion, pIsGetStatusOnly);
LLHTTPClient::get(navMeshStatusURL, navMeshStatusResponder);
}
}
@@ -518,13 +560,13 @@ void LLPathfindingManager::sendRequestGetNavMeshForRegion(LLPathfindingNavMeshPt
}
}
-void LLPathfindingManager::handleDeferredGetNavMeshForRegion(const LLUUID &pRegionUUID)
+void LLPathfindingManager::handleDeferredGetNavMeshForRegion(const LLUUID &pRegionUUID, bool pIsGetStatusOnly)
{
LLViewerRegion *currentRegion = getCurrentRegion();
if ((currentRegion != NULL) && (currentRegion->getRegionID() == pRegionUUID))
{
- requestGetNavMeshForRegion(currentRegion);
+ requestGetNavMeshForRegion(currentRegion, pIsGetStatusOnly);
}
}
@@ -548,7 +590,7 @@ void LLPathfindingManager::handleDeferredGetCharactersForRegion(const LLUUID &pR
}
}
-void LLPathfindingManager::handleNavMeshStatusRequest(const LLPathfindingNavMeshStatus &pNavMeshStatus, LLViewerRegion *pRegion)
+void LLPathfindingManager::handleNavMeshStatusRequest(const LLPathfindingNavMeshStatus &pNavMeshStatus, LLViewerRegion *pRegion, bool pIsGetStatusOnly)
{
LLPathfindingNavMeshPtr navMeshPtr = getNavMeshForRegion(pNavMeshStatus.getRegionUUID());
@@ -562,6 +604,10 @@ void LLPathfindingManager::handleNavMeshStatusRequest(const LLPathfindingNavMesh
{
navMeshPtr->handleRefresh(pNavMeshStatus);
}
+ else if (pIsGetStatusOnly)
+ {
+ navMeshPtr->handleNavMeshNewVersion(pNavMeshStatus);
+ }
else
{
sendRequestGetNavMeshForRegion(navMeshPtr, pRegion, pNavMeshStatus);
@@ -613,11 +659,6 @@ LLPathfindingNavMeshPtr LLPathfindingManager::getNavMeshForRegion(LLViewerRegion
void LLPathfindingManager::requestGetAgentState()
{
- if ( !mCrossingSlot.connected() )
- {
- mCrossingSlot = LLEnvManagerNew::getInstance()->setRegionChangeCallback(boost::bind(&LLPathfindingManager::onRegionBoundaryCrossed, this));
- }
-
std::string agentStateURL = getAgentStateURLForCurrentRegion( getCurrentRegion() );
if ( !agentStateURL.empty() )
@@ -696,6 +737,36 @@ LLViewerRegion *LLPathfindingManager::getCurrentRegion() const
return gAgent.getRegion();
}
+void LLPathfindingManager::handleNavMeshStatus(LLPathfindingNavMesh::ENavMeshRequestStatus pRequestStatus, const LLPathfindingNavMeshStatus &pNavMeshStatus)
+{
+ if (!pNavMeshStatus.isValid())
+ {
+ llinfos << "STINSON DEBUG: navmesh status is invalid" << llendl;
+ }
+ else
+ {
+ switch (pNavMeshStatus.getStatus())
+ {
+ case LLPathfindingNavMeshStatus::kPending :
+ llinfos << "STINSON DEBUG: navmesh status is kPending" << llendl;
+ break;
+ case LLPathfindingNavMeshStatus::kBuilding :
+ llinfos << "STINSON DEBUG: navmesh status is kBuilding" << llendl;
+ break;
+ case LLPathfindingNavMeshStatus::kComplete :
+ llinfos << "STINSON DEBUG: navmesh status is kComplete" << llendl;
+ break;
+ case LLPathfindingNavMeshStatus::kRepending :
+ llinfos << "STINSON DEBUG: navmesh status is kRepending" << llendl;
+ break;
+ default :
+ llinfos << "STINSON DEBUG: navmesh status is default" << llendl;
+ llassert(0);
+ break;
+ }
+ }
+}
+
void LLPathfindingManager::displayNavMeshRebakePanel()
{
LLView* rootp = LLUI::getRootView();
@@ -771,11 +842,12 @@ void LLPathfindingManager::handleAgentStateUpdate()
// NavMeshStatusResponder
//---------------------------------------------------------------------------
-NavMeshStatusResponder::NavMeshStatusResponder(const std::string &pCapabilityURL, LLViewerRegion *pRegion)
+NavMeshStatusResponder::NavMeshStatusResponder(const std::string &pCapabilityURL, LLViewerRegion *pRegion, bool pIsGetStatusOnly)
: LLHTTPClient::Responder(),
mCapabilityURL(pCapabilityURL),
mRegion(pRegion),
- mRegionUUID()
+ mRegionUUID(),
+ mIsGetStatusOnly(pIsGetStatusOnly)
{
if (mRegion != NULL)
{
@@ -793,14 +865,14 @@ void NavMeshStatusResponder::result(const LLSD &pContent)
llinfos << "STINSON DEBUG: Received requested NavMeshStatus: " << pContent << llendl;
#endif // XXX_STINSON_DEBUG_NAVMESH_ZONE
LLPathfindingNavMeshStatus navMeshStatus(mRegionUUID, pContent);
- LLPathfindingManager::getInstance()->handleNavMeshStatusRequest(navMeshStatus, mRegion);
+ LLPathfindingManager::getInstance()->handleNavMeshStatusRequest(navMeshStatus, mRegion, mIsGetStatusOnly);
}
void NavMeshStatusResponder::error(U32 pStatus, const std::string& pReason)
{
llwarns << "error with request to URL '" << mCapabilityURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl;
LLPathfindingNavMeshStatus navMeshStatus(mRegionUUID);
- LLPathfindingManager::getInstance()->handleNavMeshStatusRequest(navMeshStatus, mRegion);
+ LLPathfindingManager::getInstance()->handleNavMeshStatusRequest(navMeshStatus, mRegion, mIsGetStatusOnly);
}
//---------------------------------------------------------------------------
diff --git a/indra/newview/llpathfindingmanager.h b/indra/newview/llpathfindingmanager.h
index 1de9fd6525..a8ece11302 100644
--- a/indra/newview/llpathfindingmanager.h
+++ b/indra/newview/llpathfindingmanager.h
@@ -63,6 +63,7 @@ public:
virtual ~LLPathfindingManager();
void initSystem();
+ void quitSystem();
bool isPathfindingEnabledForCurrentRegion() const;
bool isPathfindingEnabledForRegion(LLViewerRegion *pRegion) const;
@@ -72,7 +73,7 @@ public:
bool isAllowViewTerrainProperties() const;
LLPathfindingNavMesh::navmesh_slot_t registerNavMeshListenerForRegion(LLViewerRegion *pRegion, LLPathfindingNavMesh::navmesh_callback_t pNavMeshCallback);
- void requestGetNavMeshForRegion(LLViewerRegion *pRegion);
+ void requestGetNavMeshForRegion(LLViewerRegion *pRegion, bool pIsGetStatusOnly);
typedef U32 request_id_t;
typedef boost::function<void (request_id_t, ERequestStatus, LLPathfindingObjectListPtr)> object_request_callback_t;
@@ -89,9 +90,6 @@ public:
typedef boost::signals2::signal< void () > agent_state_signal_t;
typedef boost::signals2::connection agent_state_slot_t;
- agent_state_slot_t mCrossingSlot;
- agent_state_signal_t mAgentStateSignal;
-
agent_state_slot_t registerAgentStateListener(agent_state_callback_t pAgentStateCallback);
void handleNavMeshRebakeResult( const LLSD &pContent );
@@ -105,11 +103,11 @@ protected:
private:
void sendRequestGetNavMeshForRegion(LLPathfindingNavMeshPtr navMeshPtr, LLViewerRegion *pRegion, const LLPathfindingNavMeshStatus &pNavMeshStatus);
- void handleDeferredGetNavMeshForRegion(const LLUUID &pRegionUUID);
+ void handleDeferredGetNavMeshForRegion(const LLUUID &pRegionUUID, bool pIsGetStatusOnly);
void handleDeferredGetLinksetsForRegion(const LLUUID &pRegionUUID, request_id_t pRequestId, object_request_callback_t pLinksetsCallback) const;
void handleDeferredGetCharactersForRegion(const LLUUID &pRegionUUID, request_id_t pRequestId, object_request_callback_t pCharactersCallback) const;
- void handleNavMeshStatusRequest(const LLPathfindingNavMeshStatus &pNavMeshStatus, LLViewerRegion *pRegion);
+ void handleNavMeshStatusRequest(const LLPathfindingNavMeshStatus &pNavMeshStatus, LLViewerRegion *pRegion, bool pIsGetStatusOnly);
void handleNavMeshStatusUpdate(const LLPathfindingNavMeshStatus &pNavMeshStatus);
void handleAgentStateUpdate();
@@ -127,17 +125,17 @@ private:
std::string getCapabilityURLForRegion(LLViewerRegion *pRegion, const std::string &pCapabilityName) const;
LLViewerRegion *getCurrentRegion() const;
-
+ void handleNavMeshStatus(LLPathfindingNavMesh::ENavMeshRequestStatus pRequestStatus, const LLPathfindingNavMeshStatus &pNavMeshStatus);
+
void displayNavMeshRebakePanel();
void hideNavMeshRebakePanel();
void handleAgentStateResult(const LLSD &pContent );
void handleAgentStateError(U32 pStatus, const std::string &pReason, const std::string &pURL);
-
- NavMeshMap mNavMeshMap;
-
- //prep#stinson# set this flag instead of directly showing/hiding the rebake panel
- BOOL mShowNavMeshRebake;
+ NavMeshMap mNavMeshMap;
+ agent_state_slot_t mCrossingSlot;
+ agent_state_signal_t mAgentStateSignal;
+ LLPathfindingNavMesh::navmesh_slot_t mNavMeshSlot;
};
diff --git a/indra/newview/llpathfindingnavmeshzone.cpp b/indra/newview/llpathfindingnavmeshzone.cpp
index 816c94e25e..69c76c9407 100644
--- a/indra/newview/llpathfindingnavmeshzone.cpp
+++ b/indra/newview/llpathfindingnavmeshzone.cpp
@@ -393,7 +393,7 @@ void LLPathfindingNavMeshZone::NavMeshLocation::refresh()
else
{
llassert(mRegionUUID == region->getRegionID());
- LLPathfindingManager::getInstance()->requestGetNavMeshForRegion(region);
+ LLPathfindingManager::getInstance()->requestGetNavMeshForRegion(region, false);
}
}