Fixed issues caused by changes to HashMap in godot

This commit is contained in:
Trey M 2022-05-13 00:14:03 -05:00
parent a4abfc770c
commit 96916814de
5 changed files with 14 additions and 13 deletions

View File

@ -2163,11 +2163,11 @@ VoxelGraphNodeDB::VoxelGraphNodeDB() {
for (unsigned int i = 0; i < _types.size(); ++i) { for (unsigned int i = 0; i < _types.size(); ++i) {
NodeType &t = _types[i]; NodeType &t = _types[i];
_type_name_to_id.set(t.name, (VoxelGeneratorGraph::NodeTypeID)i); _type_name_to_id.insert(t.name, (VoxelGeneratorGraph::NodeTypeID)i);
for (size_t param_index = 0; param_index < t.params.size(); ++param_index) { for (size_t param_index = 0; param_index < t.params.size(); ++param_index) {
Param &p = t.params[param_index]; Param &p = t.params[param_index];
t.param_name_to_index.set(p.name, param_index); t.param_name_to_index.insert(p.name, param_index);
p.index = param_index; p.index = param_index;
switch (p.type) { switch (p.type) {
@ -2195,7 +2195,7 @@ VoxelGraphNodeDB::VoxelGraphNodeDB() {
for (size_t input_index = 0; input_index < t.inputs.size(); ++input_index) { for (size_t input_index = 0; input_index < t.inputs.size(); ++input_index) {
const Port &p = t.inputs[input_index]; const Port &p = t.inputs[input_index];
t.input_name_to_index.set(p.name, input_index); t.input_name_to_index.insert(p.name, input_index);
} }
if (t.expression_func != nullptr) { if (t.expression_func != nullptr) {

View File

@ -393,7 +393,7 @@ static void bake_mesh_geometry(VoxelBlockyModel &config, VoxelBlockyModel::Baked
} }
} }
added_side_indices[side].set(src_index, next_side_index); added_side_indices[side].insert(src_index, next_side_index);
++next_side_index; ++next_side_index;
} else { } else {
@ -435,7 +435,7 @@ static void bake_mesh_geometry(VoxelBlockyModel &config, VoxelBlockyModel::Baked
} }
} }
added_regular_indices.set(src_index, next_regular_index); added_regular_indices.insert(src_index, next_regular_index);
++next_regular_index; ++next_regular_index;
} else { } else {

View File

@ -377,9 +377,10 @@ void VoxelTerrain::set_block_enter_notification_enabled(bool enable) {
if (enable == false) { if (enable == false) {
const Vector3i *key = nullptr; const Vector3i *key = nullptr;
while ((key = _loading_blocks.next(key))) {
LoadingBlock *lb = _loading_blocks.getptr(*key); for (auto elm = _loading_blocks.begin(); elm < _loading_blocks.end(); ++elm) {
CRASH_COND(lb == nullptr); LoadingBlock *lb = _loading_blocks.getptr(elm->key);
CRASH_COND(elm == nullptr);
lb->viewers_to_notify.clear(); lb->viewers_to_notify.clear();
} }
} }
@ -486,7 +487,7 @@ void VoxelTerrain::view_data_block(Vector3i bpos, uint32_t viewer_id, bool requi
} }
// Schedule a loading request // Schedule a loading request
_loading_blocks.set(bpos, new_loading_block); _loading_blocks.insert(bpos, new_loading_block);
_blocks_pending_load.push_back(bpos); _blocks_pending_load.push_back(bpos);
} else { } else {
@ -800,7 +801,7 @@ void VoxelTerrain::generate_block_async(Vector3i block_position) {
// Schedule a loading request // Schedule a loading request
// TODO This could also end up loading from stream // TODO This could also end up loading from stream
_loading_blocks.set(block_position, new_loading_block); _loading_blocks.insert(block_position, new_loading_block);
_blocks_pending_load.push_back(block_position); _blocks_pending_load.push_back(block_position);
} }

View File

@ -1611,7 +1611,7 @@ Node *VoxelInstancer::debug_dump_as_nodes() const {
Ref<Mesh> mesh_copy; Ref<Mesh> mesh_copy;
if (mesh_copy_ptr == nullptr) { if (mesh_copy_ptr == nullptr) {
mesh_copy = src_mesh->duplicate(); mesh_copy = src_mesh->duplicate();
mesh_copies.set(src_mesh, mesh_copy); mesh_copies.insert(src_mesh, mesh_copy);
} else { } else {
mesh_copy = *mesh_copy_ptr; mesh_copy = *mesh_copy_ptr;
} }

View File

@ -137,14 +137,14 @@ Array generate_debug_seams_wireframe_surface(const Mesh &src_mesh, int surface_i
const Vector3 pos = src_positions[i]; const Vector3 pos = src_positions[i];
Dupe *dptr = vertex_to_dupe.getptr(pos); Dupe *dptr = vertex_to_dupe.getptr(pos);
if (dptr == nullptr) { if (dptr == nullptr) {
vertex_to_dupe.set(pos, Dupe()); vertex_to_dupe.insert(pos, Dupe());
} else { } else {
if (dptr->count == 0) { if (dptr->count == 0) {
dptr->dst_index = dst_positions.size(); dptr->dst_index = dst_positions.size();
dst_positions.push_back(pos + src_normals[i] * 0.05); dst_positions.push_back(pos + src_normals[i] * 0.05);
} }
++dptr->count; ++dptr->count;
src_index_to_dst_index.set(i, dptr->dst_index); src_index_to_dst_index.insert(i, dptr->dst_index);
} }
} }
} }