summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Stinson <stinson@lindenlab.com>2012-05-01 14:22:58 -0700
committerTodd Stinson <stinson@lindenlab.com>2012-05-01 14:22:58 -0700
commit852377c676bc3a8183073e41357499f06f40fb1b (patch)
tree53e8b48d65522b74876432819bc4791796d9ab34
parent3c18573ed0278b420e06b1c2ce5fc19232332aba (diff)
Switching the functionality of the linksets and character request handling to no longer return values directly, but rather to report status only through the callbacks.
-rw-r--r--indra/newview/llfloaterpathfindingcharacters.cpp34
-rw-r--r--indra/newview/llfloaterpathfindinglinksets.cpp78
-rw-r--r--indra/newview/llpathfindingmanager.cpp38
-rw-r--r--indra/newview/llpathfindingmanager.h6
4 files changed, 56 insertions, 100 deletions
diff --git a/indra/newview/llfloaterpathfindingcharacters.cpp b/indra/newview/llfloaterpathfindingcharacters.cpp
index ee97063352..d0706b0bc0 100644
--- a/indra/newview/llfloaterpathfindingcharacters.cpp
+++ b/indra/newview/llfloaterpathfindingcharacters.cpp
@@ -216,27 +216,7 @@ void LLFloaterPathfindingCharacters::setMessagingState(EMessagingState pMessagin
void LLFloaterPathfindingCharacters::requestGetCharacters()
{
- switch (LLPathfindingManager::getInstance()->requestGetCharacters(++mMessagingRequestId, boost::bind(&LLFloaterPathfindingCharacters::handleNewCharacters, this, _1, _2, _3)))
- {
- case LLPathfindingManager::kRequestStarted :
- setMessagingState(kMessagingGetRequestSent);
- break;
- case LLPathfindingManager::kRequestCompleted :
- clearCharacters();
- setMessagingState(kMessagingComplete);
- break;
- case LLPathfindingManager::kRequestNotEnabled :
- clearCharacters();
- setMessagingState(kMessagingNotEnabled);
- break;
- case LLPathfindingManager::kRequestError :
- setMessagingState(kMessagingGetError);
- break;
- default :
- setMessagingState(kMessagingGetError);
- llassert(0);
- break;
- }
+ LLPathfindingManager::getInstance()->requestGetCharacters(++mMessagingRequestId, boost::bind(&LLFloaterPathfindingCharacters::handleNewCharacters, this, _1, _2, _3));
}
void LLFloaterPathfindingCharacters::handleNewCharacters(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pCharacterRequestStatus, LLPathfindingCharacterListPtr pCharacterListPtr)
@@ -244,14 +224,20 @@ void LLFloaterPathfindingCharacters::handleNewCharacters(LLPathfindingManager::r
llassert(pRequestId <= mMessagingRequestId);
if (pRequestId == mMessagingRequestId)
{
- mCharacterListPtr = pCharacterListPtr;
- updateScrollList();
-
switch (pCharacterRequestStatus)
{
+ case LLPathfindingManager::kRequestStarted :
+ setMessagingState(kMessagingGetRequestSent);
+ break;
case LLPathfindingManager::kRequestCompleted :
+ mCharacterListPtr = pCharacterListPtr;
+ updateScrollList();
setMessagingState(kMessagingComplete);
break;
+ case LLPathfindingManager::kRequestNotEnabled :
+ clearCharacters();
+ setMessagingState(kMessagingNotEnabled);
+ break;
case LLPathfindingManager::kRequestError :
setMessagingState(kMessagingGetError);
break;
diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp
index 240b5bb741..8313226817 100644
--- a/indra/newview/llfloaterpathfindinglinksets.cpp
+++ b/indra/newview/llfloaterpathfindinglinksets.cpp
@@ -341,51 +341,12 @@ void LLFloaterPathfindingLinksets::setMessagingState(EMessagingState pMessagingS
void LLFloaterPathfindingLinksets::requestGetLinksets()
{
- switch (LLPathfindingManager::getInstance()->requestGetLinksets(++mMessagingRequestId, boost::bind(&LLFloaterPathfindingLinksets::handleNewLinksets, this, _1, _2, _3)))
- {
- case LLPathfindingManager::kRequestStarted :
- setMessagingState(kMessagingGetRequestSent);
- break;
- case LLPathfindingManager::kRequestCompleted :
- clearLinksets();
- setMessagingState(kMessagingComplete);
- break;
- case LLPathfindingManager::kRequestNotEnabled :
- clearLinksets();
- setMessagingState(kMessagingNotEnabled);
- break;
- case LLPathfindingManager::kRequestError :
- setMessagingState(kMessagingGetError);
- break;
- default :
- setMessagingState(kMessagingGetError);
- llassert(0);
- break;
- }
+ LLPathfindingManager::getInstance()->requestGetLinksets(++mMessagingRequestId, boost::bind(&LLFloaterPathfindingLinksets::handleNewLinksets, this, _1, _2, _3));
}
void LLFloaterPathfindingLinksets::requestSetLinksets(LLPathfindingLinksetListPtr pLinksetList, LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD)
{
- switch (LLPathfindingManager::getInstance()->requestSetLinksets(++mMessagingRequestId, pLinksetList, pLinksetUse, pA, pB, pC, pD, boost::bind(&LLFloaterPathfindingLinksets::handleUpdateLinksets, this, _1, _2, _3)))
- {
- case LLPathfindingManager::kRequestStarted :
- setMessagingState(kMessagingSetRequestSent);
- break;
- case LLPathfindingManager::kRequestCompleted :
- setMessagingState(kMessagingComplete);
- break;
- case LLPathfindingManager::kRequestNotEnabled :
- clearLinksets();
- setMessagingState(kMessagingNotEnabled);
- break;
- case LLPathfindingManager::kRequestError :
- setMessagingState(kMessagingSetError);
- break;
- default :
- setMessagingState(kMessagingSetError);
- llassert(0);
- break;
- }
+ LLPathfindingManager::getInstance()->requestSetLinksets(++mMessagingRequestId, pLinksetList, pLinksetUse, pA, pB, pC, pD, boost::bind(&LLFloaterPathfindingLinksets::handleUpdateLinksets, this, _1, _2, _3));
}
void LLFloaterPathfindingLinksets::handleNewLinksets(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pLinksetsRequestStatus, LLPathfindingLinksetListPtr pLinksetsListPtr)
@@ -398,9 +359,18 @@ void LLFloaterPathfindingLinksets::handleNewLinksets(LLPathfindingManager::reque
switch (pLinksetsRequestStatus)
{
+ case LLPathfindingManager::kRequestStarted :
+ setMessagingState(kMessagingGetRequestSent);
+ break;
case LLPathfindingManager::kRequestCompleted :
+ mLinksetsListPtr = pLinksetsListPtr;
+ updateScrollList();
setMessagingState(kMessagingComplete);
break;
+ case LLPathfindingManager::kRequestNotEnabled :
+ clearLinksets();
+ setMessagingState(kMessagingNotEnabled);
+ break;
case LLPathfindingManager::kRequestError :
setMessagingState(kMessagingGetError);
break;
@@ -417,21 +387,27 @@ void LLFloaterPathfindingLinksets::handleUpdateLinksets(LLPathfindingManager::re
llassert(pRequestId <= mMessagingRequestId);
if (pRequestId == mMessagingRequestId)
{
- if (mLinksetsListPtr == NULL)
- {
- mLinksetsListPtr = pLinksetsListPtr;
- }
- else
- {
- mLinksetsListPtr->update(*pLinksetsListPtr);
- }
- updateScrollList();
-
switch (pLinksetsRequestStatus)
{
+ case LLPathfindingManager::kRequestStarted :
+ setMessagingState(kMessagingSetRequestSent);
+ break;
case LLPathfindingManager::kRequestCompleted :
+ if (mLinksetsListPtr == NULL)
+ {
+ mLinksetsListPtr = pLinksetsListPtr;
+ }
+ else
+ {
+ mLinksetsListPtr->update(*pLinksetsListPtr);
+ }
+ updateScrollList();
setMessagingState(kMessagingComplete);
break;
+ case LLPathfindingManager::kRequestNotEnabled :
+ clearLinksets();
+ setMessagingState(kMessagingNotEnabled);
+ break;
case LLPathfindingManager::kRequestError :
setMessagingState(kMessagingSetError);
break;
diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp
index 59cfc398f2..8ce2e71c63 100644
--- a/indra/newview/llpathfindingmanager.cpp
+++ b/indra/newview/llpathfindingmanager.cpp
@@ -397,18 +397,20 @@ void LLPathfindingManager::requestSetAgentState(EAgentState pRequestedAgentState
}
}
-LLPathfindingManager::ERequestStatus LLPathfindingManager::requestGetLinksets(request_id_t pRequestId, linksets_callback_t pLinksetsCallback) const
+void LLPathfindingManager::requestGetLinksets(request_id_t pRequestId, linksets_callback_t pLinksetsCallback) const
{
- ERequestStatus status;
+ LLPathfindingLinksetListPtr emptyLinksetListPtr;
std::string objectLinksetsURL = getObjectLinksetsURLForCurrentRegion();
std::string terrainLinksetsURL = getTerrainLinksetsURLForCurrentRegion();
if (objectLinksetsURL.empty() || terrainLinksetsURL.empty())
{
- status = kRequestNotEnabled;
+ pLinksetsCallback(pRequestId, kRequestNotEnabled, emptyLinksetListPtr);
}
else
{
+ pLinksetsCallback(pRequestId, kRequestStarted, emptyLinksetListPtr);
+
bool doRequestTerrain = isAllowViewTerrainProperties();
LinksetsResponderPtr linksetsResponderPtr(new LinksetsResponder(pRequestId, pLinksetsCallback, true, doRequestTerrain));
@@ -420,22 +422,18 @@ LLPathfindingManager::ERequestStatus LLPathfindingManager::requestGetLinksets(re
LLHTTPClient::ResponderPtr terrainLinksetsResponder = new TerrainLinksetsResponder(terrainLinksetsURL, linksetsResponderPtr);
LLHTTPClient::get(terrainLinksetsURL, terrainLinksetsResponder);
}
-
- status = kRequestStarted;
}
-
- return status;
}
-LLPathfindingManager::ERequestStatus LLPathfindingManager::requestSetLinksets(request_id_t pRequestId, LLPathfindingLinksetListPtr pLinksetList, LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD, linksets_callback_t pLinksetsCallback) const
+void LLPathfindingManager::requestSetLinksets(request_id_t pRequestId, LLPathfindingLinksetListPtr pLinksetList, LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD, linksets_callback_t pLinksetsCallback) const
{
- ERequestStatus status = kRequestNotEnabled;
+ LLPathfindingLinksetListPtr emptyLinksetListPtr;
std::string objectLinksetsURL = getObjectLinksetsURLForCurrentRegion();
std::string terrainLinksetsURL = getTerrainLinksetsURLForCurrentRegion();
if (objectLinksetsURL.empty() || terrainLinksetsURL.empty())
{
- status = kRequestNotEnabled;
+ pLinksetsCallback(pRequestId, kRequestNotEnabled, emptyLinksetListPtr);
}
else
{
@@ -448,10 +446,12 @@ LLPathfindingManager::ERequestStatus LLPathfindingManager::requestSetLinksets(re
if (objectPostData.isUndefined() && terrainPostData.isUndefined())
{
- status = kRequestCompleted;
+ pLinksetsCallback(pRequestId, kRequestCompleted, emptyLinksetListPtr);
}
else
{
+ pLinksetsCallback(pRequestId, kRequestStarted, emptyLinksetListPtr);
+
LinksetsResponderPtr linksetsResponderPtr(new LinksetsResponder(pRequestId, pLinksetsCallback, !objectPostData.isUndefined(), !terrainPostData.isUndefined()));
if (!objectPostData.isUndefined())
@@ -465,32 +465,26 @@ LLPathfindingManager::ERequestStatus LLPathfindingManager::requestSetLinksets(re
LLHTTPClient::ResponderPtr terrainLinksetsResponder = new TerrainLinksetsResponder(terrainLinksetsURL, linksetsResponderPtr);
LLHTTPClient::put(terrainLinksetsURL, terrainPostData, terrainLinksetsResponder);
}
-
- status = kRequestStarted;
}
}
-
- return status;
}
-LLPathfindingManager::ERequestStatus LLPathfindingManager::requestGetCharacters(request_id_t pRequestId, characters_callback_t pCharactersCallback) const
+void LLPathfindingManager::requestGetCharacters(request_id_t pRequestId, characters_callback_t pCharactersCallback) const
{
- ERequestStatus status;
+ LLPathfindingCharacterListPtr emptyCharacterListPtr;
std::string charactersURL = getCharactersURLForCurrentRegion();
if (charactersURL.empty())
{
- status = kRequestNotEnabled;
+ pCharactersCallback(pRequestId, kRequestNotEnabled, emptyCharacterListPtr);
}
else
{
+ pCharactersCallback(pRequestId, kRequestStarted, emptyCharacterListPtr);
+
LLHTTPClient::ResponderPtr charactersResponder = new CharactersResponder(charactersURL, pRequestId, pCharactersCallback);
LLHTTPClient::get(charactersURL, charactersResponder);
-
- status = kRequestStarted;
}
-
- return status;
}
void LLPathfindingManager::sendRequestGetNavMeshForRegion(LLPathfindingNavMeshPtr navMeshPtr, LLViewerRegion *pRegion, const LLPathfindingNavMeshStatus &pNavMeshStatus)
diff --git a/indra/newview/llpathfindingmanager.h b/indra/newview/llpathfindingmanager.h
index f5d7cd1332..067a2c2515 100644
--- a/indra/newview/llpathfindingmanager.h
+++ b/indra/newview/llpathfindingmanager.h
@@ -98,10 +98,10 @@ public:
EAgentState getLastKnownNonErrorAgentState() const;
void requestSetAgentState(EAgentState pAgentState);
- ERequestStatus requestGetLinksets(request_id_t pRequestId, linksets_callback_t pLinksetsCallback) const;
- ERequestStatus requestSetLinksets(request_id_t pRequestId, LLPathfindingLinksetListPtr pLinksetList, LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD, linksets_callback_t pLinksetsCallback) const;
+ void requestGetLinksets(request_id_t pRequestId, linksets_callback_t pLinksetsCallback) const;
+ void requestSetLinksets(request_id_t pRequestId, LLPathfindingLinksetListPtr pLinksetList, LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD, linksets_callback_t pLinksetsCallback) const;
- ERequestStatus requestGetCharacters(request_id_t pRequestId, characters_callback_t pCharactersCallback) const;
+ void requestGetCharacters(request_id_t pRequestId, characters_callback_t pCharactersCallback) const;
protected: