biome name to chunk name

This commit is contained in:
IsseW 2022-01-16 18:11:22 +01:00
parent 5bd7507f31
commit f8d94ef25f
4 changed files with 10 additions and 3 deletions

View File

@ -112,6 +112,7 @@ impl<'a> CanvasInfo<'a> {
surface_veg: 0.0,
sites: Vec::new(),
place: None,
poi: None,
path: Default::default(),
cave: Default::default(),
cliff_height: 0.0,

View File

@ -511,11 +511,14 @@ impl Civs {
// Select point
let idx = biome.1[ctx.rng.gen_range(0..biome.1.len())];
let name = format!("{:?}", biome.0);
self.pois.insert(PointOfInterest {
let id = self.pois.insert(PointOfInterest {
name,
loc: uniform_idx_as_vec2(map_size_lg, idx),
kind: PoiKind::Biome(biome.1.len() as u32),
});
for chunk in biome.1 {
ctx.sim.chunks[chunk].poi = Some(id);
}
}
info!(?num_biomes, "all biomes named");

View File

@ -282,7 +282,8 @@ impl World {
.get_origin()
.distance_squared(chunk_center_wpos2d)
})
.map(|id| index.sites[*id].name().to_string()),
.map(|id| index.sites[*id].name().to_string())
.or_else(|| sim_chunk.poi.map(|poi| self.civs.pois[poi].name.clone())),
sim_chunk.get_biome(),
sim_chunk.alt,
sim_chunk.tree_density,

View File

@ -28,7 +28,7 @@ pub(crate) use self::{
use crate::{
all::{Environment, ForestKind, TreeAttr},
block::BlockGen,
civ::Place,
civ::{Place, PointOfInterest},
column::ColumnGen,
layer::spot::Spot,
site::Site,
@ -2178,6 +2178,7 @@ pub struct SimChunk {
pub sites: Vec<Id<Site>>,
pub place: Option<Id<Place>>,
pub poi: Option<Id<PointOfInterest>>,
pub path: (Way, Path),
pub cave: (Way, Cave),
@ -2419,6 +2420,7 @@ impl SimChunk {
sites: Vec::new(),
place: None,
poi: None,
path: Default::default(),
cave: Default::default(),
cliff_height: 0.0,