diff options
author | Loic Blot <loic.blot@unix-experience.fr> | 2015-04-16 14:11:46 +0200 |
---|---|---|
committer | Loic Blot <loic.blot@unix-experience.fr> | 2015-04-16 18:37:29 +0200 |
commit | 0c634a97197d50f2ca58825f1b215d0407397ac6 (patch) | |
tree | e2fc66d28fdf255ac931c08d2ed17a5504cd5b53 /src/script | |
parent | d02300a749ee35ba195e4e50c6464832302a387b (diff) | |
download | minetest-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/script')
-rw-r--r-- | src/script/lua_api/l_env.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp index 840c34595..0fe1ddec3 100644 --- a/src/script/lua_api/l_env.cpp +++ b/src/script/lua_api/l_env.cpp @@ -438,10 +438,11 @@ int ModApiEnvMod::l_get_objects_inside_radius(lua_State *L) // Do it v3f pos = checkFloatPos(L, 1); float radius = luaL_checknumber(L, 2) * BS; - std::set<u16> ids = env->getObjectsInsideRadius(pos, radius); + std::vector<u16> ids; + env->getObjectsInsideRadius(ids, pos, radius); ScriptApiBase *script = getScriptApiBase(L); lua_createtable(L, ids.size(), 0); - std::set<u16>::const_iterator iter = ids.begin(); + std::vector<u16>::const_iterator iter = ids.begin(); for(u32 i = 0; iter != ids.end(); iter++) { ServerActiveObject *obj = env->getActiveObject(*iter); // Insert object reference into table |