Use DHashSet

This commit is contained in:
IsseW 2022-02-01 01:07:36 +01:00
parent 72e270368d
commit 0ba4a3a409

View File

@ -7,7 +7,7 @@ use crate::{
sim::WorldSim, sim::WorldSim,
site::{namegen::NameGen, Castle, Settlement, Site as WorldSite, Tree}, site::{namegen::NameGen, Castle, Settlement, Site as WorldSite, Tree},
site2, site2,
util::{attempt, seed_expan, NEIGHBORS}, util::{attempt, seed_expan, DHashSet, NEIGHBORS},
Index, Land, Index, Land,
}; };
use common::{ use common::{
@ -20,7 +20,7 @@ use common::{
}; };
use core::{fmt, hash::BuildHasherDefault, ops::Range}; use core::{fmt, hash::BuildHasherDefault, ops::Range};
use fxhash::FxHasher64; use fxhash::FxHasher64;
use hashbrown::{HashMap, HashSet}; use hashbrown::HashMap;
use rand::prelude::*; use rand::prelude::*;
use rand_chacha::ChaChaRng; use rand_chacha::ChaChaRng;
use tracing::{debug, info, warn}; use tracing::{debug, info, warn};
@ -470,9 +470,9 @@ impl Civs {
fn name_biomes(&mut self, ctx: &mut GenCtx<impl Rng>) { fn name_biomes(&mut self, ctx: &mut GenCtx<impl Rng>) {
let map_size_lg = ctx.sim.map_size_lg(); let map_size_lg = ctx.sim.map_size_lg();
let mut biomes: Vec<(common::terrain::BiomeKind, Vec<usize>)> = Vec::new(); let mut biomes: Vec<(common::terrain::BiomeKind, Vec<usize>)> = Vec::new();
let mut explored = HashSet::new(); let mut explored = DHashSet::default();
let mut to_explore = HashSet::new(); let mut to_explore = DHashSet::default();
let mut to_floodfill = HashSet::new(); let mut to_floodfill = DHashSet::default();
// TODO: have start point in center and ignore ocean? // TODO: have start point in center and ignore ocean?
let start_point = 0; let start_point = 0;
to_explore.insert(start_point); to_explore.insert(start_point);