diff options
Diffstat (limited to 'src/content_mapnode.cpp')
-rw-r--r-- | src/content_mapnode.cpp | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/src/content_mapnode.cpp b/src/content_mapnode.cpp index d82ccc5c9..e2aed2458 100644 --- a/src/content_mapnode.cpp +++ b/src/content_mapnode.cpp @@ -31,6 +31,59 @@ void setStoneLikeDiggingProperties(DiggingPropertiesList &list, float toughness) void setDirtLikeDiggingProperties(DiggingPropertiesList &list, float toughness); void setWoodLikeDiggingProperties(DiggingPropertiesList &list, float toughness); +content_t trans_table_19[][2] = { + {CONTENT_GRASS, 1}, + {CONTENT_TREE, 4}, + {CONTENT_LEAVES, 5}, + {CONTENT_GRASS_FOOTSTEPS, 6}, + {CONTENT_MESE, 7}, + {CONTENT_MUD, 8}, + {CONTENT_CLOUD, 10}, + {CONTENT_COALSTONE, 11}, + {CONTENT_WOOD, 12}, + {CONTENT_SAND, 13}, + {CONTENT_COBBLE, 18}, + {CONTENT_STEEL, 19}, + {CONTENT_GLASS, 20}, + {CONTENT_MOSSYCOBBLE, 22}, + {CONTENT_GRAVEL, 23}, +}; + +MapNode mapnode_translate_from_internal(MapNode n_from, u8 version) +{ + MapNode result = n_from; + if(version <= 19) + { + content_t c_from = n_from.getContent(); + for(u32 i=0; i<sizeof(trans_table_19)/sizeof(trans_table_19[0]); i++) + { + if(trans_table_19[i][0] == c_from) + { + result.setContent(trans_table_19[i][1]); + break; + } + } + } + return result; +} +MapNode mapnode_translate_to_internal(MapNode n_from, u8 version) +{ + MapNode result = n_from; + if(version <= 19) + { + content_t c_from = n_from.getContent(); + for(u32 i=0; i<sizeof(trans_table_19)/sizeof(trans_table_19[0]); i++) + { + if(trans_table_19[i][1] == c_from) + { + result.setContent(trans_table_19[i][0]); + break; + } + } + } + return result; +} + void content_mapnode_init() { // Read some settings @@ -38,7 +91,7 @@ void content_mapnode_init() bool new_style_leaves = g_settings.getBool("new_style_leaves"); bool invisible_stone = g_settings.getBool("invisible_stone"); - u8 i; + content_t i; ContentFeatures *f = NULL; i = CONTENT_STONE; |