summaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_vmanip.cpp
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2017-08-19 22:23:47 +0200
committerGitHub <noreply@github.com>2017-08-19 22:23:47 +0200
commit88b436e6a9c98af7215bd115e1b7a3f1a1db99d3 (patch)
treef07cdd7f93ca26b84192d7b89f7b952e603ba5cf /src/script/lua_api/l_vmanip.cpp
parent7528986e4449febead9b18b6118f0b096f7cf800 (diff)
downloadminetest-88b436e6a9c98af7215bd115e1b7a3f1a1db99d3.tar.gz
minetest-88b436e6a9c98af7215bd115e1b7a3f1a1db99d3.tar.bz2
minetest-88b436e6a9c98af7215bd115e1b7a3f1a1db99d3.zip
Code modernization: subfolders (#6283)
* Code modernization: subfolders Modernize various code on subfolders client, network, script, threading, unittests, util * empty function * default constructor/destructor * for range-based loops * use emplace_back instead of push_back * C++ STL header style * Make connection.cpp readable in a pointed place + typo
Diffstat (limited to 'src/script/lua_api/l_vmanip.cpp')
-rw-r--r--src/script/lua_api/l_vmanip.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/script/lua_api/l_vmanip.cpp b/src/script/lua_api/l_vmanip.cpp
index 1e973703c..a84ecfc0f 100644
--- a/src/script/lua_api/l_vmanip.cpp
+++ b/src/script/lua_api/l_vmanip.cpp
@@ -111,7 +111,7 @@ int LuaVoxelManip::l_write_to_map(lua_State *L)
MAP_LOCK_REQUIRED;
LuaVoxelManip *o = checkobject(L, 1);
- bool update_light = lua_isboolean(L, 2) ? lua_toboolean(L, 2) : true;
+ bool update_light = !lua_isboolean(L, 2) || lua_toboolean(L, 2);
GET_ENV_PTR;
ServerMap *map = &(env->getServerMap());
if (o->is_mapgen_vm || !update_light) {
@@ -123,9 +123,8 @@ int LuaVoxelManip::l_write_to_map(lua_State *L)
MapEditEvent event;
event.type = MEET_OTHER;
- for (std::map<v3s16, MapBlock *>::iterator it = o->modified_blocks.begin();
- it != o->modified_blocks.end(); ++it)
- event.modified_blocks.insert(it->first);
+ for (const auto &modified_block : o->modified_blocks)
+ event.modified_blocks.insert(modified_block.first);
map->dispatchEvent(&event);
@@ -198,7 +197,7 @@ int LuaVoxelManip::l_calc_lighting(lua_State *L)
v3s16 fpmax = vm->m_area.MaxEdge;
v3s16 pmin = lua_istable(L, 2) ? check_v3s16(L, 2) : fpmin + yblock;
v3s16 pmax = lua_istable(L, 3) ? check_v3s16(L, 3) : fpmax - yblock;
- bool propagate_shadow = lua_isboolean(L, 4) ? lua_toboolean(L, 4) : true;
+ bool propagate_shadow = !lua_isboolean(L, 4) || lua_toboolean(L, 4);
sortBoxVerticies(pmin, pmax);
if (!vm->m_area.contains(VoxelArea(pmin, pmax)))