summaryrefslogtreecommitdiff
path: root/src/mg_biome.cpp
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2014-11-14 02:58:56 -0500
committerkwolekr <kwolekr@minetest.net>2014-11-14 03:07:12 -0500
commit8d3a68f343777c438b9caf9f646e913d4b66e046 (patch)
treec69c8b6d0fd2570451f7d56e72faa75d06130638 /src/mg_biome.cpp
parent5b8855e83c0d1cc7aef21492e7fe862b7d06917e (diff)
downloadminetest-8d3a68f343777c438b9caf9f646e913d4b66e046.tar.gz
minetest-8d3a68f343777c438b9caf9f646e913d4b66e046.tar.bz2
minetest-8d3a68f343777c438b9caf9f646e913d4b66e046.zip
Fix warnings and other misc. minor changes
Diffstat (limited to 'src/mg_biome.cpp')
-rw-r--r--src/mg_biome.cpp17
1 files changed, 8 insertions, 9 deletions
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;