diff options
author | kwolekr <kwolekr@minetest.net> | 2014-12-30 01:48:20 -0500 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2014-12-30 01:48:20 -0500 |
commit | 9b0d77a549e4c29c9c189ff2a454568fa9746c1e (patch) | |
tree | 60edafd192aa036e954d8a3db77e29a27dab8475 /src/script | |
parent | b589353d89a5a5cd2dd999a13ca039079bee0ece (diff) | |
download | minetest-9b0d77a549e4c29c9c189ff2a454568fa9746c1e.tar.gz minetest-9b0d77a549e4c29c9c189ff2a454568fa9746c1e.tar.bz2 minetest-9b0d77a549e4c29c9c189ff2a454568fa9746c1e.zip |
Replace instances of height_min/height_max with y_min/y_max to remove ambiguity
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/lua_api/l_mapgen.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/script/lua_api/l_mapgen.cpp b/src/script/lua_api/l_mapgen.cpp index 9e6eacff8..d7c687bd8 100644 --- a/src/script/lua_api/l_mapgen.cpp +++ b/src/script/lua_api/l_mapgen.cpp @@ -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; |