diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h index affa0406025d50bc2147229a9b6ab62198361eb6..88c09c8dca83b606167be45e79728e6d78780ba4 100644 --- a/indra/llcommon/llpointer.h +++ b/indra/llcommon/llpointer.h @@ -140,6 +140,10 @@ template <class Type> class LLPointer } protected: +#ifdef LL_LIBRARY_INCLUDE + void ref(); + void unref(); +#else void ref() { if (mPointer) @@ -162,7 +166,7 @@ template <class Type> class LLPointer } } } - +#endif protected: Type* mPointer; }; diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 314bd790ddf13062564ff622e74a45d2f4635e48..bff87cea9534ce4497cd323c90bec26b86a7692d 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1517,8 +1517,8 @@ if (WINDOWS) PROPERTIES # *TODO -reenable this once we get server usage sorted out #LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:WINDOWS /INCLUDE:\"__tcmalloc\"" - LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:WINDOWS /INCLUDE:__tcmalloc /FORCE:MULTIPLE" - LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;LIBCMTD;MSVCRT\" /INCREMENTAL:NO /FORCE:MULTIPLE" + LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:WINDOWS /INCLUDE:__tcmalloc " + LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;LIBCMTD;MSVCRT\" /INCREMENTAL:NO" LINK_FLAGS_RELEASE "/FORCE:MULTIPLE" ) if(USE_PRECOMPILED_HEADERS) diff --git a/indra/newview/llfloaterpathfindingconsole.cpp b/indra/newview/llfloaterpathfindingconsole.cpp index 63b863937e5b7c2118dfc9cdcb6239a8bbfb1cd5..85561270514b39d042c020bddf9147987492c3fb 100644 --- a/indra/newview/llfloaterpathfindingconsole.cpp +++ b/indra/newview/llfloaterpathfindingconsole.cpp @@ -54,6 +54,8 @@ #define XUI_CHARACTER_TYPE_C 3 #define XUI_CHARACTER_TYPE_D 4 +const int CURRENT_REGION = 99; +const int MAX_OBSERVERS = 10; //--------------------------------------------------------------------------- // LLFloaterPathfindingConsole //--------------------------------------------------------------------------- @@ -333,10 +335,12 @@ LLFloaterPathfindingConsole::LLFloaterPathfindingConsole(const LLSD& pSeed) mTerrainMaterialA(NULL), mTerrainMaterialB(NULL), mTerrainMaterialC(NULL), - mTerrainMaterialD(NULL), - mNavMeshDownloadObserver() + mTerrainMaterialD(NULL) { - mNavMeshDownloadObserver.setPathfindingConsole(this); + for (int i=0;i<MAX_OBSERVERS;++i) + { + mNavMeshDownloadObserver[i].setPathfindingConsole(this); + } } LLFloaterPathfindingConsole::~LLFloaterPathfindingConsole() @@ -365,23 +369,41 @@ void LLFloaterPathfindingConsole::onOpen(const LLSD& pKey) } else { + mCurrentMDO = 0; //make sure the region is essentially enabled for navmesh support std::string capability = "RetrieveNavMeshSrc"; - std::string url = gAgent.getRegion()->getCapability( capability ); - if ( !url.empty() ) - { - std::string str = getString("navmesh_fetch_inprogress"); - mPathfindingStatus->setText((LLStringExplicit)str); - LLNavMeshStation::getInstance()->setNavMeshDownloadURL( url ); - LLNavMeshStation::getInstance()->downloadNavMeshSrc( mNavMeshDownloadObserver.getObserverHandle() ); - } - else + + //prep# neighboring navmesh support proto + LLViewerRegion* pCurrentRegion = gAgent.getRegion(); + std::vector<LLViewerRegion*> regions; + regions.push_back( pCurrentRegion ); + //pCurrentRegion->getNeighboringRegions( regions ); + + std::vector<int> shift; + shift.push_back( CURRENT_REGION ); + //pCurrentRegion->getNeighboringRegionsStatus( shift ); + + int regionCnt = regions.size(); + for ( int i=0; i<regionCnt; ++i ) { - std::string str = getString("navmesh_region_not_enabled"); - LLStyle::Params styleParams; - styleParams.color = LLUIColorTable::instance().getColor("DrYellow"); - mPathfindingStatus->setText((LLStringExplicit)str, styleParams); - llinfos<<"Region has does not required caps of type ["<<capability<<"]"<<llendl; + std::string url = regions[i]->getCapability( capability ); + + if ( !url.empty() ) + { + llinfos<<"Region has required caps of type ["<<capability<<"]"<<llendl; + LLNavMeshStation::getInstance()->setNavMeshDownloadURL( url ); + int dir = shift[i]; + LLNavMeshStation::getInstance()->downloadNavMeshSrc( mNavMeshDownloadObserver[mCurrentMDO].getObserverHandle(), dir ); + ++mCurrentMDO; + } + else + { + std::string str = getString("navmesh_region_not_enabled"); + LLStyle::Params styleParams; + styleParams.color = LLUIColorTable::instance().getColor("DrYellow"); + mPathfindingStatus->setText((LLStringExplicit)str, styleParams); + llinfos<<"Region has does not required caps of type ["<<capability<<"]"<<llendl; + } } } } diff --git a/indra/newview/llfloaterpathfindingconsole.h b/indra/newview/llfloaterpathfindingconsole.h index 7d8369c806524da3bef0cbed05ea7b4b77629faa..ed63a669ead5b9f899aa536140b897ccd2436619 100644 --- a/indra/newview/llfloaterpathfindingconsole.h +++ b/indra/newview/llfloaterpathfindingconsole.h @@ -141,7 +141,8 @@ class LLFloaterPathfindingConsole LLLineEditor *mTerrainMaterialC; LLLineEditor *mTerrainMaterialD; - LLNavMeshDownloadObserver mNavMeshDownloadObserver; + LLNavMeshDownloadObserver mNavMeshDownloadObserver[10]; + int mCurrentMDO; //Container that is populated and subsequently submitted to the LLPathingSystem for processing LLPathingLib::PathingPacket mPathData; diff --git a/indra/newview/llnavmeshstation.cpp b/indra/newview/llnavmeshstation.cpp index 48f54649f8f7fe069ee16c5e495bcee42f9fdd00..6f6ebc184a1ef112d503e0b098630f5e78d66db9 100644 --- a/indra/newview/llnavmeshstation.cpp +++ b/indra/newview/llnavmeshstation.cpp @@ -31,68 +31,20 @@ #include "llagent.h" #include "llviewerregion.h" #include "llsdutil.h" -#include "llfloaterpathfindingconsole.h" - //=============================================================================== LLNavMeshStation::LLNavMeshStation() { } - -//=============================================================================== -class LLNavMeshUploadResponder : public LLCurl::Responder -{ -public: - LLNavMeshUploadResponder( const LLHandle<LLNavMeshObserver>& observer_handle ) - : mObserverHandle( observer_handle ) - { - } - - void clearPendingRequests ( void ) - { - } - - void error( U32 statusNum, const std::string& reason ) - { - //statusNum; - llwarns << "Transport error "<<reason<<llendl; - } - - void result( const LLSD& content ) - { - llinfos<<"Content received"<<llendl; - //TODO# some sanity checking - if ( content.has("error") ) - { - llwarns << "Error on fetched data"<< llendl; - } - else - { - LLNavMeshObserver* pObserver = mObserverHandle.get(); - if ( pObserver ) - { - llinfos<<"Do something immensely important w/content"<<llendl; - //pObserver->execute(); - } - } - } - -private: - //Observer handle - LLHandle<LLNavMeshObserver> mObserverHandle; -}; //=============================================================================== class LLNavMeshDownloadResponder : public LLCurl::Responder { public: - LLNavMeshDownloadResponder( const LLHandle<LLNavMeshDownloadObserver>& observer_handle ) + LLNavMeshDownloadResponder( const LLHandle<LLNavMeshDownloadObserver>& observer_handle, int dir ) : mObserverHandle( observer_handle ) + , mDir( dir ) { } - void clearPendingRequests ( void ) - { - } - void error( U32 statusNum, const std::string& reason ) { //statusNum; @@ -101,11 +53,11 @@ class LLNavMeshDownloadResponder : public LLCurl::Responder void result( const LLSD& content ) { - //TODO# some sanity checking + llinfos<<"Content received"<<llendl; if ( content.has("error") ) { llwarns << "Error on fetched data"<< llendl; - llinfos<<"LLsd buffer on error"<<ll_pretty_print_sd(content)<<llendl; + //llinfos<<"LLsd buffer on error"<<ll_pretty_print_sd(content)<<llendl; } else { @@ -116,13 +68,11 @@ class LLNavMeshDownloadResponder : public LLCurl::Responder if ( content.has("navmesh_data") ) { const LLSD::Binary& stuff = content["navmesh_data"].asBinary(); - LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD( stuff ); - pObserver->getPathfindingConsole()->setHasNavMeshReceived(); + LLPathingLib::getInstance()->extractNavMeshSrcFromLLSD( stuff, mDir ); } else { llwarns<<"no mesh data "<<llendl; - pObserver->getPathfindingConsole()->setHasNoNavMesh(); } } } @@ -131,38 +81,10 @@ class LLNavMeshDownloadResponder : public LLCurl::Responder private: //Observer handle LLHandle<LLNavMeshDownloadObserver> mObserverHandle; + int mDir; }; - -//=============================================================================== -bool LLNavMeshStation::postNavMeshToServer( LLSD& data, const LLHandle<LLNavMeshObserver>& observerHandle ) -{ - mCurlRequest = new LLCurlRequest(); - - if ( mNavMeshUploadURL.empty() ) - { - llinfos << "Unable to upload navmesh because of missing URL" << llendl; - } - else - { - LLCurlRequest::headers_t headers; - mCurlRequest->post( mNavMeshUploadURL, headers, data, - new LLNavMeshUploadResponder(/*this, data,*/ observerHandle ) ); - do - { - mCurlRequest->process(); - //sleep for 10ms to prevent eating a whole core - apr_sleep(10000); - } while ( mCurlRequest->getQueued() > 0 ); - } - - delete mCurlRequest; - - mCurlRequest = NULL; - - return true; -} //=============================================================================== -void LLNavMeshStation::downloadNavMeshSrc( const LLHandle<LLNavMeshDownloadObserver>& observerHandle ) +void LLNavMeshStation::downloadNavMeshSrc( const LLHandle<LLNavMeshDownloadObserver>& observerHandle, int dir ) { if ( mNavMeshDownloadURL.empty() ) { @@ -173,7 +95,7 @@ void LLNavMeshStation::downloadNavMeshSrc( const LLHandle<LLNavMeshDownloadObser LLSD data; data["agent_id"] = gAgent.getID(); data["region_id"] = gAgent.getRegion()->getRegionID(); - LLHTTPClient::post(mNavMeshDownloadURL, data, new LLNavMeshDownloadResponder( observerHandle ) ); + LLHTTPClient::post(mNavMeshDownloadURL, data, new LLNavMeshDownloadResponder( observerHandle, dir ) ); } } //=============================================================================== diff --git a/indra/newview/llnavmeshstation.h b/indra/newview/llnavmeshstation.h index 566f6d2d8d9af9c6d09dc2fdb2884a81be350af8..c8e23513ebc40023b4b7064977c900245feb55b5 100644 --- a/indra/newview/llnavmeshstation.h +++ b/indra/newview/llnavmeshstation.h @@ -47,14 +47,11 @@ class LLNavMeshObserver LLRootHandle<LLNavMeshObserver> mObserverHandle; }; //=============================================================================== -//prep#TODO# determine if a name change is needed? class LLNavMeshDownloadObserver { public: //Ctor - LLNavMeshDownloadObserver() - : mPathfindingConsole(NULL) - { mObserverHandle.bind(this); } + LLNavMeshDownloadObserver() { mObserverHandle.bind(this); } //Dtor virtual ~LLNavMeshDownloadObserver() {} //Accessor for the observers handle @@ -78,8 +75,10 @@ class LLNavMeshStation : public LLSingleton<LLNavMeshStation> void setNavMeshUploadURL( std::string& url ) { mNavMeshUploadURL = url; } //Setter for the navmesh download url void setNavMeshDownloadURL( std::string& url ) { mNavMeshDownloadURL = url; } + //Callback to handle the requested src data for this regions navmesh src + static void processNavMeshSrc( LLMessageSystem* msg, void** ); //Initiate download of the navmesh source from the server - void downloadNavMeshSrc( const LLHandle<LLNavMeshDownloadObserver>& observerHandle ); + void downloadNavMeshSrc( const LLHandle<LLNavMeshDownloadObserver>& observerHandle, int dir ); protected: //Curl object to facilitate posts to server diff --git a/indra/newview/llsurface.cpp b/indra/newview/llsurface.cpp index 66df7dae3ed5332c9ea2f4fcc35542496d5f425c..65393cc168f13aaf85f944dc45af660838fff385 100644 --- a/indra/newview/llsurface.cpp +++ b/indra/newview/llsurface.cpp @@ -346,6 +346,19 @@ void LLSurface::getNeighboringRegions( std::vector<LLViewerRegion*>& uniqueRegio } } + +void LLSurface::getNeighboringRegionsStatus( std::vector<S32>& regions ) +{ + S32 i; + for (i = 0; i < 8; i++) + { + if ( mNeighbors[i] != NULL ) + { + regions.push_back( i ); + } + } +} + void LLSurface::connectNeighbor(LLSurface *neighborp, U32 direction) { S32 i; diff --git a/indra/newview/llsurface.h b/indra/newview/llsurface.h index a4ef4fe2de61a00e7dfa9d9d2a2a8f288cd2b510..8052fb0d18d7b7b579a02ae47b23392987a5398f 100644 --- a/indra/newview/llsurface.h +++ b/indra/newview/llsurface.h @@ -142,6 +142,7 @@ class LLSurface friend std::ostream& operator<<(std::ostream &s, const LLSurface &S); void getNeighboringRegions( std::vector<LLViewerRegion*>& uniqueRegions ); + void getNeighboringRegionsStatus( std::vector<S32>& regions ); public: // Number of grid points on one side of a region, including +1 buffer for diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 800e394b16cbfad11c06da83d69b6c337ad3286b..cc4cac4202add353808052df930817a6f0b93677 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1796,7 +1796,10 @@ void LLViewerRegion::getNeighboringRegions( std::vector<LLViewerRegion*>& unique { mImpl->mLandp->getNeighboringRegions( uniqueRegions ); } - +void LLViewerRegion::getNeighboringRegionsStatus( std::vector<S32>& regions ) +{ + mImpl->mLandp->getNeighboringRegionsStatus( regions ); +} void LLViewerRegion::showReleaseNotes() { std::string url = this->getCapability("ServerReleaseNotes"); diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index c483c6ef5294a5fc99ee29315bc12d1c069039ea..6004165b0e39b91c3373cbb17d9f660373bcca95 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -325,6 +325,7 @@ class LLViewerRegion: public LLCapabilityProvider // implements this interface bool objectsCrossParcel(const std::vector<LLBBox>& boxes) const; void getNeighboringRegions( std::vector<LLViewerRegion*>& uniqueRegions ); + void getNeighboringRegionsStatus( std::vector<S32>& regions ); public: struct CompareDistance