From 9d22b22d962321822a6be6a23150e6d5f939cd50 Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Thu, 5 Apr 2012 15:59:34 -0700 Subject: PATH-482: BUGFIX Automatically reloading the character and linksets floaters on region crossing. --- indra/newview/llfloaterpathfindingcharacters.cpp | 94 +++++++------ indra/newview/llfloaterpathfindingcharacters.h | 20 +-- indra/newview/llfloaterpathfindinglinksets.cpp | 170 ++++++++++++----------- indra/newview/llfloaterpathfindinglinksets.h | 14 +- indra/newview/llpathfindingmanager.cpp | 32 +++-- indra/newview/llpathfindingmanager.h | 12 +- 6 files changed, 188 insertions(+), 154 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloaterpathfindingcharacters.cpp b/indra/newview/llfloaterpathfindingcharacters.cpp index d174d822cd..6fc1b8f051 100644 --- a/indra/newview/llfloaterpathfindingcharacters.cpp +++ b/indra/newview/llfloaterpathfindingcharacters.cpp @@ -47,6 +47,7 @@ #include "llviewerobjectlist.h" #include "llviewermenu.h" #include "llselectmgr.h" +#include "llenvmanager.h" //--------------------------------------------------------------------------- // LLFloaterPathfindingCharacters @@ -112,10 +113,20 @@ void LLFloaterPathfindingCharacters::onOpen(const LLSD& pKey) { mSelectionUpdateSlot = LLSelectMgr::getInstance()->mUpdateSignal.connect(boost::bind(&LLFloaterPathfindingCharacters::updateControls, this)); } + + if (!mRegionBoundarySlot.connected()) + { + mRegionBoundarySlot = LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LLFloaterPathfindingCharacters::onRegionBoundaryCross, this)); + } } void LLFloaterPathfindingCharacters::onClose(bool pAppQuitting) { + if (mRegionBoundarySlot.connected()) + { + mRegionBoundarySlot.disconnect(); + } + if (mSelectionUpdateSlot.connected()) { mSelectionUpdateSlot.disconnect(); @@ -167,16 +178,6 @@ void LLFloaterPathfindingCharacters::openCharactersViewer() LLFloaterReg::toggleInstanceOrBringToFront("pathfinding_characters"); } -LLFloaterPathfindingCharacters::EMessagingState LLFloaterPathfindingCharacters::getMessagingState() const -{ - return mMessagingState; -} - -BOOL LLFloaterPathfindingCharacters::isMessagingInProgress() const -{ - return (mMessagingState == kMessagingGetRequestSent); -} - LLFloaterPathfindingCharacters::LLFloaterPathfindingCharacters(const LLSD& pSeed) : LLFloater(pSeed), mCharactersScrollList(NULL), @@ -191,6 +192,7 @@ LLFloaterPathfindingCharacters::LLFloaterPathfindingCharacters(const LLSD& pSeed mDeleteButton(NULL), mTeleportButton(NULL), mMessagingState(kMessagingUnknown), + mMessagingRequestId(0U), mCharacterListPtr(), mCharacterSelection(), mSelectionUpdateSlot() @@ -201,6 +203,11 @@ LLFloaterPathfindingCharacters::~LLFloaterPathfindingCharacters() { } +LLFloaterPathfindingCharacters::EMessagingState LLFloaterPathfindingCharacters::getMessagingState() const +{ + return mMessagingState; +} + void LLFloaterPathfindingCharacters::setMessagingState(EMessagingState pMessagingState) { mMessagingState = pMessagingState; @@ -209,22 +216,42 @@ void LLFloaterPathfindingCharacters::setMessagingState(EMessagingState pMessagin void LLFloaterPathfindingCharacters::requestGetCharacters() { - llassert(!isMessagingInProgress()); - if (!isMessagingInProgress()) + 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; + } +} + +void LLFloaterPathfindingCharacters::handleNewCharacters(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pCharacterRequestStatus, LLPathfindingCharacterListPtr pCharacterListPtr) +{ + llassert(pRequestId <= mMessagingRequestId); + if (pRequestId == mMessagingRequestId) { - switch (LLPathfindingManager::getInstance()->requestGetCharacters(boost::bind(&LLFloaterPathfindingCharacters::handleNewCharacters, this, _1, _2))) + mCharacterListPtr = pCharacterListPtr; + updateScrollList(); + + switch (pCharacterRequestStatus) { - 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; @@ -236,26 +263,6 @@ void LLFloaterPathfindingCharacters::requestGetCharacters() } } -void LLFloaterPathfindingCharacters::handleNewCharacters(LLPathfindingManager::ERequestStatus pCharacterRequestStatus, LLPathfindingCharacterListPtr pCharacterListPtr) -{ - mCharacterListPtr = pCharacterListPtr; - updateScrollList(); - - switch (pCharacterRequestStatus) - { - case LLPathfindingManager::kRequestCompleted : - setMessagingState(kMessagingComplete); - break; - case LLPathfindingManager::kRequestError : - setMessagingState(kMessagingGetError); - break; - default : - setMessagingState(kMessagingGetError); - llassert(0); - break; - } -} - void LLFloaterPathfindingCharacters::onCharactersSelectionChange() { mCharacterSelection.clear(); @@ -345,6 +352,11 @@ void LLFloaterPathfindingCharacters::onTeleportCharacterToMeClicked() } } +void LLFloaterPathfindingCharacters::onRegionBoundaryCross() +{ + requestGetCharacters(); +} + void LLFloaterPathfindingCharacters::selectAllCharacters() { mCharactersScrollList->selectAll(); diff --git a/indra/newview/llfloaterpathfindingcharacters.h b/indra/newview/llfloaterpathfindingcharacters.h index a242a5503f..e0f1c22eac 100644 --- a/indra/newview/llfloaterpathfindingcharacters.h +++ b/indra/newview/llfloaterpathfindingcharacters.h @@ -68,9 +68,6 @@ public: static void openCharactersViewer(); - EMessagingState getMessagingState() const; - BOOL isMessagingInProgress() const; - protected: private: @@ -86,19 +83,23 @@ private: LLButton *mDeleteButton; LLButton *mTeleportButton; - EMessagingState mMessagingState; - LLPathfindingCharacterListPtr mCharacterListPtr; - LLObjectSelectionHandle mCharacterSelection; - boost::signals2::connection mSelectionUpdateSlot; + EMessagingState mMessagingState; + LLPathfindingManager::request_id_t mMessagingRequestId; + LLPathfindingCharacterListPtr mCharacterListPtr; + LLObjectSelectionHandle mCharacterSelection; + boost::signals2::connection mSelectionUpdateSlot; + boost::signals2::connection mRegionBoundarySlot; // Does its own instance management, so clients not allowed // to allocate or destroy. LLFloaterPathfindingCharacters(const LLSD& pSeed); virtual ~LLFloaterPathfindingCharacters(); - void setMessagingState(EMessagingState pMessagingState); + EMessagingState getMessagingState() const; + void setMessagingState(EMessagingState pMessagingState); + void requestGetCharacters(); - void handleNewCharacters(LLPathfindingManager::ERequestStatus pCharacterRequestStatus, LLPathfindingCharacterListPtr pCharacterListPtr); + void handleNewCharacters(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pCharacterRequestStatus, LLPathfindingCharacterListPtr pCharacterListPtr); void onCharactersSelectionChange(); void onRefreshCharactersClicked(); @@ -109,6 +110,7 @@ private: void onReturnCharactersClicked(); void onDeleteCharactersClicked(); void onTeleportCharacterToMeClicked(); + void onRegionBoundaryCross(); void selectAllCharacters(); void selectNoneCharacters(); diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp index 547db078b1..c2df53a31d 100644 --- a/indra/newview/llfloaterpathfindinglinksets.cpp +++ b/indra/newview/llfloaterpathfindinglinksets.cpp @@ -51,6 +51,7 @@ #include "llpathfindinglinksetlist.h" #include "llpathfindingmanager.h" #include "llnotificationsutil.h" +#include "llenvmanager.h" #include #include @@ -218,10 +219,20 @@ void LLFloaterPathfindingLinksets::onOpen(const LLSD& pKey) { mSelectionUpdateSlot = LLSelectMgr::getInstance()->mUpdateSignal.connect(boost::bind(&LLFloaterPathfindingLinksets::updateControls, this)); } + + if (!mRegionBoundarySlot.connected()) + { + mRegionBoundarySlot = LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LLFloaterPathfindingLinksets::onRegionBoundaryCross, this)); + } } void LLFloaterPathfindingLinksets::onClose(bool pAppQuitting) { + if (mRegionBoundarySlot.connected()) + { + mRegionBoundarySlot.disconnect(); + } + if (mSelectionUpdateSlot.connected()) { mSelectionUpdateSlot.disconnect(); @@ -277,16 +288,6 @@ void LLFloaterPathfindingLinksets::openLinksetsEditor() LLFloaterReg::toggleInstanceOrBringToFront("pathfinding_linksets"); } -LLFloaterPathfindingLinksets::EMessagingState LLFloaterPathfindingLinksets::getMessagingState() const -{ - return mMessagingState; -} - -bool LLFloaterPathfindingLinksets::isMessagingInProgress() const -{ - return ((mMessagingState == kMessagingGetRequestSent) || (mMessagingState == kMessagingSetRequestSent)); -} - LLFloaterPathfindingLinksets::LLFloaterPathfindingLinksets(const LLSD& pSeed) : LLFloater(pSeed), mFilterByName(NULL), @@ -315,6 +316,7 @@ LLFloaterPathfindingLinksets::LLFloaterPathfindingLinksets(const LLSD& pSeed) mEditD(NULL), mApplyEditsButton(NULL), mMessagingState(kMessagingUnknown), + mMessagingRequestId(0U), mLinksetsListPtr(), mLinksetsSelection(), mAgentStateSlot(), @@ -326,6 +328,11 @@ LLFloaterPathfindingLinksets::~LLFloaterPathfindingLinksets() { } +LLFloaterPathfindingLinksets::EMessagingState LLFloaterPathfindingLinksets::getMessagingState() const +{ + return mMessagingState; +} + void LLFloaterPathfindingLinksets::setMessagingState(EMessagingState pMessagingState) { mMessagingState = pMessagingState; @@ -334,22 +341,66 @@ void LLFloaterPathfindingLinksets::setMessagingState(EMessagingState pMessagingS void LLFloaterPathfindingLinksets::requestGetLinksets() { - llassert(!isMessagingInProgress()); - if (!isMessagingInProgress()) + 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; + } +} + +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; + } +} + +void LLFloaterPathfindingLinksets::handleNewLinksets(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pLinksetsRequestStatus, LLPathfindingLinksetListPtr pLinksetsListPtr) +{ + llassert(pRequestId <= mMessagingRequestId); + if (pRequestId == mMessagingRequestId) { - switch (LLPathfindingManager::getInstance()->requestGetLinksets(boost::bind(&LLFloaterPathfindingLinksets::handleNewLinksets, this, _1, _2))) + mLinksetsListPtr = pLinksetsListPtr; + updateScrollList(); + + switch (pLinksetsRequestStatus) { - 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; @@ -361,23 +412,26 @@ void LLFloaterPathfindingLinksets::requestGetLinksets() } } -void LLFloaterPathfindingLinksets::requestSetLinksets(LLPathfindingLinksetListPtr pLinksetList, LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD) +void LLFloaterPathfindingLinksets::handleUpdateLinksets(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pLinksetsRequestStatus, LLPathfindingLinksetListPtr pLinksetsListPtr) { - llassert(!isMessagingInProgress()); - if (!isMessagingInProgress()) + llassert(pRequestId <= mMessagingRequestId); + if (pRequestId == mMessagingRequestId) { - switch (LLPathfindingManager::getInstance()->requestSetLinksets(pLinksetList, pLinksetUse, pA, pB, pC, pD, boost::bind(&LLFloaterPathfindingLinksets::handleUpdateLinksets, this, _1, _2))) + if (mLinksetsListPtr == NULL) + { + mLinksetsListPtr = pLinksetsListPtr; + } + else + { + mLinksetsListPtr->update(*pLinksetsListPtr); + } + updateScrollList(); + + switch (pLinksetsRequestStatus) { - 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; @@ -389,53 +443,6 @@ void LLFloaterPathfindingLinksets::requestSetLinksets(LLPathfindingLinksetListPt } } -void LLFloaterPathfindingLinksets::handleNewLinksets(LLPathfindingManager::ERequestStatus pLinksetsRequestStatus, LLPathfindingLinksetListPtr pLinksetsListPtr) -{ - mLinksetsListPtr = pLinksetsListPtr; - updateScrollList(); - - switch (pLinksetsRequestStatus) - { - case LLPathfindingManager::kRequestCompleted : - setMessagingState(kMessagingComplete); - break; - case LLPathfindingManager::kRequestError : - setMessagingState(kMessagingGetError); - break; - default : - setMessagingState(kMessagingGetError); - llassert(0); - break; - } -} - -void LLFloaterPathfindingLinksets::handleUpdateLinksets(LLPathfindingManager::ERequestStatus pLinksetsRequestStatus, LLPathfindingLinksetListPtr pLinksetsListPtr) -{ - if (mLinksetsListPtr == NULL) - { - mLinksetsListPtr = pLinksetsListPtr; - } - else - { - mLinksetsListPtr->update(*pLinksetsListPtr); - } - updateScrollList(); - - switch (pLinksetsRequestStatus) - { - case LLPathfindingManager::kRequestCompleted : - setMessagingState(kMessagingComplete); - break; - case LLPathfindingManager::kRequestError : - setMessagingState(kMessagingSetError); - break; - default : - setMessagingState(kMessagingSetError); - llassert(0); - break; - } -} - void LLFloaterPathfindingLinksets::onApplyAllFilters() { applyFilters(); @@ -562,6 +569,11 @@ void LLFloaterPathfindingLinksets::onAgentStateCB(LLPathfindingManager::EAgentSt updateControls(); } +void LLFloaterPathfindingLinksets::onRegionBoundaryCross() +{ + requestGetLinksets(); +} + void LLFloaterPathfindingLinksets::applyFilters() { updateScrollList(); diff --git a/indra/newview/llfloaterpathfindinglinksets.h b/indra/newview/llfloaterpathfindinglinksets.h index 0cf9b2162b..c3a243314f 100644 --- a/indra/newview/llfloaterpathfindinglinksets.h +++ b/indra/newview/llfloaterpathfindinglinksets.h @@ -71,9 +71,6 @@ public: static void openLinksetsEditor(); - EMessagingState getMessagingState() const; - bool isMessagingInProgress() const; - protected: private: @@ -111,21 +108,25 @@ private: LLButton *mApplyEditsButton; EMessagingState mMessagingState; + LLPathfindingManager::request_id_t mMessagingRequestId; LLPathfindingLinksetListPtr mLinksetsListPtr; LLObjectSelectionHandle mLinksetsSelection; LLPathfindingManager::agent_state_slot_t mAgentStateSlot; boost::signals2::connection mSelectionUpdateSlot; + boost::signals2::connection mRegionBoundarySlot; // Does its own instance management, so clients not allowed // to allocate or destroy. LLFloaterPathfindingLinksets(const LLSD& pSeed); virtual ~LLFloaterPathfindingLinksets(); - void setMessagingState(EMessagingState pMessagingState); + EMessagingState getMessagingState() const; + void setMessagingState(EMessagingState pMessagingState); + void requestGetLinksets(); void requestSetLinksets(LLPathfindingLinksetListPtr pLinksetList, LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD); - void handleNewLinksets(LLPathfindingManager::ERequestStatus pLinksetsRequestStatus, LLPathfindingLinksetListPtr pLinksetsListPtr); - void handleUpdateLinksets(LLPathfindingManager::ERequestStatus pLinksetsRequestStatus, LLPathfindingLinksetListPtr pLinksetsListPtr); + void handleNewLinksets(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pLinksetsRequestStatus, LLPathfindingLinksetListPtr pLinksetsListPtr); + void handleUpdateLinksets(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::ERequestStatus pLinksetsRequestStatus, LLPathfindingLinksetListPtr pLinksetsListPtr); void onApplyAllFilters(); void onClearFiltersClicked(); @@ -141,6 +142,7 @@ private: void onWalkabilityCoefficientEntered(LLUICtrl *pUICtrl); void onApplyChangesClicked(); void onAgentStateCB(LLPathfindingManager::EAgentState pAgentState); + void onRegionBoundaryCross(); void applyFilters(); void clearFilters(); diff --git a/indra/newview/llpathfindingmanager.cpp b/indra/newview/llpathfindingmanager.cpp index fdff380050..cefff175a3 100644 --- a/indra/newview/llpathfindingmanager.cpp +++ b/indra/newview/llpathfindingmanager.cpp @@ -156,7 +156,7 @@ private: class LinksetsResponder { public: - LinksetsResponder(LLPathfindingManager::linksets_callback_t pLinksetsCallback, bool pIsObjectRequested, bool pIsTerrainRequested); + LinksetsResponder(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::linksets_callback_t pLinksetsCallback, bool pIsObjectRequested, bool pIsTerrainRequested); virtual ~LinksetsResponder(); void handleObjectLinksetsResult(const LLSD &pContent); @@ -177,6 +177,7 @@ private: kReceivedError } EMessagingState; + LLPathfindingManager::request_id_t mRequestId; LLPathfindingManager::linksets_callback_t mLinksetsCallback; EMessagingState mObjectMessagingState; @@ -235,7 +236,7 @@ private: class CharactersResponder : public LLHTTPClient::Responder { public: - CharactersResponder(const std::string &pCapabilityURL, LLPathfindingManager::characters_callback_t pCharactersCallback); + CharactersResponder(const std::string &pCapabilityURL, LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::characters_callback_t pCharactersCallback); virtual ~CharactersResponder(); virtual void result(const LLSD &pContent); @@ -245,6 +246,7 @@ protected: private: std::string mCapabilityURL; + LLPathfindingManager::request_id_t mRequestId; LLPathfindingManager::characters_callback_t mCharactersCallback; }; @@ -383,7 +385,7 @@ void LLPathfindingManager::requestSetAgentState(EAgentState pRequestedAgentState } } -LLPathfindingManager::ERequestStatus LLPathfindingManager::requestGetLinksets(linksets_callback_t pLinksetsCallback) const +LLPathfindingManager::ERequestStatus LLPathfindingManager::requestGetLinksets(request_id_t pRequestId, linksets_callback_t pLinksetsCallback) const { ERequestStatus status; @@ -396,7 +398,7 @@ LLPathfindingManager::ERequestStatus LLPathfindingManager::requestGetLinksets(li else { bool doRequestTerrain = isAllowViewTerrainProperties(); - LinksetsResponderPtr linksetsResponderPtr(new LinksetsResponder(pLinksetsCallback, true, doRequestTerrain)); + LinksetsResponderPtr linksetsResponderPtr(new LinksetsResponder(pRequestId, pLinksetsCallback, true, doRequestTerrain)); LLHTTPClient::ResponderPtr objectLinksetsResponder = new ObjectLinksetsResponder(objectLinksetsURL, linksetsResponderPtr); LLHTTPClient::get(objectLinksetsURL, objectLinksetsResponder); @@ -413,7 +415,7 @@ LLPathfindingManager::ERequestStatus LLPathfindingManager::requestGetLinksets(li return status; } -LLPathfindingManager::ERequestStatus LLPathfindingManager::requestSetLinksets(LLPathfindingLinksetListPtr pLinksetList, LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD, linksets_callback_t pLinksetsCallback) const +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 { ERequestStatus status = kRequestNotEnabled; @@ -438,7 +440,7 @@ LLPathfindingManager::ERequestStatus LLPathfindingManager::requestSetLinksets(LL } else { - LinksetsResponderPtr linksetsResponderPtr(new LinksetsResponder(pLinksetsCallback, !objectPostData.isUndefined(), !terrainPostData.isUndefined())); + LinksetsResponderPtr linksetsResponderPtr(new LinksetsResponder(pRequestId, pLinksetsCallback, !objectPostData.isUndefined(), !terrainPostData.isUndefined())); if (!objectPostData.isUndefined()) { @@ -459,7 +461,7 @@ LLPathfindingManager::ERequestStatus LLPathfindingManager::requestSetLinksets(LL return status; } -LLPathfindingManager::ERequestStatus LLPathfindingManager::requestGetCharacters(characters_callback_t pCharactersCallback) const +LLPathfindingManager::ERequestStatus LLPathfindingManager::requestGetCharacters(request_id_t pRequestId, characters_callback_t pCharactersCallback) const { ERequestStatus status; @@ -470,7 +472,7 @@ LLPathfindingManager::ERequestStatus LLPathfindingManager::requestGetCharacters( } else { - LLHTTPClient::ResponderPtr charactersResponder = new CharactersResponder(charactersURL, pCharactersCallback); + LLHTTPClient::ResponderPtr charactersResponder = new CharactersResponder(charactersURL, pRequestId, pCharactersCallback); LLHTTPClient::get(charactersURL, charactersResponder); status = kRequestStarted; @@ -822,8 +824,9 @@ void AgentStateResponder::error(U32 pStatus, const std::string &pReason) // LinksetsResponder //--------------------------------------------------------------------------- -LinksetsResponder::LinksetsResponder(LLPathfindingManager::linksets_callback_t pLinksetsCallback, bool pIsObjectRequested, bool pIsTerrainRequested) - : mLinksetsCallback(pLinksetsCallback), +LinksetsResponder::LinksetsResponder(LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::linksets_callback_t pLinksetsCallback, bool pIsObjectRequested, bool pIsTerrainRequested) + : mRequestId(pRequestId), + mLinksetsCallback(pLinksetsCallback), mObjectMessagingState(pIsObjectRequested ? kWaiting : kNotRequested), mTerrainMessagingState(pIsTerrainRequested ? kWaiting : kNotRequested), mObjectLinksetListPtr(), @@ -895,7 +898,7 @@ void LinksetsResponder::sendCallback() mObjectLinksetListPtr->insert(std::pair(mTerrainLinksetPtr->getUUID().asString(), mTerrainLinksetPtr)); } - mLinksetsCallback(requestStatus, mObjectLinksetListPtr); + mLinksetsCallback(mRequestId, requestStatus, mObjectLinksetListPtr); } //--------------------------------------------------------------------------- @@ -952,9 +955,10 @@ void TerrainLinksetsResponder::error(U32 pStatus, const std::string &pReason) // CharactersResponder //--------------------------------------------------------------------------- -CharactersResponder::CharactersResponder(const std::string &pCapabilityURL, LLPathfindingManager::characters_callback_t pCharactersCallback) +CharactersResponder::CharactersResponder(const std::string &pCapabilityURL, LLPathfindingManager::request_id_t pRequestId, LLPathfindingManager::characters_callback_t pCharactersCallback) : LLHTTPClient::Responder(), mCapabilityURL(pCapabilityURL), + mRequestId(pRequestId), mCharactersCallback(pCharactersCallback) { } @@ -966,7 +970,7 @@ CharactersResponder::~CharactersResponder() void CharactersResponder::result(const LLSD &pContent) { LLPathfindingCharacterListPtr characterListPtr = LLPathfindingCharacterListPtr(new LLPathfindingCharacterList(pContent)); - mCharactersCallback(LLPathfindingManager::kRequestCompleted, characterListPtr); + mCharactersCallback(mRequestId, LLPathfindingManager::kRequestCompleted, characterListPtr); } void CharactersResponder::error(U32 pStatus, const std::string &pReason) @@ -974,5 +978,5 @@ void CharactersResponder::error(U32 pStatus, const std::string &pReason) llwarns << "error with request to URL '" << mCapabilityURL << "' because " << pReason << " (statusCode:" << pStatus << ")" << llendl; LLPathfindingCharacterListPtr characterListPtr; - mCharactersCallback(LLPathfindingManager::kRequestError, characterListPtr); + mCharactersCallback(mRequestId, LLPathfindingManager::kRequestError, characterListPtr); } diff --git a/indra/newview/llpathfindingmanager.h b/indra/newview/llpathfindingmanager.h index d906a94d44..795ee88f3d 100644 --- a/indra/newview/llpathfindingmanager.h +++ b/indra/newview/llpathfindingmanager.h @@ -73,8 +73,10 @@ public: kRequestError } ERequestStatus; - typedef boost::function linksets_callback_t; - typedef boost::function characters_callback_t; + typedef U32 request_id_t; + + typedef boost::function linksets_callback_t; + typedef boost::function characters_callback_t; LLPathfindingManager(); virtual ~LLPathfindingManager(); @@ -96,10 +98,10 @@ public: EAgentState getLastKnownNonErrorAgentState() const; void requestSetAgentState(EAgentState pAgentState); - ERequestStatus requestGetLinksets(linksets_callback_t pLinksetsCallback) const; - ERequestStatus requestSetLinksets(LLPathfindingLinksetListPtr pLinksetList, LLPathfindingLinkset::ELinksetUse pLinksetUse, S32 pA, S32 pB, S32 pC, S32 pD, linksets_callback_t pLinksetsCallback) const; + 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; - ERequestStatus requestGetCharacters(characters_callback_t pCharactersCallback) const; + ERequestStatus requestGetCharacters(request_id_t pRequestId, characters_callback_t pCharactersCallback) const; protected: -- cgit v1.2.3