1
0
mirror of https://github.com/luanti-org/luanti.git synced 2026-01-12 20:25:26 +01:00

More C++03 fixes

This commit is contained in:
Loic Blot
2018-05-14 07:42:20 +02:00
committed by SmallJoker
parent e2815d27f1
commit 695d02e6bd
12 changed files with 37 additions and 28 deletions

View File

@@ -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);
};

View File

@@ -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<content_t, u32> individual_count;
UNORDERED_MAP<content_t, u32> individual_count;
lua_newtable(L);
u64 i = 0;

View File

@@ -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<int> &child_ids = co->getAttachmentChildIds();
for (int child_id : child_ids) {
const UNORDERED_SET<int> &child_ids = co->getAttachmentChildIds();
for (UNORDERED_SET<int>::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));
}