mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-11 17:51:04 +00:00
Noise: Create a deep copy of NoiseParams
This commit is contained in:
parent
88c28414f4
commit
fb2bc956b1
9 changed files with 91 additions and 91 deletions
|
@ -161,7 +161,7 @@ int LuaPerlinNoiseMap::l_get2dMap(lua_State *L)
|
|||
for (int y = 0; y != n->sy; y++) {
|
||||
lua_newtable(L);
|
||||
for (int x = 0; x != n->sx; x++) {
|
||||
float noiseval = n->np->offset + n->np->scale * n->result[i++];
|
||||
float noiseval = n->np.offset + n->np.scale * n->result[i++];
|
||||
lua_pushnumber(L, noiseval);
|
||||
lua_rawseti(L, -2, x + 1);
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ int LuaPerlinNoiseMap::l_get2dMap_flat(lua_State *L)
|
|||
|
||||
lua_newtable(L);
|
||||
for (int i = 0; i != maplen; i++) {
|
||||
float noiseval = n->np->offset + n->np->scale * n->result[i];
|
||||
float noiseval = n->np.offset + n->np.scale * n->result[i];
|
||||
lua_pushnumber(L, noiseval);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ int LuaPerlinNoiseMap::l_get3dMap(lua_State *L)
|
|||
for (int y = 0; y != n->sy; y++) {
|
||||
lua_newtable(L);
|
||||
for (int x = 0; x != n->sx; x++) {
|
||||
lua_pushnumber(L, n->np->offset + n->np->scale * n->result[i++]);
|
||||
lua_pushnumber(L, n->np.offset + n->np.scale * n->result[i++]);
|
||||
lua_rawseti(L, -2, x + 1);
|
||||
}
|
||||
lua_rawseti(L, -2, y + 1);
|
||||
|
@ -236,7 +236,7 @@ int LuaPerlinNoiseMap::l_get3dMap_flat(lua_State *L)
|
|||
|
||||
lua_newtable(L);
|
||||
for (int i = 0; i != maplen; i++) {
|
||||
float noiseval = n->np->offset + n->np->scale * n->result[i];
|
||||
float noiseval = n->np.offset + n->np.scale * n->result[i];
|
||||
lua_pushnumber(L, noiseval);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue