a little backwards compatibility with coal
authorPerttu Ahola <celeron55@gmail.com>
Thu, 3 Feb 2011 13:59:59 +0000 (15:59 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Thu, 3 Feb 2011 13:59:59 +0000 (15:59 +0200)
src/mapblock.cpp
src/mapnode.cpp
src/mapnode.h

index b388a82c43270a12f60a422b62e9c99e7d7a2963..2c06fa82ad17d796719dbb26cd4660ab47435911 100644 (file)
@@ -1676,6 +1676,23 @@ void MapBlock::deSerialize(std::istream &is, u8 version)
                        data[i].param2 = s[i+nodecount*2];
                }
        }
+       
+       /*
+               Translate nodes as specified in the translate_to fields of
+               node features
+       */
+       for(u32 i=0; i<MAP_BLOCKSIZE*MAP_BLOCKSIZE*MAP_BLOCKSIZE; i++)
+       {
+               MapNode &n = data[i];
+
+               MapNode *translate_to = content_features(n.d).translate_to;
+               if(translate_to)
+               {
+                       dstream<<"MapBlock: WARNING: Translating node "<<n.d<<" to "
+                                       <<translate_to->d<<std::endl;
+                       n = *translate_to;
+               }
+       }
 }
 
 
index c5b252d8ee0fb100b83784015c941b0b4513d02e..2ba2a2dbfddac8ede3dc8276a790342ec58dd50d 100644 (file)
@@ -96,9 +96,10 @@ void init_mapnode(IIrrlichtWrapper *irrlicht)
        
        i = CONTENT_COALSTONE;
        f = &g_content_features[i];
-       f->translate_to = new MapNode(CONTENT_STONE, MINERAL_COAL);
-       /*f->setAllTextures(irrlicht->getTextureId("coalstone.png"));
-       f->is_ground_content = true;*/
+       //f->translate_to = new MapNode(CONTENT_STONE, MINERAL_COAL);
+       f->setAllTextures(TextureSpec(irrlicht->getTextureId("coal.png"),
+                       irrlicht->getTextureId("mineral_coal.png")));
+       f->is_ground_content = true;
        
        i = CONTENT_WOOD;
        f = &g_content_features[i];
index 4385f9acf118861f6d803bf83a113ef4e77d2636..5392e78669b93f58dcceb23820ad4755de608733 100644 (file)
@@ -638,6 +638,8 @@ struct MapNode
                }
 
                // Translate deprecated stuff
+               // NOTE: This doesn't get used because MapBlock handles node
+               // parameters directly
                MapNode *translate_to = content_features(d).translate_to;
                if(translate_to)
                {