Use defines for liquid levels
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 16 Aug 2011 06:31:33 +0000 (08:31 +0200)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 16 Aug 2011 14:50:38 +0000 (16:50 +0200)
src/map.cpp
src/mapnode.h

index a540860bc225b6d84772be53f3de7f516d58929c..94cf2e864647be9b380506a4815bbd7777330e2c 100644 (file)
@@ -1584,7 +1584,7 @@ void Map::transformLiquids(core::map<v3s16, MapBlock*> & modified_blocks)
                LiquidType liquid_type = content_features(n0.getContent()).liquid_type;
                switch (liquid_type) {
                        case LIQUID_SOURCE:
-                               liquid_level = 8;
+                               liquid_level = LIQUID_LEVEL_SOURCE;
                                liquid_kind = content_features(n0.getContent()).liquid_alternative_flowing;
                                break;
                        case LIQUID_FLOWING:
@@ -1674,7 +1674,7 @@ void Map::transformLiquids(core::map<v3s16, MapBlock*> & modified_blocks)
                } else if (num_sources == 1 && sources[0].t != NEIGHBOR_LOWER) {
                        // liquid_kind is set properly, see above
                        new_node_content = liquid_kind;
-                       new_node_level = 7;
+                       new_node_level = LIQUID_LEVEL_MAX;
                } else {
                        // no surrounding sources, so get the maximum level that can flow into this node
                        for (u16 i = 0; i < num_flows; i++) {
@@ -1682,8 +1682,8 @@ void Map::transformLiquids(core::map<v3s16, MapBlock*> & modified_blocks)
                                switch (flows[i].t) {
                                        case NEIGHBOR_UPPER:
                                                if (nb_liquid_level + WATER_DROP_BOOST > new_node_level) {
-                                                       new_node_level = 7;
-                                                       if (nb_liquid_level + WATER_DROP_BOOST < 7)
+                                                       new_node_level = LIQUID_LEVEL_MAX;
+                                                       if (nb_liquid_level + WATER_DROP_BOOST < LIQUID_LEVEL_MAX)
                                                                new_node_level = nb_liquid_level + WATER_DROP_BOOST;
                                                }
                                                break;
index 3101a9fc142d752975f5f60aa08dc8173f22d4f8..77f6b321f631b599db4c847fa924fd1f630d0a29 100644 (file)
@@ -424,6 +424,10 @@ enum LightBank
 #define LIQUID_LEVEL_MASK 0x07
 #define LIQUID_FLOW_DOWN_MASK 0x08
 
+/* maximum amount of liquid in a block */
+#define LIQUID_LEVEL_MAX LIQUID_LEVEL_MASK
+#define LIQUID_LEVEL_SOURCE (LIQUID_LEVEL_MAX+1)
+
 /*
        This is the stuff what the whole world consists of.
 */