From 695d02e6bda939f7b00af402273b39a8fd75a203 Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Mon, 14 May 2018 07:42:20 +0200 Subject: More C++03 fixes --- src/script/cpp_api/s_item.h | 2 +- src/script/lua_api/l_env.cpp | 4 ++-- src/script/lua_api/l_object.cpp | 8 +++++--- 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src/script') diff --git a/src/script/cpp_api/s_item.h b/src/script/cpp_api/s_item.h index b4b02b0c5..daff15bf1 100644 --- a/src/script/cpp_api/s_item.h +++ b/src/script/cpp_api/s_item.h @@ -53,7 +53,7 @@ protected: friend class LuaItemStack; friend class ModApiItemMod; - bool getItemCallback(const char *name, const char *callbackname, const v3s16 *p = nullptr); + bool getItemCallback(const char *name, const char *callbackname, const v3s16 *p = NULL); void pushPointedThing(const PointedThing& pointed); }; diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp index 4a7885da7..630f6cc64 100644 --- a/src/script/lua_api/l_env.cpp +++ b/src/script/lua_api/l_env.cpp @@ -292,7 +292,7 @@ int ModApiEnvMod::l_place_node(lua_State *L) pointed.node_abovesurface = pos; pointed.node_undersurface = pos + v3s16(0,-1,0); // Place it with a NULL placer (appears in Lua as nil) - bool success = scriptIfaceItem->item_OnPlace(item, nullptr, pointed); + bool success = scriptIfaceItem->item_OnPlace(item, NULL, pointed); lua_pushboolean(L, success); return 1; } @@ -676,7 +676,7 @@ int ModApiEnvMod::l_find_nodes_in_area(lua_State *L) ndef->getIds(lua_tostring(L, 3), filter); } - std::unordered_map individual_count; + UNORDERED_MAP individual_count; lua_newtable(L); u64 i = 0; diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp index 0195dc399..8905f2d0c 100644 --- a/src/script/lua_api/l_object.cpp +++ b/src/script/lua_api/l_object.cpp @@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "lua_api/l_item.h" #include "common/c_converter.h" #include "common/c_content.h" +#include "util/cpp11_container.h" #include "log.h" #include "tool.h" #include "serverobject.h" @@ -137,10 +138,11 @@ int ObjectRef::l_remove(lua_State *L) if (co->getType() == ACTIVEOBJECT_TYPE_PLAYER) return 0; - const std::unordered_set &child_ids = co->getAttachmentChildIds(); - for (int child_id : child_ids) { + const UNORDERED_SET &child_ids = co->getAttachmentChildIds(); + for (UNORDERED_SET::const_iterator it = child_ids.begin(); it != child_ids.end(); + ++it) { // Child can be NULL if it was deleted earlier - if (ServerActiveObject *child = env->getActiveObject(child_id)) + if (ServerActiveObject *child = env->getActiveObject(*it)) child->setAttachment(0, "", v3f(0, 0, 0), v3f(0, 0, 0)); } -- cgit v1.2.3