From 63c5dacdd07a93cbb3455c453746aee09a5b5aa7 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 5 Nov 2014 15:12:42 -0800 Subject: [PATCH] final changes to use new hash from LimitedNodeList --- interface/src/ui/NodeBounds.cpp | 7 +++++-- interface/src/ui/OctreeStatsDialog.cpp | 6 ++++-- interface/src/ui/Stats.cpp | 7 +++++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/interface/src/ui/NodeBounds.cpp b/interface/src/ui/NodeBounds.cpp index 49509cc9cf..6298385c90 100644 --- a/interface/src/ui/NodeBounds.cpp +++ b/interface/src/ui/NodeBounds.cpp @@ -53,8 +53,11 @@ void NodeBounds::draw() { float selectedScale = 0; NodeList* nodeList = NodeList::getInstance(); - - foreach (const SharedNodePointer& node, nodeList->getNodeHash()) { + NodeHashSnapshot snapshotHash = nodeList->getNodeHash().snapshot_table(); + + for (auto it = snapshotHash.begin(); it != snapshotHash.end(); it++) { + SharedNodePointer node = it->second; + NodeType_t nodeType = node->getType(); if (nodeType == NodeType::VoxelServer && _showVoxelNodes) { diff --git a/interface/src/ui/OctreeStatsDialog.cpp b/interface/src/ui/OctreeStatsDialog.cpp index e51b9b1f42..8a6d6442f5 100644 --- a/interface/src/ui/OctreeStatsDialog.cpp +++ b/interface/src/ui/OctreeStatsDialog.cpp @@ -248,8 +248,10 @@ void OctreeStatsDialog::showOctreeServersOfType(int& serverCount, NodeType_t ser QLocale locale(QLocale::English); NodeList* nodeList = NodeList::getInstance(); - - foreach (const SharedNodePointer& node, nodeList->getNodeHash()) { + NodeHashSnapshot snapshotHash = nodeList->getNodeHash().snapshot_table(); + + for (auto it = snapshotHash.begin(); it != snapshotHash.end(); it++) { + SharedNodePointer node = it->second; // only send to the NodeTypes that are NodeType_t_VOXEL_SERVER if (node->getType() == serverType) { serverCount++; diff --git a/interface/src/ui/Stats.cpp b/interface/src/ui/Stats.cpp index 9bad475838..8e4b900180 100644 --- a/interface/src/ui/Stats.cpp +++ b/interface/src/ui/Stats.cpp @@ -328,8 +328,11 @@ void Stats::display( // Now handle voxel servers, since there could be more than one, we average their ping times unsigned long totalPingVoxel = 0; int voxelServerCount = 0; - - foreach (const SharedNodePointer& node, nodeList->getNodeHash()) { + + NodeHashSnapshot snapshotHash = nodeList->getNodeHash().snapshot_table(); + + for (auto it = snapshotHash.begin(); it != snapshotHash.end(); it++) { + SharedNodePointer node = it->second; // TODO: this should also support entities if (node->getType() == NodeType::VoxelServer) { totalPingVoxel += node->getPingMs();