diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-11-14 00:19:48 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-11-29 19:13:41 +0200 |
commit | abceeee92f99b84ebb79968269835a4f509bfb90 (patch) | |
tree | 669edeca68fae4eb086ac4e4c1846b55d3aa779d /src/scriptapi.cpp | |
parent | 5fc791ac9a15ea6f234ca2d23041c83679255746 (diff) | |
download | minetest-abceeee92f99b84ebb79968269835a4f509bfb90.tar.gz minetest-abceeee92f99b84ebb79968269835a4f509bfb90.tar.bz2 minetest-abceeee92f99b84ebb79968269835a4f509bfb90.zip |
Create framework for getting rid of global definitions of node/tool/item/whatever types
Diffstat (limited to 'src/scriptapi.cpp')
-rw-r--r-- | src/scriptapi.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/scriptapi.cpp b/src/scriptapi.cpp index 27f46a8ac..7b9a89f57 100644 --- a/src/scriptapi.cpp +++ b/src/scriptapi.cpp @@ -478,7 +478,11 @@ private: <<" itemstring=\""<<itemstring<<"\""<<std::endl; // Do it std::istringstream is(itemstring, std::ios::binary); - InventoryItem *item = InventoryItem::deSerialize(is); + ServerEnvironment *env = co->getEnv(); + assert(env); + IGameDef *gamedef = env->getGameDef(); + InventoryItem *item = InventoryItem::deSerialize(is, gamedef); + infostream<<"item="<<env<<std::endl; bool fits = co->addToInventory(item); // Return lua_pushboolean(L, fits); @@ -557,7 +561,8 @@ const luaL_reg ObjectRef::methods[] = { }; // Creates a new anonymous reference if id=0 -static void objectref_get_or_create(lua_State *L, ServerActiveObject *cobj) +static void objectref_get_or_create(lua_State *L, + ServerActiveObject *cobj) { if(cobj->getId() == 0){ ObjectRef::create(L, cobj); |