aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-02-03 15:59:59 +0200
committerPerttu Ahola <celeron55@gmail.com>2011-02-03 15:59:59 +0200
commit6bb9de3cc63ea2e8a848ffda222a5e66cb7c5f45 (patch)
treeea99076951a7b9c4464696f6ecf0bca8c1e68eef /src
parent44ce9018dd393ce0c8dad6ae40d26d8c5c656529 (diff)
downloadminetest-6bb9de3cc63ea2e8a848ffda222a5e66cb7c5f45.tar.gz
minetest-6bb9de3cc63ea2e8a848ffda222a5e66cb7c5f45.tar.bz2
minetest-6bb9de3cc63ea2e8a848ffda222a5e66cb7c5f45.zip
a little backwards compatibility with coal
Diffstat (limited to 'src')
-rw-r--r--src/mapblock.cpp17
-rw-r--r--src/mapnode.cpp7
-rw-r--r--src/mapnode.h2
3 files changed, 23 insertions, 3 deletions
diff --git a/src/mapblock.cpp b/src/mapblock.cpp
index b388a82c4..2c06fa82a 100644
--- a/src/mapblock.cpp
+++ b/src/mapblock.cpp
@@ -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;
+ }
+ }
}
diff --git a/src/mapnode.cpp b/src/mapnode.cpp
index c5b252d8e..2ba2a2dbf 100644
--- a/src/mapnode.cpp
+++ b/src/mapnode.cpp
@@ -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];
diff --git a/src/mapnode.h b/src/mapnode.h
index 4385f9acf..5392e7866 100644
--- a/src/mapnode.h
+++ b/src/mapnode.h
@@ -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)
{