mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
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
This commit is contained in:
parent
d02300a749
commit
0c634a9719
4 changed files with 9 additions and 9 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue