From: Perttu Ahola Date: Fri, 25 Nov 2011 15:00:50 +0000 (+0200) Subject: Make liquid_alternative_* to be strings X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=e5650bb54917ead2dccac9b46dfa1a00cd737694;p=zefram%2Fminetest%2Fminetest_engine.git Make liquid_alternative_* to be strings --- diff --git a/src/content_mapblock.cpp b/src/content_mapblock.cpp index 0bd2d226..8149d9f3 100644 --- a/src/content_mapblock.cpp +++ b/src/content_mapblock.cpp @@ -237,8 +237,8 @@ void mapblock_mesh_generate_special(MeshMakeData *data, bool top_is_same_liquid = false; MapNode ntop = data->m_vmanip.getNodeNoEx(blockpos_nodes + v3s16(x,y+1,z)); - content_t c_flowing = nodedef->get(n).liquid_alternative_flowing; - content_t c_source = nodedef->get(n).liquid_alternative_source; + content_t c_flowing = nodedef->getId(nodedef->get(n).liquid_alternative_flowing); + content_t c_source = nodedef->getId(nodedef->get(n).liquid_alternative_source); if(ntop.getContent() == c_flowing || ntop.getContent() == c_source) top_is_same_liquid = true; diff --git a/src/content_mapnode.cpp b/src/content_mapnode.cpp index eda252dc..878d6665 100644 --- a/src/content_mapnode.cpp +++ b/src/content_mapnode.cpp @@ -682,8 +682,8 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr) f.diggable = false; f.buildable_to = true; f.liquid_type = LIQUID_FLOWING; - f.liquid_alternative_flowing = CONTENT_WATER; - f.liquid_alternative_source = CONTENT_WATERSOURCE; + f.liquid_alternative_flowing = "water_flowing"; + f.liquid_alternative_source = "water_source"; f.liquid_viscosity = WATER_VISC; f.post_effect_color = video::SColor(64, 100, 100, 200); f.setSpecialMaterial(0, MaterialSpec("water.png", false)); @@ -705,8 +705,8 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr) f.buildable_to = true; f.liquid_type = LIQUID_SOURCE; f.dug_item = std::string("MaterialItem2 ")+itos(i)+" 1"; - f.liquid_alternative_flowing = CONTENT_WATER; - f.liquid_alternative_source = CONTENT_WATERSOURCE; + f.liquid_alternative_flowing = "water_flowing"; + f.liquid_alternative_source = "water_source"; f.liquid_viscosity = WATER_VISC; f.post_effect_color = video::SColor(64, 100, 100, 200); // New-style water source material (mostly unused) @@ -727,8 +727,8 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr) f.diggable = false; f.buildable_to = true; f.liquid_type = LIQUID_FLOWING; - f.liquid_alternative_flowing = CONTENT_LAVA; - f.liquid_alternative_source = CONTENT_LAVASOURCE; + f.liquid_alternative_flowing = "lava_flowing"; + f.liquid_alternative_source = "lava_source"; f.liquid_viscosity = LAVA_VISC; f.damage_per_second = 4*2; f.post_effect_color = video::SColor(192, 255, 64, 0); @@ -751,8 +751,8 @@ void content_mapnode_init(IWritableNodeDefManager *nodemgr) f.buildable_to = true; f.liquid_type = LIQUID_SOURCE; f.dug_item = std::string("MaterialItem2 ")+itos(i)+" 1"; - f.liquid_alternative_flowing = CONTENT_LAVA; - f.liquid_alternative_source = CONTENT_LAVASOURCE; + f.liquid_alternative_flowing = "lava_flowing"; + f.liquid_alternative_source = "lava_source"; f.liquid_viscosity = LAVA_VISC; f.damage_per_second = 4*2; f.post_effect_color = video::SColor(192, 255, 64, 0); diff --git a/src/map.cpp b/src/map.cpp index d27c6da1..822b3f65 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1602,7 +1602,7 @@ void Map::transformLiquids(core::map & modified_blocks) switch (liquid_type) { case LIQUID_SOURCE: liquid_level = LIQUID_LEVEL_SOURCE; - liquid_kind = nodemgr->get(n0).liquid_alternative_flowing; + liquid_kind = nodemgr->getId(nodemgr->get(n0).liquid_alternative_flowing); break; case LIQUID_FLOWING: liquid_level = (n0.param2 & LIQUID_LEVEL_MASK); @@ -1662,8 +1662,8 @@ void Map::transformLiquids(core::map & modified_blocks) case LIQUID_SOURCE: // if this node is not (yet) of a liquid type, choose the first liquid type we encounter if (liquid_kind == CONTENT_AIR) - liquid_kind = nodemgr->get(nb.n.getContent()).liquid_alternative_flowing; - if (nodemgr->get(nb.n.getContent()).liquid_alternative_flowing !=liquid_kind) { + liquid_kind = nodemgr->getId(nodemgr->get(nb.n).liquid_alternative_flowing); + if (nodemgr->getId(nodemgr->get(nb.n).liquid_alternative_flowing) != liquid_kind) { neutrals[num_neutrals++] = nb; } else { sources[num_sources++] = nb; @@ -1672,8 +1672,8 @@ void Map::transformLiquids(core::map & modified_blocks) case LIQUID_FLOWING: // if this node is not (yet) of a liquid type, choose the first liquid type we encounter if (liquid_kind == CONTENT_AIR) - liquid_kind = nodemgr->get(nb.n.getContent()).liquid_alternative_flowing; - if (nodemgr->get(nb.n.getContent()).liquid_alternative_flowing != liquid_kind) { + liquid_kind = nodemgr->getId(nodemgr->get(nb.n).liquid_alternative_flowing); + if (nodemgr->getId(nodemgr->get(nb.n).liquid_alternative_flowing) != liquid_kind) { neutrals[num_neutrals++] = nb; } else { flows[num_flows++] = nb; @@ -1694,7 +1694,7 @@ void Map::transformLiquids(core::map & modified_blocks) // liquid_kind will be set to either the flowing alternative of the node (if it's a liquid) // or the flowing alternative of the first of the surrounding sources (if it's air), so // it's perfectly safe to use liquid_kind here to determine the new node content. - new_node_content = nodemgr->get(liquid_kind).liquid_alternative_source; + new_node_content = nodemgr->getId(nodemgr->get(liquid_kind).liquid_alternative_source); } else if (num_sources == 1 && sources[0].t != NEIGHBOR_LOWER) { // liquid_kind is set properly, see above new_node_content = liquid_kind; diff --git a/src/nodedef.cpp b/src/nodedef.cpp index 956bc1a5..52d9fc8b 100644 --- a/src/nodedef.cpp +++ b/src/nodedef.cpp @@ -144,8 +144,8 @@ void ContentFeatures::reset() extra_dug_item_rarity = 2; metadata_name = ""; liquid_type = LIQUID_NONE; - liquid_alternative_flowing = CONTENT_IGNORE; - liquid_alternative_source = CONTENT_IGNORE; + liquid_alternative_flowing = ""; + liquid_alternative_source = ""; liquid_viscosity = 0; light_source = 0; damage_per_second = 0; @@ -192,8 +192,8 @@ void ContentFeatures::serialize(std::ostream &os) writeS32(os, extra_dug_item_rarity); os<