aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/emerge.cpp4
-rw-r--r--src/script/lua_api/l_env.cpp7
-rw-r--r--src/script/lua_api/l_vmanip.cpp8
3 files changed, 14 insertions, 5 deletions
diff --git a/src/emerge.cpp b/src/emerge.cpp
index 09a58149d..c0560ba3b 100644
--- a/src/emerge.cpp
+++ b/src/emerge.cpp
@@ -59,9 +59,9 @@ EmergeManager::EmergeManager(IGameDef *gamedef) {
this->biomedef = new BiomeDefManager();
this->params = NULL;
- this->luaoverride_params = NULL;
+ this->luaoverride_params = NULL;
this->luaoverride_params_modified = 0;
- this->luaoverride_flagmask = 0;
+ this->luaoverride_flagmask = 0;
mapgen_debug_info = g_settings->getBool("enable_mapgen_debug_info");
diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp
index 02cafc0d5..89ba9798a 100644
--- a/src/script/lua_api/l_env.cpp
+++ b/src/script/lua_api/l_env.cpp
@@ -579,6 +579,8 @@ int ModApiEnvMod::l_get_mapgen_object(lua_State *L)
EmergeManager *emerge = getServer(L)->getEmergeManager();
Mapgen *mg = emerge->getCurrentMapgen();
+ if (!mg)
+ return 0;
size_t maplen = mg->csize.X * mg->csize.Z;
@@ -614,7 +616,7 @@ int ModApiEnvMod::l_get_mapgen_object(lua_State *L)
}
break; }
case MGOBJ_BIOMEMAP: {
- if (!mg->heightmap)
+ if (!mg->biomemap)
return 0;
lua_newtable(L);
@@ -625,6 +627,9 @@ int ModApiEnvMod::l_get_mapgen_object(lua_State *L)
break; }
case MGOBJ_HEATMAP: { // Mapgen V7 specific objects
case MGOBJ_HUMIDMAP:
+ if (strcmp(emerge->params->mg_name.c_str(), "v7"))
+ return 0;
+
MapgenV7 *mgv7 = (MapgenV7 *)mg;
float *arr = (mgobj == MGOBJ_HEATMAP) ?
diff --git a/src/script/lua_api/l_vmanip.cpp b/src/script/lua_api/l_vmanip.cpp
index f753f5f27..8bf65a555 100644
--- a/src/script/lua_api/l_vmanip.cpp
+++ b/src/script/lua_api/l_vmanip.cpp
@@ -88,7 +88,7 @@ int LuaVoxelManip::l_set_data(lua_State *L)
int volume = vm->m_area.getVolume();
for (int i = 0; i != volume; i++) {
lua_rawgeti(L, 2, i + 1);
- content_t c = lua_tonumber(L, -1);
+ content_t c = lua_tointeger(L, -1);
vm->m_data[i].setContent(c);
@@ -224,7 +224,11 @@ int LuaVoxelManip::create_object(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
- Map *map = &(get_scriptapi(L)->getEnv()->getMap());
+ Environment *env = get_scriptapi(L)->getEnv();
+ if (!env)
+ return 0;
+
+ Map *map = &(env->getMap());
LuaVoxelManip *o = new LuaVoxelManip(map);
*(void **)(lua_newuserdata(L, sizeof(void *))) = o;