Replace instances of height_min/height_max with y_min/y_max to remove ambiguity

This commit is contained in:
kwolekr 2014-12-30 01:48:20 -05:00
parent b589353d89
commit 9b0d77a549
7 changed files with 37 additions and 27 deletions

View File

@ -45,8 +45,8 @@ BiomeManager::BiomeManager(IGameDef *gamedef) :
b->depth_filler = 0;
b->height_shore = 0;
b->depth_water_top = 0;
b->height_min = -MAP_GENERATION_LIMIT;
b->height_max = MAP_GENERATION_LIMIT;
b->y_min = -MAP_GENERATION_LIMIT;
b->y_max = MAP_GENERATION_LIMIT;
b->heat_point = 0.0;
b->humidity_point = 0.0;
@ -91,7 +91,7 @@ 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)
if (!b || y > b->y_max || y < b->y_min)
continue;
float d_heat = heat - b->heat_point;

View File

@ -52,8 +52,8 @@ public:
s16 height_shore;
s16 depth_water_top;
s16 height_min;
s16 height_max;
s16 y_min;
s16 y_max;
float heat_point;
float humidity_point;

View File

@ -141,7 +141,7 @@ size_t Decoration::placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax)
mg->findGroundLevel(v2s16(x, z), nmin.Y, nmax.Y);
if (y < nmin.Y || y > nmax.Y ||
y < height_min || y > height_max)
y < y_min || y > y_max)
continue;
int height = getHeight();

View File

@ -66,8 +66,8 @@ public:
int mapseed;
std::vector<content_t> c_place_on;
s16 sidelen;
s16 height_min;
s16 height_max;
s16 y_min;
s16 y_max;
float fill_ratio;
NoiseParams np;

View File

@ -95,25 +95,25 @@ size_t Ore::placeOre(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax)
{
int in_range = 0;
in_range |= (nmin.Y <= height_max && nmax.Y >= height_min);
in_range |= (nmin.Y <= y_max && nmax.Y >= y_min);
if (flags & OREFLAG_ABSHEIGHT)
in_range |= (nmin.Y >= -height_max && nmax.Y <= -height_min) << 1;
in_range |= (nmin.Y >= -y_max && nmax.Y <= -y_min) << 1;
if (!in_range)
return 0;
int ymin, ymax;
int actual_ymin, actual_ymax;
if (in_range & ORE_RANGE_MIRROR) {
ymin = MYMAX(nmin.Y, -height_max);
ymax = MYMIN(nmax.Y, -height_min);
actual_ymin = MYMAX(nmin.Y, -y_max);
actual_ymax = MYMIN(nmax.Y, -y_min);
} else {
ymin = MYMAX(nmin.Y, height_min);
ymax = MYMIN(nmax.Y, height_max);
actual_ymin = MYMAX(nmin.Y, y_min);
actual_ymax = MYMIN(nmax.Y, y_max);
}
if (clust_size >= ymax - ymin + 1)
if (clust_size >= actual_ymax - actual_ymin + 1)
return 0;
nmin.Y = ymin;
nmax.Y = ymax;
nmin.Y = actual_ymin;
nmax.Y = actual_ymax;
generate(mg->vm, mg->seed, blockseed, nmin, nmax);
return 1;

View File

@ -56,8 +56,8 @@ public:
u32 clust_scarcity; // ore cluster has a 1-in-clust_scarcity chance of appearing at a node
s16 clust_num_ores; // how many ore nodes are in a chunk
s16 clust_size; // how large (in nodes) a chunk of ore is
s16 height_min;
s16 height_max;
s16 y_min;
s16 y_max;
u8 ore_param2; // to set node-specific attributes
u32 flags; // attributes for this ore
float nthresh; // threshhold for noise at which an ore is placed

View File

@ -448,8 +448,8 @@ int ModApiMapgen::l_register_biome(lua_State *L)
b->depth_filler = getintfield_default(L, index, "depth_filler", 3);
b->height_shore = getintfield_default(L, index, "height_shore", 3);
b->depth_water_top = getintfield_default(L, index, "depth_water_top", 0);
b->height_min = getintfield_default(L, index, "height_min", -31000);
b->height_max = getintfield_default(L, index, "height_max", 31000);
b->y_min = getintfield_default(L, index, "y_min", -31000);
b->y_max = getintfield_default(L, index, "y_max", 31000);
b->heat_point = getfloatfield_default(L, index, "heat_point", 0.f);
b->humidity_point = getfloatfield_default(L, index, "humidity_point", 0.f);
b->flags = 0; //reserved
@ -522,8 +522,8 @@ int ModApiMapgen::l_register_decoration(lua_State *L)
deco->name = getstringfield_default(L, index, "name", "");
deco->fill_ratio = getfloatfield_default(L, index, "fill_ratio", 0.02);
deco->height_min = getintfield_default(L, index, "height_min", -31000);
deco->height_max = getintfield_default(L, index, "height_max", 31000);
deco->y_min = getintfield_default(L, index, "y_min", -31000);
deco->y_max = getintfield_default(L, index, "y_max", 31000);
deco->sidelen = getintfield_default(L, index, "sidelen", 8);
if (deco->sidelen <= 0) {
errorstream << "register_decoration: sidelen must be "
@ -683,12 +683,22 @@ int ModApiMapgen::l_register_ore(lua_State *L)
ore->clust_scarcity = getintfield_default(L, index, "clust_scarcity", 1);
ore->clust_num_ores = getintfield_default(L, index, "clust_num_ores", 1);
ore->clust_size = getintfield_default(L, index, "clust_size", 0);
ore->height_min = getintfield_default(L, index, "height_min", -31000);
ore->height_max = getintfield_default(L, index, "height_max", 31000);
ore->nthresh = getfloatfield_default(L, index, "noise_threshhold", 0);
ore->noise = NULL;
ore->flags = 0;
// height_min and height_max are aliases for y_min and y_max, respectively,
// for backwards compatibility
int ymin, ymax;
if (!getintfield(L, index, "y_min", ymin) &&
!getintfield(L, index, "height_min", ymin))
ymin = -31000;
if (!getintfield(L, index, "y_max", ymax) &&
!getintfield(L, index, "height_max", ymax))
ymax = 31000;
ore->y_min = ymin;
ore->y_max = ymax;
if (ore->clust_scarcity <= 0 || ore->clust_num_ores <= 0) {
errorstream << "register_ore: clust_scarcity and clust_num_ores"
"must be greater than 0" << std::endl;