From 8d3a68f343777c438b9caf9f646e913d4b66e046 Mon Sep 17 00:00:00 2001 From: kwolekr Date: Fri, 14 Nov 2014 02:58:56 -0500 Subject: Fix warnings and other misc. minor changes --- src/mg_biome.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/mg_biome.cpp') diff --git a/src/mg_biome.cpp b/src/mg_biome.cpp index 4b9bc0dc1..1746be25d 100644 --- a/src/mg_biome.cpp +++ b/src/mg_biome.cpp @@ -76,14 +76,15 @@ BiomeManager::~BiomeManager() // just a PoC, obviously needs optimization later on (precalculate this) -void BiomeManager::calcBiomes(BiomeNoiseInput *input, u8 *biomeid_map) +void BiomeManager::calcBiomes(s16 sx, s16 sy, float *heat_map, + float *humidity_map, s16 *height_map, u8 *biomeid_map) { int i = 0; - for (int y = 0; y != input->mapsize.Y; y++) { - for (int x = 0; x != input->mapsize.X; x++, i++) { - float heat = (input->heat_map[i] + 1) * 50; - float humidity = (input->humidity_map[i] + 1) * 50; - biomeid_map[i] = getBiome(heat, humidity, input->height_map[i])->id; + for (int y = 0; y != sy; y++) { + for (int x = 0; x != sx; x++, i++) { + float heat = (heat_map[i] + 1) * 50; + float humidity = (humidity_map[i] + 1) * 50; + biomeid_map[i] = getBiome(heat, humidity, height_map[i])->id; } } } @@ -96,10 +97,8 @@ Biome *BiomeManager::getBiome(float heat, float humidity, s16 y) for (size_t i = 1; i < m_elements.size(); i++) { b = (Biome *)m_elements[i]; - if (!b || y > b->height_max || y < b->height_min) { - printf("not good - %p %d %d %d\n", b, y, b->height_max, b->height_min); + if (!b || y > b->height_max || y < b->height_min) continue; - } float d_heat = heat - b->heat_point; float d_humidity = humidity - b->humidity_point; -- cgit v1.2.3