diff --git a/agb/src/hash_map.rs b/agb/src/hash_map.rs index 922f9dd0..1d65ea5d 100644 --- a/agb/src/hash_map.rs +++ b/agb/src/hash_map.rs @@ -75,10 +75,6 @@ impl NodeStorage { if let Some(current_node) = current_node { if current_node.distance_to_initial_bucket <= new_node.distance_to_initial_bucket { - max_distance_to_initial_bucket = new_node - .distance_to_initial_bucket - .max(max_distance_to_initial_bucket); - mem::swap(&mut new_node, current_node); } } else { @@ -87,6 +83,9 @@ impl NodeStorage { } new_node.distance_to_initial_bucket += 1; + max_distance_to_initial_bucket = new_node + .distance_to_initial_bucket + .max(max_distance_to_initial_bucket); } max_distance_to_initial_bucket