summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llfloaterpathfindinglinksets.cpp39
-rw-r--r--indra/newview/llfloaterpathfindinglinksets.h3
2 files changed, 33 insertions, 9 deletions
diff --git a/indra/newview/llfloaterpathfindinglinksets.cpp b/indra/newview/llfloaterpathfindinglinksets.cpp
index e24703aca6..2b13d64937 100644
--- a/indra/newview/llfloaterpathfindinglinksets.cpp
+++ b/indra/newview/llfloaterpathfindinglinksets.cpp
@@ -383,7 +383,7 @@ PathfindingLinksets::PathfindingLinksets(const LLSD& pNavMeshData)
mIsFixedFilter(false),
mIsWalkableFilter(false)
{
- parseNavMeshData(pNavMeshData);
+ setNavMeshData(pNavMeshData);
}
PathfindingLinksets::PathfindingLinksets(const PathfindingLinksets& pOther)
@@ -402,15 +402,15 @@ PathfindingLinksets::~PathfindingLinksets()
clearLinksets();
}
-void PathfindingLinksets::parseNavMeshData(const LLSD& pNavMeshData)
+void PathfindingLinksets::setNavMeshData(const LLSD& pNavMeshData)
{
clearLinksets();
- for (LLSD::map_const_iterator linksetIter = pNavMeshData.beginMap();
- linksetIter != pNavMeshData.endMap(); ++linksetIter)
+ for (LLSD::map_const_iterator navMeshDataIter = pNavMeshData.beginMap();
+ navMeshDataIter != pNavMeshData.endMap(); ++navMeshDataIter)
{
- const std::string& uuid(linksetIter->first);
- const LLSD& linksetData = linksetIter->second;
+ const std::string& uuid(navMeshDataIter->first);
+ const LLSD& linksetData = navMeshDataIter->second;
PathfindingLinkset linkset(uuid, linksetData);
mAllLinksets.insert(std::pair<std::string, PathfindingLinkset>(uuid, linkset));
@@ -419,6 +419,29 @@ void PathfindingLinksets::parseNavMeshData(const LLSD& pNavMeshData)
mIsFiltersDirty = true;
}
+void PathfindingLinksets::updateNavMeshData(const LLSD& pNavMeshData)
+{
+ for (LLSD::map_const_iterator navMeshDataIter = pNavMeshData.beginMap();
+ navMeshDataIter != pNavMeshData.endMap(); ++navMeshDataIter)
+ {
+ const std::string& uuid(navMeshDataIter->first);
+ const LLSD& linksetData = navMeshDataIter->second;
+ PathfindingLinkset linkset(uuid, linksetData);
+
+ PathfindingLinksetMap::iterator linksetIter = mAllLinksets.find(uuid);
+ if (linksetIter == mAllLinksets.end())
+ {
+ mAllLinksets.insert(std::pair<std::string, PathfindingLinkset>(uuid, linkset));
+ }
+ else
+ {
+ linksetIter->second = linkset;
+ }
+ }
+
+ mIsFiltersDirty = true;
+}
+
void PathfindingLinksets::clearLinksets()
{
mAllLinksets.clear();
@@ -725,7 +748,7 @@ void LLFloaterPathfindingLinksets::sendNavMeshDataPutRequest(const LLSD& pPostDa
void LLFloaterPathfindingLinksets::handleNavMeshDataGetReply(const LLSD& pNavMeshData)
{
setFetchState(kFetchReceived);
- mPathfindingLinksets.parseNavMeshData(pNavMeshData);
+ mPathfindingLinksets.setNavMeshData(pNavMeshData);
updateLinksetsList();
setFetchState(kFetchComplete);
}
@@ -741,7 +764,7 @@ void LLFloaterPathfindingLinksets::handleNavMeshDataGetError(const std::string&
void LLFloaterPathfindingLinksets::handleNavMeshDataPutReply(const LLSD& pModifiedData)
{
setFetchState(kFetchReceived);
- mPathfindingLinksets.parseNavMeshData(pModifiedData);
+ mPathfindingLinksets.updateNavMeshData(pModifiedData);
updateLinksetsList();
setFetchState(kFetchComplete);
}
diff --git a/indra/newview/llfloaterpathfindinglinksets.h b/indra/newview/llfloaterpathfindinglinksets.h
index b1fd771219..81218dd8f2 100644
--- a/indra/newview/llfloaterpathfindinglinksets.h
+++ b/indra/newview/llfloaterpathfindinglinksets.h
@@ -124,7 +124,8 @@ public:
PathfindingLinksets(const PathfindingLinksets& pOther);
virtual ~PathfindingLinksets();
- void parseNavMeshData(const LLSD& pNavMeshData);
+ void setNavMeshData(const LLSD& pNavMeshData);
+ void updateNavMeshData(const LLSD& pNavMeshData);
void clearLinksets();
const PathfindingLinksetMap& getAllLinksets() const;