mirror of
https://github.com/minetest/minetest.git
synced 2024-11-30 03:23:45 +01:00
Remove some unused variable from Lua class wrappers
This commit is contained in:
parent
41e79d902d
commit
5362f472ff
@ -30,7 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
LuaPerlinNoise
|
||||
*/
|
||||
|
||||
LuaPerlinNoise::LuaPerlinNoise(NoiseParams *params) :
|
||||
LuaPerlinNoise::LuaPerlinNoise(const NoiseParams *params) :
|
||||
np(*params)
|
||||
{
|
||||
}
|
||||
@ -141,12 +141,10 @@ luaL_Reg LuaPerlinNoise::methods[] = {
|
||||
LuaPerlinNoiseMap
|
||||
*/
|
||||
|
||||
LuaPerlinNoiseMap::LuaPerlinNoiseMap(NoiseParams *params, s32 seed, v3s16 size)
|
||||
LuaPerlinNoiseMap::LuaPerlinNoiseMap(const NoiseParams *np, s32 seed, v3s16 size)
|
||||
{
|
||||
m_is3d = size.Z > 1;
|
||||
np = *params;
|
||||
try {
|
||||
noise = new Noise(&np, seed, size.X, size.Y, size.Z);
|
||||
noise = new Noise(np, seed, size.X, size.Y, size.Z);
|
||||
} catch (InvalidNoiseParamsException &e) {
|
||||
throw LuaError(e.what());
|
||||
}
|
||||
@ -217,7 +215,7 @@ int LuaPerlinNoiseMap::l_get_3d_map(lua_State *L)
|
||||
LuaPerlinNoiseMap *o = checkobject(L, 1);
|
||||
v3f p = check_v3f(L, 2);
|
||||
|
||||
if (!o->m_is3d)
|
||||
if (!o->is3D())
|
||||
return 0;
|
||||
|
||||
Noise *n = o->noise;
|
||||
@ -248,7 +246,7 @@ int LuaPerlinNoiseMap::l_get_3d_map_flat(lua_State *L)
|
||||
v3f p = check_v3f(L, 2);
|
||||
bool use_buffer = lua_istable(L, 3);
|
||||
|
||||
if (!o->m_is3d)
|
||||
if (!o->is3D())
|
||||
return 0;
|
||||
|
||||
Noise *n = o->noise;
|
||||
@ -289,7 +287,7 @@ int LuaPerlinNoiseMap::l_calc_3d_map(lua_State *L)
|
||||
LuaPerlinNoiseMap *o = checkobject(L, 1);
|
||||
v3f p = check_v3f(L, 2);
|
||||
|
||||
if (!o->m_is3d)
|
||||
if (!o->is3D())
|
||||
return 0;
|
||||
|
||||
Noise *n = o->noise;
|
||||
|
@ -30,6 +30,7 @@ class LuaPerlinNoise : public ModApiBase
|
||||
{
|
||||
private:
|
||||
NoiseParams np;
|
||||
|
||||
static const char className[];
|
||||
static luaL_Reg methods[];
|
||||
|
||||
@ -42,7 +43,7 @@ private:
|
||||
static int l_get_3d(lua_State *L);
|
||||
|
||||
public:
|
||||
LuaPerlinNoise(NoiseParams *params);
|
||||
LuaPerlinNoise(const NoiseParams *params);
|
||||
~LuaPerlinNoise() = default;
|
||||
|
||||
// LuaPerlinNoise(seed, octaves, persistence, scale)
|
||||
@ -59,9 +60,8 @@ public:
|
||||
*/
|
||||
class LuaPerlinNoiseMap : public ModApiBase
|
||||
{
|
||||
NoiseParams np;
|
||||
Noise *noise;
|
||||
bool m_is3d;
|
||||
|
||||
static const char className[];
|
||||
static luaL_Reg methods[];
|
||||
|
||||
@ -80,10 +80,11 @@ class LuaPerlinNoiseMap : public ModApiBase
|
||||
static int l_get_map_slice(lua_State *L);
|
||||
|
||||
public:
|
||||
LuaPerlinNoiseMap(NoiseParams *np, s32 seed, v3s16 size);
|
||||
|
||||
LuaPerlinNoiseMap(const NoiseParams *np, s32 seed, v3s16 size);
|
||||
~LuaPerlinNoiseMap();
|
||||
|
||||
inline bool is3D() const { return noise->sz > 1; }
|
||||
|
||||
// LuaPerlinNoiseMap(np, size)
|
||||
// Creates an LuaPerlinNoiseMap and leaves it on top of stack
|
||||
static int create_object(lua_State *L);
|
||||
|
@ -17,7 +17,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
|
||||
#include <map>
|
||||
#include "lua_api/l_vmanip.h"
|
||||
#include "lua_api/l_internal.h"
|
||||
#include "common/c_content.h"
|
||||
@ -112,23 +112,23 @@ int LuaVoxelManip::l_write_to_map(lua_State *L)
|
||||
|
||||
LuaVoxelManip *o = checkobject(L, 1);
|
||||
bool update_light = !lua_isboolean(L, 2) || readParam<bool>(L, 2);
|
||||
|
||||
GET_ENV_PTR;
|
||||
ServerMap *map = &(env->getServerMap());
|
||||
|
||||
std::map<v3s16, MapBlock*> modified_blocks;
|
||||
if (o->is_mapgen_vm || !update_light) {
|
||||
o->vm->blitBackAll(&(o->modified_blocks));
|
||||
o->vm->blitBackAll(&modified_blocks);
|
||||
} else {
|
||||
voxalgo::blit_back_with_light(map, o->vm,
|
||||
&(o->modified_blocks));
|
||||
voxalgo::blit_back_with_light(map, o->vm, &modified_blocks);
|
||||
}
|
||||
|
||||
MapEditEvent event;
|
||||
event.type = MEET_OTHER;
|
||||
for (const auto &modified_block : o->modified_blocks)
|
||||
event.modified_blocks.insert(modified_block.first);
|
||||
|
||||
for (const auto &it : modified_blocks)
|
||||
event.modified_blocks.insert(it.first);
|
||||
map->dispatchEvent(event);
|
||||
|
||||
o->modified_blocks.clear();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include "irr_v3d.h"
|
||||
#include "lua_api/l_base.h"
|
||||
|
||||
@ -33,7 +32,6 @@ class MMVManip;
|
||||
class LuaVoxelManip : public ModApiBase
|
||||
{
|
||||
private:
|
||||
std::map<v3s16, MapBlock *> modified_blocks;
|
||||
bool is_mapgen_vm = false;
|
||||
|
||||
static const char className[];
|
||||
|
Loading…
Reference in New Issue
Block a user