From 98137c2aa2b48e6922acb37de8d89cae3cf879ab Mon Sep 17 00:00:00 2001 From: p2r3 Date: Wed, 20 Aug 2025 22:39:42 +0300 Subject: [PATCH] fix esp-idf build error --- src/worldgen.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/worldgen.c b/src/worldgen.c index 5cf1295..fd362fe 100644 --- a/src/worldgen.c +++ b/src/worldgen.c @@ -55,12 +55,12 @@ int getCornerHeight (uint32_t hash, uint8_t biome) { // When calculating the height, parts of the hash are used as random values. // Often, multiple values are stacked to stabilize the distribution while // allowing for occasionally larger variances. - int height; + int height = TERRAIN_BASE_HEIGHT; switch (biome) { case W_mangrove_swamp: { - height = TERRAIN_BASE_HEIGHT + ( + height += ( (hash % 3) + ((hash >> 4) % 3) + ((hash >> 8) % 3) + @@ -73,7 +73,7 @@ int getCornerHeight (uint32_t hash, uint8_t biome) { } case W_plains: { - height = TERRAIN_BASE_HEIGHT + ( + height += ( (hash & 3) + (hash >> 4 & 3) + (hash >> 8 & 3) + @@ -83,7 +83,7 @@ int getCornerHeight (uint32_t hash, uint8_t biome) { } case W_desert: { - height = TERRAIN_BASE_HEIGHT + 4 + ( + height += 4 + ( (hash & 3) + (hash >> 4 & 3) ); @@ -102,7 +102,7 @@ int getCornerHeight (uint32_t hash, uint8_t biome) { case W_snowy_plains: { // Use fewer components with larger ranges to create hills - height = TERRAIN_BASE_HEIGHT + ( + height += ( (hash & 7) + (hash >> 4 & 7) );