From ce1f95bade2eeec5732d3275bb54fd1612ab03fb Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 4 Jan 2012 21:06:54 -0700 Subject: trivial: debug code for SH-2828: [crashhunters] Crash in LLRefCount::unref(), bad stacks --- indra/newview/llviewerwindow.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 31dfa1923c..29f951da93 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1956,33 +1956,42 @@ void LLViewerWindow::shutdownViews() // clean up warning logger LLError::removeRecorder(RecordToChatConsole::getInstance()); + llinfos << "Warning logger is cleaned." << llendl ; + delete mDebugText; mDebugText = NULL; + llinfos << "DebugText deleted." << llendl ; + // Cleanup global views if (gMorphView) { gMorphView->setVisible(FALSE); } + llinfos << "Global views cleaned." << llendl ; // DEV-40930: Clear sModalStack. Otherwise, any LLModalDialog left open // will crump with LL_ERRS. LLModalDialog::shutdownModals(); - + llinfos << "LLModalDialog shut down." << llendl; + // destroy the nav bar, not currently part of gViewerWindow // *TODO: Make LLNavigationBar part of gViewerWindow if (LLNavigationBar::instanceExists()) { delete LLNavigationBar::getInstance(); } + llinfos << "LLNavigationBar destroyed." << llendl ; // destroy menus after instantiating navbar above, as it needs // access to gMenuHolder cleanup_menus(); + llinfos << "menus destroyed." << llendl ; // Delete all child views. delete mRootView; mRootView = NULL; + llinfos << "RootView deleted." << llendl ; // Automatically deleted as children of mRootView. Fix the globals. gStatusBar = NULL; -- cgit v1.2.3 From 141089327649f9b89be4ac9cc2b50f56eee62a48 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 5 Jan 2012 21:26:06 -0700 Subject: fix for SH-2829: [crashhunters] Crash in LLWearable::importFile()/LLOverrideBakedTextureUpdate::LLOverrideBakedTextureUpdate() --- indra/newview/llagentwearablesfetch.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp index 1edc96e165..4097ff707c 100644 --- a/indra/newview/llagentwearablesfetch.cpp +++ b/indra/newview/llagentwearablesfetch.cpp @@ -111,6 +111,12 @@ void LLInitialWearablesFetch::add(InitialWearableData &data) void LLInitialWearablesFetch::processContents() { + if(!gAgentAvatarp) //no need to process wearables if the agent avatar is deleted. + { + delete this; + return ; + } + // Fetch the wearable items from the Current Outfit Folder LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t wearable_array; -- cgit v1.2.3 From f082de03ff24ae8cc6a2de103bc643c392135742 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 12 Jan 2012 16:36:56 -0700 Subject: fix for SH-2845, SH-2846, SH-2847, SH-2851: curl crashes and out-of-memory crashes. --- indra/newview/llmeshrepository.cpp | 131 ++++++++++++++++++++++------------ indra/newview/llmeshrepository.h | 4 +- indra/newview/llxmlrpctransaction.cpp | 19 +++++ 3 files changed, 107 insertions(+), 47 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index a97e256c89..c64479f589 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -498,9 +498,11 @@ void LLMeshRepoThread::run() LODRequest req = mLODReqQ.front(); mLODReqQ.pop(); mMutex->unlock(); - if (fetchMeshLOD(req.mMeshParams, req.mLOD)) + if (!fetchMeshLOD(req.mMeshParams, req.mLOD, count))//failed, resubmit { - count++; + mMutex->lock(); + mLODReqQ.push(req) ; + mMutex->unlock(); } } } @@ -512,9 +514,11 @@ void LLMeshRepoThread::run() HeaderRequest req = mHeaderReqQ.front(); mHeaderReqQ.pop(); mMutex->unlock(); - if (fetchMeshHeader(req.mMeshParams)) + if (!fetchMeshHeader(req.mMeshParams, count))//failed, resubmit { - count++; + mMutex->lock(); + mHeaderReqQ.push(req) ; + mMutex->unlock(); } } } @@ -658,6 +662,7 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id) return false; } + bool ret = true ; U32 header_size = mMeshHeaderSize[mesh_id]; if (header_size > 0) @@ -673,7 +678,7 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id) //check VFS for mesh skin info LLVFile file(gVFS, mesh_id, LLAssetType::AT_MESH); if (file.getSize() >= offset+size) - { + { LLMeshRepository::sCacheBytesRead += size; file.seek(offset); U8* buffer = new U8[size]; @@ -689,7 +694,7 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id) if (!zero) { //attempt to parse if (skinInfoReceived(mesh_id, buffer, size)) - { + { delete[] buffer; return true; } @@ -704,11 +709,14 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id) std::string http_url = constructUrl(mesh_id); if (!http_url.empty()) - { - ++sActiveLODRequests; - LLMeshRepository::sHTTPRequestCount++; - mCurlRequest->getByteRange(constructUrl(mesh_id), headers, offset, size, + { + ret = mCurlRequest->getByteRange(http_url, headers, offset, size, new LLMeshSkinInfoResponder(mesh_id, offset, size)); + if(ret) + { + ++sActiveLODRequests; + LLMeshRepository::sHTTPRequestCount++; + } } } } @@ -718,7 +726,7 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id) } //early out was not hit, effectively fetched - return true; + return ret; } bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id) @@ -732,7 +740,8 @@ bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id) } U32 header_size = mMeshHeaderSize[mesh_id]; - + bool ret = true ; + if (header_size > 0) { S32 version = mMeshHeader[mesh_id]["version"].asInteger(); @@ -748,6 +757,7 @@ bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id) if (file.getSize() >= offset+size) { LLMeshRepository::sCacheBytesRead += size; + file.seek(offset); U8* buffer = new U8[size]; file.read(buffer, size); @@ -777,11 +787,14 @@ bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id) std::string http_url = constructUrl(mesh_id); if (!http_url.empty()) - { - ++sActiveLODRequests; - LLMeshRepository::sHTTPRequestCount++; - mCurlRequest->getByteRange(http_url, headers, offset, size, + { + ret = mCurlRequest->getByteRange(http_url, headers, offset, size, new LLMeshDecompositionResponder(mesh_id, offset, size)); + if(ret) + { + ++sActiveLODRequests; + LLMeshRepository::sHTTPRequestCount++; + } } } } @@ -791,7 +804,7 @@ bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id) } //early out was not hit, effectively fetched - return true; + return ret; } bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id) @@ -805,6 +818,7 @@ bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id) } U32 header_size = mMeshHeaderSize[mesh_id]; + bool ret = true ; if (header_size > 0) { @@ -850,11 +864,15 @@ bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id) std::string http_url = constructUrl(mesh_id); if (!http_url.empty()) - { - ++sActiveLODRequests; - LLMeshRepository::sHTTPRequestCount++; - mCurlRequest->getByteRange(http_url, headers, offset, size, + { + ret = mCurlRequest->getByteRange(http_url, headers, offset, size, new LLMeshPhysicsShapeResponder(mesh_id, offset, size)); + + if(ret) + { + ++sActiveLODRequests; + LLMeshRepository::sHTTPRequestCount++; + } } } else @@ -868,13 +886,12 @@ bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id) } //early out was not hit, effectively fetched - return true; + return ret; } -bool LLMeshRepoThread::fetchMeshHeader(const LLVolumeParams& mesh_params) +//return false if failed to get header +bool LLMeshRepoThread::fetchMeshHeader(const LLVolumeParams& mesh_params, U32& count) { - bool retval = false; - { //look for mesh in asset in vfs LLVFile file(gVFS, mesh_params.getSculptID(), LLAssetType::AT_MESH); @@ -889,36 +906,40 @@ bool LLMeshRepoThread::fetchMeshHeader(const LLVolumeParams& mesh_params) file.read(buffer, bytes); if (headerReceived(mesh_params, buffer, bytes)) { //did not do an HTTP request, return false - return false; + return true; } } } - //either cache entry doesn't exist or is corrupt, request header from simulator - + //either cache entry doesn't exist or is corrupt, request header from simulator + bool retval = true ; std::vector headers; headers.push_back("Accept: application/octet-stream"); std::string http_url = constructUrl(mesh_params.getSculptID()); if (!http_url.empty()) { - ++sActiveHeaderRequests; - retval = true; //grab first 4KB if we're going to bother with a fetch. Cache will prevent future fetches if a full mesh fits //within the first 4KB - //NOTE -- this will break of headers ever exceed 4KB - LLMeshRepository::sHTTPRequestCount++; - mCurlRequest->getByteRange(http_url, headers, 0, 4096, new LLMeshHeaderResponder(mesh_params)); + //NOTE -- this will break of headers ever exceed 4KB + retval = mCurlRequest->getByteRange(http_url, headers, 0, 4096, new LLMeshHeaderResponder(mesh_params)); + if(retval) + { + ++sActiveHeaderRequests; + LLMeshRepository::sHTTPRequestCount++; + } + count++; } return retval; } -bool LLMeshRepoThread::fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod) +//return false if failed to get mesh lod. +bool LLMeshRepoThread::fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod, U32& count) { //protected by mMutex mHeaderMutex->lock(); - bool retval = false; + bool retval = true; LLUUID mesh_id = mesh_params.getSculptID(); @@ -955,7 +976,7 @@ bool LLMeshRepoThread::fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod) if (lodReceived(mesh_params, lod, buffer, size)) { delete[] buffer; - return false; + return true; } } @@ -968,12 +989,16 @@ bool LLMeshRepoThread::fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod) std::string http_url = constructUrl(mesh_id); if (!http_url.empty()) - { - ++sActiveLODRequests; - retval = true; - LLMeshRepository::sHTTPRequestCount++; - mCurlRequest->getByteRange(constructUrl(mesh_id), headers, offset, size, + { + retval = mCurlRequest->getByteRange(constructUrl(mesh_id), headers, offset, size, new LLMeshLODResponder(mesh_params, lod, offset, size)); + + if(retval) + { + ++sActiveLODRequests; + LLMeshRepository::sHTTPRequestCount++; + } + count++; } else { @@ -1540,8 +1565,17 @@ void LLMeshUploadThread::doWholeModelUpload() LLSD body = full_model_data["asset_resources"]; dump_llsd_to_file(body,make_dump_name("whole_model_body_",dump_num)); LLCurlRequest::headers_t headers; - mCurlRequest->post(mWholeModelUploadURL, headers, body, - new LLWholeModelUploadResponder(this, full_model_data, mUploadObserverHandle), mMeshUploadTimeOut); + + { + LLCurl::ResponderPtr responder = new LLWholeModelUploadResponder(this, full_model_data, mUploadObserverHandle) ; + + while(!mCurlRequest->post(mWholeModelUploadURL, headers, body, responder, mMeshUploadTimeOut)) + { + //sleep for 10ms to prevent eating a whole core + apr_sleep(10000); + } + } + do { mCurlRequest->process(); @@ -1571,8 +1605,15 @@ void LLMeshUploadThread::requestWholeModelFee() mPendingUploads++; LLCurlRequest::headers_t headers; - mCurlRequest->post(mWholeModelFeeCapability, headers, model_data, - new LLWholeModelFeeResponder(this,model_data, mFeeObserverHandle), mMeshUploadTimeOut); + + { + LLCurl::ResponderPtr responder = new LLWholeModelFeeResponder(this,model_data, mFeeObserverHandle) ; + while(!mCurlRequest->post(mWholeModelFeeCapability, headers, model_data, responder, mMeshUploadTimeOut)) + { + //sleep for 10ms to prevent eating a whole core + apr_sleep(10000); + } + } do { diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index 31b84ea0d9..2efe810438 100644 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -323,8 +323,8 @@ public: virtual void run(); void loadMeshLOD(const LLVolumeParams& mesh_params, S32 lod); - bool fetchMeshHeader(const LLVolumeParams& mesh_params); - bool fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod); + bool fetchMeshHeader(const LLVolumeParams& mesh_params, U32& count); + bool fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod, U32& count); bool headerReceived(const LLVolumeParams& mesh_params, U8* data, S32 data_size); bool lodReceived(const LLVolumeParams& mesh_params, S32 lod, U8* data, S32 data_size); bool skinInfoReceived(const LLUUID& mesh_id, U8* data, S32 data_size); diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp index 920a9a3752..0da70d398b 100644 --- a/indra/newview/llxmlrpctransaction.cpp +++ b/indra/newview/llxmlrpctransaction.cpp @@ -305,6 +305,15 @@ void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip) { mCurlRequest = new LLCurlEasyRequest(); } + if(!mCurlRequest->isValid()) + { + llwarns << "mCurlRequest is invalid." << llendl ; + + delete mCurlRequest ; + mCurlRequest = NULL ; + return ; + } + mErrorCert = NULL; // mCurlRequest->setopt(CURLOPT_VERBOSE, 1); // useful for debugging @@ -357,10 +366,20 @@ LLXMLRPCTransaction::Impl::~Impl() } delete mCurlRequest; + mCurlRequest = NULL ; } bool LLXMLRPCTransaction::Impl::process() { + if(!mCurlRequest || !mCurlRequest->isValid()) + { + llwarns << "transaction failed." << llendl ; + + delete mCurlRequest ; + mCurlRequest = NULL ; + return true ; //failed, quit. + } + switch(mStatus) { case LLXMLRPCTransaction::StatusComplete: -- cgit v1.2.3 From 717a6f3306d9382ea252c3e0f243b785c9cae15a Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 25 Jan 2012 18:27:40 -0700 Subject: Introduce two new parameters "CurlUseMultipleThreads" and "CurlRequestTimeOut" for QA to test Curl. --- indra/newview/app_settings/settings.xml | 22 ++++++++++++++++++++++ indra/newview/llappviewer.cpp | 4 +++- 2 files changed, 25 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 1ea623791d..a29d5d2985 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1828,6 +1828,28 @@ Value 0 + CurlMaximumNumberOfHandles + + Comment + Maximum number of handles curl can use (requires restart) + Persist + 1 + Type + S32 + Value + 256 + + CurlRequestTimeOut + + Comment + Max idle time of a curl request before killed (requires restart) + Persist + 1 + Type + F32 + Value + 120.0 + CurlUseMultipleThreads Comment diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 40136adbc9..4fc306e61d 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -720,7 +720,9 @@ bool LLAppViewer::init() // *NOTE:Mani - LLCurl::initClass is not thread safe. // Called before threads are created. - LLCurl::initClass(gSavedSettings.getBOOL("CurlUseMultipleThreads")); + LLCurl::initClass(gSavedSettings.getF32("CurlRequestTimeOut"), + gSavedSettings.getS32("CurlMaximumNumberOfHandles"), + gSavedSettings.getBOOL("CurlUseMultipleThreads")); LL_INFOS("InitInfo") << "LLCurl initialized." << LL_ENDL ; LLMachineID::init(); -- cgit v1.2.3 From b5a1d08347a88736a67e0dc0e0e6069952be7e7a Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 30 Jan 2012 12:24:31 -0800 Subject: PATH-187: Resolving an issue where in a particular scenario the edit fields were not being disabled when nothing was selected. --- indra/newview/llfloaterpathfindinglinksets.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp index 571c4a8427..3edb4e5c73 100644 --- a/indra/newview/llfloaterpathfindinglinksets.cpp +++ b/indra/newview/llfloaterpathfindinglinksets.cpp @@ -372,6 +372,7 @@ void LLFloaterPathfindingLinksets::setMessagingState(EMessagingState pMessagingS { mMessagingState = pMessagingState; updateLinksetsStatusMessage(); + updateEditFields(); } void LLFloaterPathfindingLinksets::onApplyFiltersClicked() @@ -524,6 +525,7 @@ void LLFloaterPathfindingLinksets::updateLinksetsList() mLinksetsScrollList->selectMultiple(selectedUUIDs); updateLinksetsStatusMessage(); + updateEditFields(); } void LLFloaterPathfindingLinksets::selectAllLinksets() -- cgit v1.2.3 From de6ae690b5315307b59b1a2ac722700c3839e4ba Mon Sep 17 00:00:00 2001 From: Todd Stinson Date: Mon, 30 Jan 2012 16:33:41 -0800 Subject: PATH-187: Consolidating field names for the cap service into local defines. --- indra/newview/llfilteredpathfindinglinksets.cpp | 24 ++-- indra/newview/llfilteredpathfindinglinksets.h | 6 +- indra/newview/llfloaterpathfindinglinksets.cpp | 2 +- indra/newview/llpathfindinglinkset.cpp | 158 +++++++++++++----------- indra/newview/llpathfindinglinkset.h | 4 +- 5 files changed, 103 insertions(+), 91 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfilteredpathfindinglinksets.cpp b/indra/newview/llfilteredpathfindinglinksets.cpp index c956a5752b..aaff2bcc68 100644 --- a/indra/newview/llfilteredpathfindinglinksets.cpp +++ b/indra/newview/llfilteredpathfindinglinksets.cpp @@ -122,7 +122,7 @@ LLFilteredPathfindingLinksets::LLFilteredPathfindingLinksets() { } -LLFilteredPathfindingLinksets::LLFilteredPathfindingLinksets(const LLSD& pNavMeshData) +LLFilteredPathfindingLinksets::LLFilteredPathfindingLinksets(const LLSD& pLinksetItems) : mAllLinksets(), mFilteredLinksets(), mIsFiltersDirty(false), @@ -132,7 +132,7 @@ LLFilteredPathfindingLinksets::LLFilteredPathfindingLinksets(const LLSD& pNavMes mIsObstacleFilter(true), mIsIgnoredFilter(true) { - setPathfindingLinksets(pNavMeshData); + setPathfindingLinksets(pLinksetItems); } LLFilteredPathfindingLinksets::LLFilteredPathfindingLinksets(const LLFilteredPathfindingLinksets& pOther) @@ -152,15 +152,15 @@ LLFilteredPathfindingLinksets::~LLFilteredPathfindingLinksets() clearPathfindingLinksets(); } -void LLFilteredPathfindingLinksets::setPathfindingLinksets(const LLSD& pNavMeshData) +void LLFilteredPathfindingLinksets::setPathfindingLinksets(const LLSD& pLinksetItems) { clearPathfindingLinksets(); - for (LLSD::map_const_iterator navMeshDataIter = pNavMeshData.beginMap(); - navMeshDataIter != pNavMeshData.endMap(); ++navMeshDataIter) + for (LLSD::map_const_iterator linksetItemIter = pLinksetItems.beginMap(); + linksetItemIter != pLinksetItems.endMap(); ++linksetItemIter) { - const std::string& uuid(navMeshDataIter->first); - const LLSD& linksetData = navMeshDataIter->second; + const std::string& uuid(linksetItemIter->first); + const LLSD& linksetData = linksetItemIter->second; LLPathfindingLinkset linkset(uuid, linksetData); mAllLinksets.insert(std::pair(uuid, linkset)); @@ -169,13 +169,13 @@ void LLFilteredPathfindingLinksets::setPathfindingLinksets(const LLSD& pNavMeshD mIsFiltersDirty = true; } -void LLFilteredPathfindingLinksets::updatePathfindingLinksets(const LLSD& pNavMeshData) +void LLFilteredPathfindingLinksets::updatePathfindingLinksets(const LLSD& pLinksetItems) { - for (LLSD::map_const_iterator navMeshDataIter = pNavMeshData.beginMap(); - navMeshDataIter != pNavMeshData.endMap(); ++navMeshDataIter) + for (LLSD::map_const_iterator linksetItemIter = pLinksetItems.beginMap(); + linksetItemIter != pLinksetItems.endMap(); ++linksetItemIter) { - const std::string& uuid(navMeshDataIter->first); - const LLSD& linksetData = navMeshDataIter->second; + const std::string& uuid(linksetItemIter->first); + const LLSD& linksetData = linksetItemIter->second; LLPathfindingLinkset linkset(uuid, linksetData); PathfindingLinksetMap::iterator linksetIter = mAllLinksets.find(uuid); diff --git a/indra/newview/llfilteredpathfindinglinksets.h b/indra/newview/llfilteredpathfindinglinksets.h index afd2b2b01d..de9b3a5e15 100644 --- a/indra/newview/llfilteredpathfindinglinksets.h +++ b/indra/newview/llfilteredpathfindinglinksets.h @@ -61,12 +61,12 @@ public: typedef std::map PathfindingLinksetMap; LLFilteredPathfindingLinksets(); - LLFilteredPathfindingLinksets(const LLSD& pNavMeshData); + LLFilteredPathfindingLinksets(const LLSD& pLinksetItems); LLFilteredPathfindingLinksets(const LLFilteredPathfindingLinksets& pOther); virtual ~LLFilteredPathfindingLinksets(); - void setPathfindingLinksets(const LLSD& pNavMeshData); - void updatePathfindingLinksets(const LLSD& pNavMeshData); + void setPathfindingLinksets(const LLSD& pLinksetItems); + void updatePathfindingLinksets(const LLSD& pLinksetItems); void clearPathfindingLinksets(); const PathfindingLinksetMap& getAllLinksets() const; diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp index 3edb4e5c73..4d3581fc60 100644 --- a/indra/newview/llfloaterpathfindinglinksets.cpp +++ b/indra/newview/llfloaterpathfindinglinksets.cpp @@ -672,7 +672,7 @@ void LLFloaterPathfindingLinksets::applyEditFields() const LLFilteredPathfindingLinksets::PathfindingLinksetMap::const_iterator linksetIter = linksetsMap.find(uuid.asString()); const LLPathfindingLinkset &linkset = linksetIter->second; - LLSD itemData = linkset.getAlteredFields(pathState, aValue, bValue, cValue, dValue, isPhantom); + LLSD itemData = linkset.encodeAlteredFields(pathState, aValue, bValue, cValue, dValue, isPhantom); if (!itemData.isUndefined()) { diff --git a/indra/newview/llpathfindinglinkset.cpp b/indra/newview/llpathfindinglinkset.cpp index bfe851d8ee..daa308f862 100644 --- a/indra/newview/llpathfindinglinkset.cpp +++ b/indra/newview/llpathfindinglinkset.cpp @@ -31,6 +31,18 @@ #include "v3math.h" #include "lluuid.h" +#define LINKSET_NAME_FIELD "name" +#define LINKSET_DESCRIPTION_FIELD "description" +#define LINKSET_LAND_IMPACT_FIELD "landimpact" +#define LINKSET_PERMANENT_FIELD "permanent" +#define LINKSET_WALKABLE_FIELD "walkable" +#define LINKSET_PHANTOM_FIELD "phantom" +#define LINKSET_WALKABILITY_A_FIELD "A" +#define LINKSET_WALKABILITY_B_FIELD "B" +#define LINKSET_WALKABILITY_C_FIELD "C" +#define LINKSET_WALKABILITY_D_FIELD "D" +#define LINKSET_POSITION_FIELD "position" + //--------------------------------------------------------------------------- // LLPathfindingLinkset //--------------------------------------------------------------------------- @@ -38,7 +50,7 @@ const S32 LLPathfindingLinkset::MIN_WALKABILITY_VALUE(0); const S32 LLPathfindingLinkset::MAX_WALKABILITY_VALUE(100); -LLPathfindingLinkset::LLPathfindingLinkset(const std::string &pUUID, const LLSD& pNavMeshItem) +LLPathfindingLinkset::LLPathfindingLinkset(const std::string &pUUID, const LLSD& pLinksetItem) : mUUID(pUUID), mName(), mDescription(), @@ -54,107 +66,107 @@ LLPathfindingLinkset::LLPathfindingLinkset(const std::string &pUUID, const LLSD& mWalkabilityCoefficientC(MIN_WALKABILITY_VALUE), mWalkabilityCoefficientD(MIN_WALKABILITY_VALUE) { - llassert(pNavMeshItem.has("name")); - llassert(pNavMeshItem.get("name").isString()); - mName = pNavMeshItem.get("name").asString(); + llassert(pLinksetItem.has(LINKSET_NAME_FIELD)); + llassert(pLinksetItem.get(LINKSET_NAME_FIELD).isString()); + mName = pLinksetItem.get(LINKSET_NAME_FIELD).asString(); - llassert(pNavMeshItem.has("description")); - llassert(pNavMeshItem.get("description").isString()); - mDescription = pNavMeshItem.get("description").asString(); + llassert(pLinksetItem.has(LINKSET_DESCRIPTION_FIELD)); + llassert(pLinksetItem.get(LINKSET_DESCRIPTION_FIELD).isString()); + mDescription = pLinksetItem.get(LINKSET_DESCRIPTION_FIELD).asString(); - llassert(pNavMeshItem.has("landimpact")); - llassert(pNavMeshItem.get("landimpact").isInteger()); - llassert(pNavMeshItem.get("landimpact").asInteger() >= 0); - mLandImpact = pNavMeshItem.get("landimpact").asInteger(); + llassert(pLinksetItem.has(LINKSET_LAND_IMPACT_FIELD)); + llassert(pLinksetItem.get(LINKSET_LAND_IMPACT_FIELD).isInteger()); + llassert(pLinksetItem.get(LINKSET_LAND_IMPACT_FIELD).asInteger() >= 0); + mLandImpact = pLinksetItem.get(LINKSET_LAND_IMPACT_FIELD).asInteger(); - llassert(pNavMeshItem.has("permanent")); - llassert(pNavMeshItem.get("permanent").isBoolean()); - bool isPermanent = pNavMeshItem.get("permanent").asBoolean(); + llassert(pLinksetItem.has(LINKSET_PERMANENT_FIELD)); + llassert(pLinksetItem.get(LINKSET_PERMANENT_FIELD).isBoolean()); + bool isPermanent = pLinksetItem.get(LINKSET_PERMANENT_FIELD).asBoolean(); - llassert(pNavMeshItem.has("walkable")); - llassert(pNavMeshItem.get("walkable").isBoolean()); - bool isWalkable = pNavMeshItem.get("walkable").asBoolean(); + llassert(pLinksetItem.has(LINKSET_WALKABLE_FIELD)); + llassert(pLinksetItem.get(LINKSET_WALKABLE_FIELD).isBoolean()); + bool isWalkable = pLinksetItem.get(LINKSET_WALKABLE_FIELD).asBoolean(); mPathState = getPathState(isPermanent, isWalkable); - llassert(pNavMeshItem.has("phantom")); - llassert(pNavMeshItem.get("phantom").isBoolean()); - mIsPhantom = pNavMeshItem.get("phantom").asBoolean(); + llassert(pLinksetItem.has(LINKSET_PHANTOM_FIELD)); + llassert(pLinksetItem.get(LINKSET_PHANTOM_FIELD).isBoolean()); + mIsPhantom = pLinksetItem.get(LINKSET_PHANTOM_FIELD).asBoolean(); - llassert(pNavMeshItem.has("A")); + llassert(pLinksetItem.has(LINKSET_WALKABILITY_A_FIELD)); #ifdef XXX_STINSON_WALKABILITY_COEFFICIENTS_TYPE_CHANGE - mIsWalkabilityCoefficientsF32 = pNavMeshItem.get("A").isReal(); + mIsWalkabilityCoefficientsF32 = pLinksetItem.get(LINKSET_WALKABILITY_A_FIELD).isReal(); if (mIsWalkabilityCoefficientsF32) { // Old server-side storage was real - mWalkabilityCoefficientA = llround(pNavMeshItem.get("A").asReal() * 100.0f); + mWalkabilityCoefficientA = llround(pLinksetItem.get(LINKSET_WALKABILITY_A_FIELD).asReal() * 100.0f); - llassert(pNavMeshItem.has("B")); - llassert(pNavMeshItem.get("B").isReal()); - mWalkabilityCoefficientB = llround(pNavMeshItem.get("B").asReal() * 100.0f); + llassert(pLinksetItem.has(LINKSET_WALKABILITY_B_FIELD)); + llassert(pLinksetItem.get(LINKSET_WALKABILITY_B_FIELD).isReal()); + mWalkabilityCoefficientB = llround(pLinksetItem.get(LINKSET_WALKABILITY_B_FIELD).asReal() * 100.0f); - llassert(pNavMeshItem.has("C")); - llassert(pNavMeshItem.get("C").isReal()); - mWalkabilityCoefficientC = llround(pNavMeshItem.get("C").asReal() * 100.0f); + llassert(pLinksetItem.has(LINKSET_WALKABILITY_C_FIELD)); + llassert(pLinksetItem.get(LINKSET_WALKABILITY_C_FIELD).isReal()); + mWalkabilityCoefficientC = llround(pLinksetItem.get(LINKSET_WALKABILITY_C_FIELD).asReal() * 100.0f); - llassert(pNavMeshItem.has("D")); - llassert(pNavMeshItem.get("D").isReal()); - mWalkabilityCoefficientD = llround(pNavMeshItem.get("D").asReal() * 100.0f); + llassert(pLinksetItem.has(LINKSET_WALKABILITY_D_FIELD)); + llassert(pLinksetItem.get(LINKSET_WALKABILITY_D_FIELD).isReal()); + mWalkabilityCoefficientD = llround(pLinksetItem.get(LINKSET_WALKABILITY_D_FIELD).asReal() * 100.0f); } else { // New server-side storage will be integer - llassert(pNavMeshItem.get("A").isInteger()); - mWalkabilityCoefficientA = pNavMeshItem.get("A").asInteger(); + llassert(pLinksetItem.get(LINKSET_WALKABILITY_A_FIELD).isInteger()); + mWalkabilityCoefficientA = pLinksetItem.get(LINKSET_WALKABILITY_A_FIELD).asInteger(); llassert(mWalkabilityCoefficientA >= MIN_WALKABILITY_VALUE); llassert(mWalkabilityCoefficientA <= MAX_WALKABILITY_VALUE); - llassert(pNavMeshItem.has("B")); - llassert(pNavMeshItem.get("B").isInteger()); - mWalkabilityCoefficientB = pNavMeshItem.get("B").asInteger(); + llassert(pLinksetItem.has(LINKSET_WALKABILITY_B_FIELD)); + llassert(pLinksetItem.get(LINKSET_WALKABILITY_B_FIELD).isInteger()); + mWalkabilityCoefficientB = pLinksetItem.get(LINKSET_WALKABILITY_B_FIELD).asInteger(); llassert(mWalkabilityCoefficientB >= MIN_WALKABILITY_VALUE); llassert(mWalkabilityCoefficientB <= MAX_WALKABILITY_VALUE); - llassert(pNavMeshItem.has("C")); - llassert(pNavMeshItem.get("C").isInteger()); - mWalkabilityCoefficientC = pNavMeshItem.get("C").asInteger(); + llassert(pLinksetItem.has(LINKSET_WALKABILITY_C_FIELD)); + llassert(pLinksetItem.get(LINKSET_WALKABILITY_C_FIELD).isInteger()); + mWalkabilityCoefficientC = pLinksetItem.get(LINKSET_WALKABILITY_C_FIELD).asInteger(); llassert(mWalkabilityCoefficientC >= MIN_WALKABILITY_VALUE); llassert(mWalkabilityCoefficientC <= MAX_WALKABILITY_VALUE); - llassert(pNavMeshItem.has("D")); - llassert(pNavMeshItem.get("D").isInteger()); - mWalkabilityCoefficientD = pNavMeshItem.get("D").asInteger(); + llassert(pLinksetItem.has(LINKSET_WALKABILITY_D_FIELD)); + llassert(pLinksetItem.get(LINKSET_WALKABILITY_D_FIELD).isInteger()); + mWalkabilityCoefficientD = pLinksetItem.get(LINKSET_WALKABILITY_D_FIELD).asInteger(); llassert(mWalkabilityCoefficientD >= MIN_WALKABILITY_VALUE); llassert(mWalkabilityCoefficientD <= MAX_WALKABILITY_VALUE); } #else // XXX_STINSON_WALKABILITY_COEFFICIENTS_TYPE_CHANGE - llassert(pNavMeshItem.get("A").isInteger()); - mWalkabilityCoefficientA = pNavMeshItem.get("A").asInteger(); + llassert(pLinksetItem.get(LINKSET_WALKABILITY_A_FIELD).isInteger()); + mWalkabilityCoefficientA = pLinksetItem.get(LINKSET_WALKABILITY_A_FIELD).asInteger(); llassert(mWalkabilityCoefficientA >= MIN_WALKABILITY_VALUE); llassert(mWalkabilityCoefficientA <= MAX_WALKABILITY_VALUE); - llassert(pNavMeshItem.has("B")); - llassert(pNavMeshItem.get("B").isInteger()); - mWalkabilityCoefficientB = pNavMeshItem.get("B").asInteger(); + llassert(pLinksetItem.has(LINKSET_WALKABILITY_B_FIELD)); + llassert(pLinksetItem.get(LINKSET_WALKABILITY_B_FIELD).isInteger()); + mWalkabilityCoefficientB = pLinksetItem.get(LINKSET_WALKABILITY_B_FIELD).asInteger(); llassert(mWalkabilityCoefficientB >= MIN_WALKABILITY_VALUE); llassert(mWalkabilityCoefficientB <= MAX_WALKABILITY_VALUE); - llassert(pNavMeshItem.has("C")); - llassert(pNavMeshItem.get("C").isInteger()); - mWalkabilityCoefficientC = pNavMeshItem.get("C").asInteger(); + llassert(pLinksetItem.has(LINKSET_WALKABILITY_C_FIELD)); + llassert(pLinksetItem.get(LINKSET_WALKABILITY_C_FIELD).isInteger()); + mWalkabilityCoefficientC = pLinksetItem.get(LINKSET_WALKABILITY_C_FIELD).asInteger(); llassert(mWalkabilityCoefficientC >= MIN_WALKABILITY_VALUE); llassert(mWalkabilityCoefficientC <= MAX_WALKABILITY_VALUE); - llassert(pNavMeshItem.has("D")); - llassert(pNavMeshItem.get("D").isInteger()); - mWalkabilityCoefficientD = pNavMeshItem.get("D").asInteger(); + llassert(pLinksetItem.has(LINKSET_WALKABILITY_D_FIELD)); + llassert(pLinksetItem.get(LINKSET_WALKABILITY_D_FIELD).isInteger()); + mWalkabilityCoefficientD = pLinksetItem.get(LINKSET_WALKABILITY_D_FIELD).asInteger(); llassert(mWalkabilityCoefficientD >= MIN_WALKABILITY_VALUE); llassert(mWalkabilityCoefficientD <= MAX_WALKABILITY_VALUE); #endif // XXX_STINSON_WALKABILITY_COEFFICIENTS_TYPE_CHANGE - llassert(pNavMeshItem.has("position")); - llassert(pNavMeshItem.get("position").isArray()); - mLocation.setValue(pNavMeshItem.get("position")); + llassert(pLinksetItem.has(LINKSET_POSITION_FIELD)); + llassert(pLinksetItem.get(LINKSET_POSITION_FIELD).isArray()); + mLocation.setValue(pLinksetItem.get(LINKSET_POSITION_FIELD)); } LLPathfindingLinkset::LLPathfindingLinkset(const LLPathfindingLinkset& pOther) @@ -269,75 +281,75 @@ void LLPathfindingLinkset::setWalkabilityCoefficientD(S32 pD) mWalkabilityCoefficientD = llclamp(pD, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE); } -LLSD LLPathfindingLinkset::getAlteredFields(EPathState pPathState, S32 pA, S32 pB, S32 pC, S32 pD, BOOL pIsPhantom) const +LLSD LLPathfindingLinkset::encodeAlteredFields(EPathState pPathState, S32 pA, S32 pB, S32 pC, S32 pD, BOOL pIsPhantom) const { LLSD itemData; if (mPathState != pPathState) { - itemData["permanent"] = static_cast(LLPathfindingLinkset::isPermanent(pPathState)); - itemData["walkable"] = static_cast(LLPathfindingLinkset::isWalkable(pPathState)); + itemData[LINKSET_PERMANENT_FIELD] = static_cast(LLPathfindingLinkset::isPermanent(pPathState)); + itemData[LINKSET_WALKABLE_FIELD] = static_cast(LLPathfindingLinkset::isWalkable(pPathState)); } #ifdef XXX_STINSON_WALKABILITY_COEFFICIENTS_TYPE_CHANGE if (mIsWalkabilityCoefficientsF32) { if (mWalkabilityCoefficientA != pA) { - itemData["A"] = llclamp(static_cast(pA) / 100.0f, 0.0f, 1.0f); + itemData[LINKSET_WALKABILITY_A_FIELD] = llclamp(static_cast(pA) / 100.0f, 0.0f, 1.0f); } if (mWalkabilityCoefficientB != pB) { - itemData["B"] = llclamp(static_cast(pB) / 100.0f, 0.0f, 1.0f); + itemData[LINKSET_WALKABILITY_B_FIELD] = llclamp(static_cast(pB) / 100.0f, 0.0f, 1.0f); } if (mWalkabilityCoefficientC != pC) { - itemData["C"] = llclamp(static_cast(pC) / 100.0f, 0.0f, 1.0f); + itemData[LINKSET_WALKABILITY_C_FIELD] = llclamp(static_cast(pC) / 100.0f, 0.0f, 1.0f); } if (mWalkabilityCoefficientD != pD) { - itemData["D"] = llclamp(static_cast(pD) / 100.0f, 0.0f, 1.0f); + itemData[LINKSET_WALKABILITY_D_FIELD] = llclamp(static_cast(pD) / 100.0f, 0.0f, 1.0f); } } else { if (mWalkabilityCoefficientA != pA) { - itemData["A"] = llclamp(pA, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE); + itemData[LINKSET_WALKABILITY_A_FIELD] = llclamp(pA, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE); } if (mWalkabilityCoefficientB != pB) { - itemData["B"] = llclamp(pB, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE); + itemData[LINKSET_WALKABILITY_B_FIELD] = llclamp(pB, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE); } if (mWalkabilityCoefficientC != pC) { - itemData["C"] = llclamp(pC, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE); + itemData[LINKSET_WALKABILITY_C_FIELD] = llclamp(pC, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE); } if (mWalkabilityCoefficientD != pD) { - itemData["D"] = llclamp(pD, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE); + itemData[LINKSET_WALKABILITY_D_FIELD] = llclamp(pD, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE); } } #else // XXX_STINSON_WALKABILITY_COEFFICIENTS_TYPE_CHANGE if (mWalkabilityCoefficientA != pA) { - itemData["A"] = llclamp(pA, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE); + itemData[LINKSET_WALKABILITY_A_FIELD] = llclamp(pA, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE); } if (mWalkabilityCoefficientB != pB) { - itemData["B"] = llclamp(pB, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE); + itemData[LINKSET_WALKABILITY_B_FIELD] = llclamp(pB, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE); } if (mWalkabilityCoefficientC != pC) { - itemData["C"] = llclamp(pC, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE); + itemData[LINKSET_WALKABILITY_C_FIELD] = llclamp(pC, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE); } if (mWalkabilityCoefficientD != pD) { - itemData["D"] = llclamp(pD, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE); + itemData[LINKSET_WALKABILITY_D_FIELD] = llclamp(pD, MIN_WALKABILITY_VALUE, MAX_WALKABILITY_VALUE); } #endif // XXX_STINSON_WALKABILITY_COEFFICIENTS_TYPE_CHANGE if (mIsPhantom != pIsPhantom) { - itemData["phantom"] = static_cast(pIsPhantom); + itemData[LINKSET_PHANTOM_FIELD] = static_cast(pIsPhantom); } return itemData; diff --git a/indra/newview/llpathfindinglinkset.h b/indra/newview/llpathfindinglinkset.h index c6165907d0..d4e58874eb 100644 --- a/indra/newview/llpathfindinglinkset.h +++ b/indra/newview/llpathfindinglinkset.h @@ -47,7 +47,7 @@ public: kIgnored } EPathState; - LLPathfindingLinkset(const std::string &pUUID, const LLSD &pNavMeshItem); + LLPathfindingLinkset(const std::string &pUUID, const LLSD &pLinksetItem); LLPathfindingLinkset(const LLPathfindingLinkset& pOther); virtual ~LLPathfindingLinkset(); @@ -81,7 +81,7 @@ public: inline S32 getWalkabilityCoefficientD() const {return mWalkabilityCoefficientD;}; void setWalkabilityCoefficientD(S32 pD); - LLSD getAlteredFields(EPathState pPathState, S32 pA, S32 pB, S32 pC, S32 pD, BOOL pIsPhantom) const; + LLSD encodeAlteredFields(EPathState pPathState, S32 pA, S32 pB, S32 pC, S32 pD, BOOL pIsPhantom) const; protected: -- cgit v1.2.3