diff options
author | kwolekr <kwolekr@minetest.net> | 2016-06-04 01:35:37 -0400 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2016-06-04 01:51:44 -0400 |
commit | dfbdb5bcd7bc48efb21d585d5c22454a9d5f0f1e (patch) | |
tree | 20f2d5cbb64f1a6bf0ee2638f4396effb42d362b /src/script/lua_api | |
parent | 2060fd9cbe587d7e8ffe0cecdd67925f13a56c05 (diff) | |
download | minetest-dfbdb5bcd7bc48efb21d585d5c22454a9d5f0f1e.tar.gz minetest-dfbdb5bcd7bc48efb21d585d5c22454a9d5f0f1e.tar.bz2 minetest-dfbdb5bcd7bc48efb21d585d5c22454a9d5f0f1e.zip |
Change internal type for seeds to s32
This fixes value truncation (and therefore incompatibility) on platforms
with an LP32 data model, such as VAX or MS-DOS.
Diffstat (limited to 'src/script/lua_api')
-rw-r--r-- | src/script/lua_api/l_env.cpp | 2 | ||||
-rw-r--r-- | src/script/lua_api/l_noise.cpp | 2 | ||||
-rw-r--r-- | src/script/lua_api/l_noise.h | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp index 8284c3fcb..ebdea09e4 100644 --- a/src/script/lua_api/l_env.cpp +++ b/src/script/lua_api/l_env.cpp @@ -758,7 +758,7 @@ int ModApiEnvMod::l_get_perlin_map(lua_State *L) return 0; v3s16 size = read_v3s16(L, 2); - int seed = (int)(env->getServerMap().getSeed()); + s32 seed = (s32)(env->getServerMap().getSeed()); LuaPerlinNoiseMap *n = new LuaPerlinNoiseMap(&np, seed, size); *(void **)(lua_newuserdata(L, sizeof(void *))) = n; luaL_getmetatable(L, "PerlinNoiseMap"); diff --git a/src/script/lua_api/l_noise.cpp b/src/script/lua_api/l_noise.cpp index 04dc6048f..e0039371f 100644 --- a/src/script/lua_api/l_noise.cpp +++ b/src/script/lua_api/l_noise.cpp @@ -146,7 +146,7 @@ const luaL_reg LuaPerlinNoise::methods[] = { LuaPerlinNoiseMap */ -LuaPerlinNoiseMap::LuaPerlinNoiseMap(NoiseParams *params, int seed, v3s16 size) +LuaPerlinNoiseMap::LuaPerlinNoiseMap(NoiseParams *params, s32 seed, v3s16 size) { m_is3d = size.Z > 1; np = *params; diff --git a/src/script/lua_api/l_noise.h b/src/script/lua_api/l_noise.h index 492eb7550..40bfd1315 100644 --- a/src/script/lua_api/l_noise.h +++ b/src/script/lua_api/l_noise.h @@ -79,7 +79,7 @@ class LuaPerlinNoiseMap : public ModApiBase { static int l_getMapSlice(lua_State *L); public: - LuaPerlinNoiseMap(NoiseParams *np, int seed, v3s16 size); + LuaPerlinNoiseMap(NoiseParams *np, s32 seed, v3s16 size); ~LuaPerlinNoiseMap(); @@ -111,7 +111,7 @@ private: static int l_next(lua_State *L); public: - LuaPseudoRandom(int seed) : + LuaPseudoRandom(s32 seed) : m_pseudo(seed) {} // LuaPseudoRandom(seed) |