aboutsummaryrefslogtreecommitdiff
path: root/src/environment.cpp
diff options
context:
space:
mode:
authorLoic Blot <loic.blot@unix-experience.fr>2015-04-16 14:11:46 +0200
committerLoic Blot <loic.blot@unix-experience.fr>2015-04-16 18:37:29 +0200
commit0c634a97197d50f2ca58825f1b215d0407397ac6 (patch)
treee2fc66d28fdf255ac931c08d2ed17a5504cd5b53 /src/environment.cpp
parentd02300a749ee35ba195e4e50c6464832302a387b (diff)
downloadminetest-0c634a97197d50f2ca58825f1b215d0407397ac6.tar.gz
minetest-0c634a97197d50f2ca58825f1b215d0407397ac6.tar.bz2
minetest-0c634a97197d50f2ca58825f1b215d0407397ac6.zip
Use std::vector instead of std::set for Environment::getObjectsInsideRadius
We are only iterating sequentially, we don't need a set here Also use a vector reference instead of a copy
Diffstat (limited to 'src/environment.cpp')
-rw-r--r--src/environment.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/environment.cpp b/src/environment.cpp
index af213e5e2..8ade7fe05 100644
--- a/src/environment.cpp
+++ b/src/environment.cpp
@@ -840,9 +840,8 @@ bool ServerEnvironment::swapNode(v3s16 p, const MapNode &n)
return true;
}
-std::set<u16> ServerEnvironment::getObjectsInsideRadius(v3f pos, float radius)
+void ServerEnvironment::getObjectsInsideRadius(std::vector<u16> &objects, v3f pos, float radius)
{
- std::set<u16> objects;
for(std::map<u16, ServerActiveObject*>::iterator
i = m_active_objects.begin();
i != m_active_objects.end(); ++i)
@@ -852,9 +851,8 @@ std::set<u16> ServerEnvironment::getObjectsInsideRadius(v3f pos, float radius)
v3f objectpos = obj->getBasePosition();
if(objectpos.getDistanceFrom(pos) > radius)
continue;
- objects.insert(id);
+ objects.push_back(id);
}
- return objects;
}
void ServerEnvironment::clearAllObjects()