More logging in world gen (with logging-feature)

This commit is contained in:
Tobias Berger 2022-11-15 12:14:07 +01:00
parent b9e402ecf9
commit 9b7691d84e
Signed by: toby
GPG key ID: 2D05EFAB764D6A88

View file

@ -186,12 +186,14 @@ impl World {
} }
fn generate_continents(&mut self) { fn generate_continents(&mut self) {
#[cfg(feature = "logging")]
info!("Generating continents"); info!("Generating continents");
let width = self.width as f32; let width = self.width as f32;
let height = self.height as f32; let height = self.height as f32;
for i in 0..World::NUM_CONTINENTS { for i in 0..World::NUM_CONTINENTS {
info!("{}/{}", i, World::NUM_CONTINENTS); #[cfg(feature = "logging")]
info!("Continents {}/{}", i, World::NUM_CONTINENTS);
self.continent_offsets[i as usize].x = self self.continent_offsets[i as usize].x = self
.rng .rng
@ -269,6 +271,9 @@ impl World {
let offset_5 = World::random_offset_vector(&mut self.rng); let offset_5 = World::random_offset_vector(&mut self.rng);
for y in 0..self.terrain.len() { for y in 0..self.terrain.len() {
#[cfg(feature = "logging")]
info!("Altitude: {}/{}", y, self.terrain.len());
let alpha = (y as f32 / self.height as f32) * PI; let alpha = (y as f32 / self.height as f32) * PI;
for x in 0..self.terrain[y].len() { for x in 0..self.terrain[y].len() {
@ -381,12 +386,14 @@ impl World {
} }
fn generate_rainfall(&mut self) -> Result<(), CartesianError> { fn generate_rainfall(&mut self) -> Result<(), CartesianError> {
#[cfg(feature = "logging")]
info!("Generating rainfall"); info!("Generating rainfall");
const RADIUS: f32 = 2.0; const RADIUS: f32 = 2.0;
let offset = World::random_offset_vector(&mut self.rng); let offset = World::random_offset_vector(&mut self.rng);
let height = self.terrain.len(); let height = self.terrain.len();
for y in 0..height { for y in 0..height {
#[cfg(feature = "logging")]
info!("Rainfall: {}/{}", y, height); info!("Rainfall: {}/{}", y, height);
let alpha = (y as f32 / self.height as f32) * PI; let alpha = (y as f32 / self.height as f32) * PI;
@ -453,10 +460,14 @@ impl World {
} }
fn generate_temperature(&mut self) -> Result<(), CartesianError> { fn generate_temperature(&mut self) -> Result<(), CartesianError> {
#[cfg(feature = "logging")]
info!("Generating temperature");
let offset = World::random_offset_vector(&mut self.rng); let offset = World::random_offset_vector(&mut self.rng);
const RADIUS: f32 = 2.0; const RADIUS: f32 = 2.0;
for y in 0..self.terrain.len() { for y in 0..self.terrain.len() {
#[cfg(feature = "logging")]
info!("Temperature: {}/{}", y, self.terrain.len());
let alpha = (y as f32 / self.height as f32) * PI; let alpha = (y as f32 / self.height as f32) * PI;
for x in 0..self.terrain[y].len() { for x in 0..self.terrain[y].len() {
let beta = (x as f32 / self.width as f32) * TAU; let beta = (x as f32 / self.width as f32) * TAU;
@ -497,7 +508,10 @@ impl World {
} }
fn generate_biomes(&mut self) { fn generate_biomes(&mut self) {
info!("Generating biomes");
for y in 0..self.terrain.len() { for y in 0..self.terrain.len() {
#[cfg(feature = "logging")]
info!("Biomes: {}/{}", y, self.terrain.len());
for x in 0..self.terrain[y].len() { for x in 0..self.terrain[y].len() {
let cell = &self.terrain[y][x]; let cell = &self.terrain[y][x];