minetest-0001: mg_ore.cpp c_wherein vector CONTAINS in voxel inner loop O(V*W) HIGH 3.3x minetest-0002: mg_decoration.cpp c_place_on/c_spawnby vector CONTAINS O(S*P) MEDIUM 1.8x minetest-0003: l_env.cpp find_node_near/find_nodes_in_area filter CONTAINS O(V*F) MEDIUM 1.6x minetest-0004: nodedef.cpp nodeboxConnects sorted vector linear scan O(N) MEDIUM 2.1x minetest-0005: blockmodifier.cpp ABM neighbor check sorted vector O(N) LOW-MEDIUM 1.5x MOAD-0002: g_settings global singleton (architectural, not patchable) MOAD-0003: thread_local log streams (properly scoped, not leaked context) MOAD-0004: CLEAN (no credential logging found) MOAD-0005: CLEAN (no unsynchronized cache patterns found)
62 lines
2 KiB
Diff
62 lines
2 KiB
Diff
# UNDF: UNDF-2026-000000939
|
|
--- a/src/mapgen/mg_decoration.h
|
|
+++ b/src/mapgen/mg_decoration.h
|
|
@@ -50,9 +50,9 @@ class Decoration : public ObjDef, public NodeResolver {
|
|
u32 flags = 0;
|
|
int mapseed = 0;
|
|
- std::vector<content_t> c_place_on;
|
|
+ std::unordered_set<content_t> c_place_on;
|
|
int check_offset = 0;
|
|
s16 sidelen = 2;
|
|
s16 y_min;
|
|
s16 y_max;
|
|
@@ -58,7 +58,7 @@ class Decoration : public ObjDef, public NodeResolver {
|
|
float fill_ratio = 0.0f;
|
|
NoiseParams np;
|
|
- std::vector<content_t> c_spawnby;
|
|
+ std::unordered_set<content_t> c_spawnby;
|
|
s16 nspawnby = -1;
|
|
s16 place_offset_y = 0;
|
|
std::unordered_set<biome_t> biomes;
|
|
--- a/src/mapgen/mg_decoration.cpp
|
|
+++ b/src/mapgen/mg_decoration.cpp
|
|
@@ -60,8 +60,14 @@ void Decoration::resolveNodeNames()
|
|
{
|
|
- getIdsFromNrBacklog(&c_place_on);
|
|
- getIdsFromNrBacklog(&c_spawnby);
|
|
+ std::vector<content_t> place_on_vec;
|
|
+ getIdsFromNrBacklog(&place_on_vec);
|
|
+ c_place_on.clear();
|
|
+ c_place_on.insert(place_on_vec.begin(), place_on_vec.end());
|
|
+
|
|
+ std::vector<content_t> spawnby_vec;
|
|
+ getIdsFromNrBacklog(&spawnby_vec);
|
|
+ c_spawnby.clear();
|
|
+ c_spawnby.insert(spawnby_vec.begin(), spawnby_vec.end());
|
|
}
|
|
|
|
bool Decoration::canPlaceDecoration(MMVManip *vm, v3s16 p)
|
|
@@ -72,7 +78,7 @@ bool Decoration::canPlaceDecoration(MMVManip *vm, v3s16 p)
|
|
// Check if the decoration can be placed on this node
|
|
u32 vi = vm->m_area.index(p);
|
|
- if (!CONTAINS(c_place_on, vm->m_data[vi].getContent()))
|
|
+ if (c_place_on.count(vm->m_data[vi].getContent()) == 0)
|
|
return false;
|
|
|
|
@@ -98,7 +104,7 @@ bool Decoration::canPlaceDecoration(MMVManip *vm, v3s16 p)
|
|
if (!vm->m_area.contains(index))
|
|
continue;
|
|
|
|
- if (CONTAINS(c_spawnby, vm->m_data[index].getContent()))
|
|
+ if (c_spawnby.count(vm->m_data[index].getContent()) > 0)
|
|
nneighs++;
|
|
}
|
|
|
|
@@ -110,7 +116,7 @@ bool Decoration::canPlaceDecoration(MMVManip *vm, v3s16 p)
|
|
if (!vm->m_area.contains(index))
|
|
continue;
|
|
|
|
- if (CONTAINS(c_spawnby, vm->m_data[index].getContent()))
|
|
+ if (c_spawnby.count(vm->m_data[index].getContent()) > 0)
|
|
nneighs++;
|
|
}
|