Update heightmap_c.c
Casting to an int will do the same as floorf if it's positive and since max with 0 will make sure no value is ever negative then you don't need floorf.
Credit to Erros#9055 on Discord
@@ -147,8 +147,8 @@ void TCOD_heightmap_add_hill(TCOD_heightmap_t* hm, float hx, float hy, float h_r
}
const float h_radius2 = h_radius * h_radius;
const float coef = h_height / h_radius2;
- const int minx = (int)MAX(floorf(hx - h_radius), 0);
- const int miny = (int)MAX(floorf(hy - h_radius), 0);
+ const int minx = MAX((int)(hx - h_radius), 0);
+ const int miny = MAX((int)(hy - h_radius), 0);
const int maxx = (int)MIN(ceilf(hx + h_radius), hm->w);
const int maxy = (int)MIN(ceilf(hy + h_radius), hm->h);
for (int y = miny; y < maxy; y++) {
@@ -169,8 +169,8 @@ void TCOD_heightmap_dig_hill(TCOD_heightmap_t* hm, float hx, float hy, float h_r
}
const float h_radius2 = h_radius * h_radius;
const float coef = h_height / h_radius2;
- const int minx = (int)MAX(floorf(hx - h_radius), 0);
- const int miny = (int)MAX(floorf(hy - h_radius), 0);
+ const int minx = MAX((int)(hx - h_radius), 0);
+ const int miny = MAX((int)(hy - h_radius), 0);
const int maxx = (int)MIN(ceilf(hx + h_radius), hm->w);
const int maxy = (int)MIN(ceilf(hy + h_radius), hm->h);
for (int y = miny; y < maxy; y++) {
