summaryrefslogtreecommitdiff
path: root/src/script/common/c_content.cpp
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2015-04-19 21:42:40 -0400
committerkwolekr <kwolekr@minetest.net>2015-04-19 21:42:40 -0400
commit3d4244cc75b7e75565476032851fbd30d5cd9306 (patch)
tree9d1e7ad8b44d93d62a559f62bcc97639f6759037 /src/script/common/c_content.cpp
parent687d969c9c50be98597ee9f383280517f1f8cd97 (diff)
downloadminetest-3d4244cc75b7e75565476032851fbd30d5cd9306.tar.gz
minetest-3d4244cc75b7e75565476032851fbd30d5cd9306.tar.bz2
minetest-3d4244cc75b7e75565476032851fbd30d5cd9306.zip
Add 'persistence' alias for Lua noiseparams and validate more vector parameters
Diffstat (limited to 'src/script/common/c_content.cpp')
-rw-r--r--src/script/common/c_content.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp
index 8bb22186b..8f82b692a 100644
--- a/src/script/common/c_content.cpp
+++ b/src/script/common/c_content.cpp
@@ -983,14 +983,16 @@ bool read_noiseparams(lua_State *L, int index, NoiseParams *np)
if (!lua_istable(L, index))
return false;
- np->offset = getfloatfield_default(L, index, "offset", 0.0);
- np->scale = getfloatfield_default(L, index, "scale", 0.0);
- np->persist = getfloatfield_default(L, index, "persist", 0.0);
- np->lacunarity = getfloatfield_default(L, index, "lacunarity", 2.0);
- np->seed = getintfield_default(L, index, "seed", 0);
- np->octaves = getintfield_default(L, index, "octaves", 0);
-
- u32 flags = 0, flagmask = 0;
+ getfloatfield(L, index, "offset", np->offset);
+ getfloatfield(L, index, "scale", np->scale);
+ getfloatfield(L, index, "persist", np->persist);
+ getfloatfield(L, index, "persistence", np->persist);
+ getfloatfield(L, index, "lacunarity", np->lacunarity);
+ getintfield(L, index, "seed", np->seed);
+ getintfield(L, index, "octaves", np->octaves);
+
+ u32 flags = 0;
+ u32 flagmask = 0;
np->flags = getflagsfield(L, index, "flags", flagdesc_noiseparams,
&flags, &flagmask) ? flags : NOISE_FLAG_DEFAULTS;