Remove no-op mapgen::add_random_objects
authorPerttu Ahola <celeron55@gmail.com>
Mon, 30 Jan 2012 17:22:05 +0000 (19:22 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Tue, 27 Mar 2012 16:01:52 +0000 (19:01 +0300)
src/mapgen.cpp
src/mapgen.h

index 5cab6eab9ba4e97108d838f9dd884f5d6ee8580d..56f81434261c8b8491d6b94f68fa693b0264cf67 100644 (file)
@@ -1415,75 +1415,6 @@ bool get_have_sand(u64 seed, v2s16 p2d)
        return (sandnoise > -0.15);
 }
 
-/*
-       Adds random objects to block, depending on the content of the block
-*/
-void add_random_objects(MapBlock *block)
-{
-#if 0
-       for(s16 z0=0; z0<MAP_BLOCKSIZE; z0++)
-       for(s16 x0=0; x0<MAP_BLOCKSIZE; x0++)
-       {
-               bool last_node_walkable = false;
-               for(s16 y0=0; y0<MAP_BLOCKSIZE; y0++)
-               {
-                       v3s16 p(x0,y0,z0);
-                       MapNode n = block->getNodeNoEx(p);
-                       if(n.getContent() == CONTENT_IGNORE)
-                               continue;
-                       if(data->nodedef->get(n)->liquid_type != LIQUID_NONE)
-                               continue;
-                       if(data->nodedef->get(n)->walkable)
-                       {
-                               last_node_walkable = true;
-                               continue;
-                       }
-                       if(last_node_walkable)
-                       {
-                               // If block contains light information
-                               if(content_features(n).param_type == CPT_LIGHT)
-                               {
-                                       if(n.getLight(LIGHTBANK_DAY) <= 3)
-                                       {
-                                               if(myrand() % 300 == 0)
-                                               {
-                                                       v3f pos_f = intToFloat(p+block->getPosRelative(), BS);
-                                                       pos_f.Y -= BS*0.4;
-                                                       ServerActiveObject *obj = new RatSAO(NULL, 0, pos_f);
-                                                       std::string data = obj->getStaticData();
-                                                       StaticObject s_obj(obj->getType(),
-                                                                       obj->getBasePosition(), data);
-                                                       // Add some
-                                                       block->m_static_objects.insert(0, s_obj);
-                                                       block->m_static_objects.insert(0, s_obj);
-                                                       block->m_static_objects.insert(0, s_obj);
-                                                       block->m_static_objects.insert(0, s_obj);
-                                                       block->m_static_objects.insert(0, s_obj);
-                                                       block->m_static_objects.insert(0, s_obj);
-                                                       delete obj;
-                                               }
-                                               if(myrand() % 1000 == 0)
-                                               {
-                                                       v3f pos_f = intToFloat(p+block->getPosRelative(), BS);
-                                                       pos_f.Y -= BS*0.4;
-                                                       ServerActiveObject *obj = new Oerkki1SAO(NULL,0,pos_f);
-                                                       std::string data = obj->getStaticData();
-                                                       StaticObject s_obj(obj->getType(),
-                                                                       obj->getBasePosition(), data);
-                                                       // Add one
-                                                       block->m_static_objects.insert(0, s_obj);
-                                                       delete obj;
-                                               }
-                                       }
-                               }
-                       }
-                       last_node_walkable = false;
-               }
-       }
-       block->raiseModified(MOD_STATE_WRITE_NEEDED, "mapgen::add_random_objects");
-#endif
-}
-
 void make_block(BlockMakeData *data)
 {
        if(data->no_op)
index 20eefea29728adbe72d0b395722f212848f73f78..24a853bdccb14f897a7e66602d023b8318d8d496 100644 (file)
@@ -39,9 +39,6 @@ namespace mapgen
        // Main map generation routine
        void make_block(BlockMakeData *data);
        
-       // Add objects according to block content
-       void add_random_objects(MapBlock *block);
-
        // Add a tree
        void make_tree(ManualMapVoxelManipulator &vmanip, v3s16 p0,
                        bool is_apple_tree, INodeDefManager *ndef);
@@ -51,7 +48,6 @@ namespace mapgen
        */
        bool get_have_sand(u64 seed, v2s16 p2d);
        double tree_amount_2d(u64 seed, v2s16 p);
-       
 
        struct BlockMakeData
        {