Commented out debug statements again
[oweals/minetest.git] / src / mapblockobject.cpp
index 343926f8152f733426ea8f949f927541e267e716..071a14b0cdb3b497d586f057fb6a1503377b0f20 100644 (file)
@@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "map.h"
 #include "inventory.h"
 #include "utility.h"
+#include "mapblock.h"
 
 /*
        MapBlockObject
@@ -63,7 +64,7 @@ v3f MovingObject::getAbsoluteShowPos()
 
 void MovingObject::move(float dtime, v3f acceleration)
 {
-       DSTACK("%s: typeid=%i, pos=(%f,%f,%f), speed=(%f,%f,%f)"
+       DSTACKF("%s: typeid=%i, pos=(%f,%f,%f), speed=(%f,%f,%f)"
                        ", dtime=%f, acc=(%f,%f,%f)",
                        __FUNCTION_NAME,
                        getTypeId(),
@@ -160,8 +161,8 @@ void MovingObject::move(float dtime, v3f acceleration)
                for(s16 x = oldpos_i.X - 1; x <= oldpos_i.X + 1; x++)
                {
                        try{
-                               if(content_walkable(m_block->getNodeParent(v3s16(x,y,z)).d)
-                                               == false)
+                               MapNode n = m_block->getNodeParent(v3s16(x,y,z));
+                               if(content_features(n).walkable == false)
                                        continue;
                        }
                        catch(InvalidPositionException &e)
@@ -283,7 +284,7 @@ void RatObject::addToScene(scene::ISceneManager *smgr)
        buf->getMaterial().setFlag(video::EMF_LIGHTING, false);
        buf->getMaterial().setFlag(video::EMF_BACK_FACE_CULLING, false);
        buf->getMaterial().setTexture
-                       (0, driver->getTexture(porting::getDataPath("rat.png").c_str()));
+                       (0, driver->getTexture(getTexturePath("rat.png").c_str()));
        buf->getMaterial().setFlag(video::EMF_BILINEAR_FILTER, false);
        buf->getMaterial().setFlag(video::EMF_FOG_ENABLE, true);
        buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
@@ -413,7 +414,7 @@ void PlayerObject::addToScene(scene::ISceneManager *smgr)
        // Set material
        buf->getMaterial().setFlag(video::EMF_LIGHTING, false);
        //buf->getMaterial().setFlag(video::EMF_BACK_FACE_CULLING, false);
-       buf->getMaterial().setTexture(0, driver->getTexture(porting::getDataPath("player.png").c_str()));
+       buf->getMaterial().setTexture(0, driver->getTexture(getTexturePath("player.png").c_str()));
        buf->getMaterial().setFlag(video::EMF_BILINEAR_FILTER, false);
        buf->getMaterial().setFlag(video::EMF_FOG_ENABLE, true);
        //buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
@@ -437,7 +438,7 @@ void PlayerObject::addToScene(scene::ISceneManager *smgr)
        // Set material
        buf->getMaterial().setFlag(video::EMF_LIGHTING, false);
        //buf->getMaterial().setFlag(video::EMF_BACK_FACE_CULLING, false);
-       buf->getMaterial().setTexture(0, driver->getTexture(porting::getDataPath("player_back.png").c_str()));
+       buf->getMaterial().setTexture(0, driver->getTexture(getTexturePath("player_back.png").c_str()));
        buf->getMaterial().setFlag(video::EMF_BILINEAR_FILTER, false);
        buf->getMaterial().setFlag(video::EMF_FOG_ENABLE, true);
        buf->getMaterial().MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
@@ -755,7 +756,7 @@ void MapBlockObjectList::step(float dtime, bool server, u32 daynight_ratio)
        core::map<s16, bool> ids_to_delete;
 
        {
-               DSTACK("%s: stepping objects", __FUNCTION_NAME);
+               DSTACKF("%s: stepping objects", __FUNCTION_NAME);
 
                for(core::map<s16, MapBlockObject*>::Iterator
                                i = m_objects.getIterator();
@@ -763,7 +764,7 @@ void MapBlockObjectList::step(float dtime, bool server, u32 daynight_ratio)
                {
                        MapBlockObject *obj = i.getNode()->getValue();
                        
-                       DSTACK("%s: stepping object type %i", __FUNCTION_NAME,
+                       DSTACKF("%s: stepping object type %i", __FUNCTION_NAME,
                                        obj->getTypeId());
 
                        if(server)
@@ -791,7 +792,7 @@ void MapBlockObjectList::step(float dtime, bool server, u32 daynight_ratio)
        }
 
        {
-               DSTACK("%s: deleting objects", __FUNCTION_NAME);
+               DSTACKF("%s: deleting objects", __FUNCTION_NAME);
 
                // Delete objects in delete queue
                for(core::map<s16, bool>::Iterator
@@ -815,7 +816,7 @@ void MapBlockObjectList::step(float dtime, bool server, u32 daynight_ratio)
                return;
        
        {
-               DSTACK("%s: object wrap loop", __FUNCTION_NAME);
+               DSTACKF("%s: object wrap loop", __FUNCTION_NAME);
 
                for(core::map<s16, MapBlockObject*>::Iterator
                                i = m_objects.getIterator();
@@ -856,16 +857,7 @@ bool MapBlockObjectList::wrapObject(MapBlockObject *object)
        assert(m_objects.find(object->m_id) != NULL);
        assert(m_objects[object->m_id] == object);
 
-       NodeContainer *parentcontainer = m_block->getParent();
-       // This will only work if the parent is the map
-       if(parentcontainer->nodeContainerId() != NODECONTAINER_ID_MAP)
-       {
-               dstream<<"WARNING: Wrapping object not possible: "
-                               "MapBlock's parent is not map"<<std::endl;
-               return true;
-       }
-       // OK, we have the map!
-       Map *map = (Map*)parentcontainer;
+       Map *map = m_block->getParent();
        
        // Calculate blockpos on map
        v3s16 oldblock_pos_i_on_map = m_block->getPosRelative();