From d3a6a12baea7317f6765ae7541cbc453f83d7928 Mon Sep 17 00:00:00 2001
From: Perttu Ahola <celeron55@gmail.com>
Date: Tue, 25 Jan 2011 09:53:21 +0200
Subject: [PATCH] removed alternative name "pressure" from param2

---
 src/main.cpp     | 23 +++++++++++++++++++----
 src/map.cpp      |  8 ++++++--
 src/mapblock.cpp | 20 ++++++++++----------
 src/mapnode.h    | 15 +++++----------
 src/tile.cpp     | 39 ---------------------------------------
 src/voxel.cpp    |  2 +-
 6 files changed, 41 insertions(+), 66 deletions(-)

diff --git a/src/main.cpp b/src/main.cpp
index 858d25fa1..171f1538a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -236,7 +236,7 @@ Block object server side:
 NOTE: There are some lighting-related todos and fixmes in
       ServerMap::emergeBlock. And there always will be. 8)
 
-TODO: Map generator version 2
+FEATURE: Map generator version 2
 	- Create surface areas based on central points; a given point's
 	  area type is given by the nearest central point
 	  - Separate points for heightmap, caves, plants and minerals?
@@ -246,18 +246,33 @@ TODO: Map generator version 2
 	  where some minerals are found
 	- Create a system that allows a huge amount of different "map
 	  generator modules/filters"
+	  
+FEATURE: The map could be generated procedually:
+      - This would need the map to be generated in larger pieces
+	    - How large? How do they connect to each other?
+      * Make the stone level with a heightmap
+	  * Carve out stuff in the stone
+	  * Dump dirt all around, and simulate it falling off steep
+	    places
+	  * Erosion simulation at map generation time
+		- Simulate water flows, which would carve out dirt fast and
+		  then turn stone into gravel and sand and relocate it.
+		- How about relocating minerals, too? Coal and gold in
+		  downstream sand and gravel would be kind of cool
+		  - This would need a better way of handling minerals, mainly
+		    to have mineral content as a separate field
+		- Simulate rock falling from cliffs when water has removed
+		  enough solid rock from the bottom
 
 TODO: Change AttributeList to split the area into smaller sections so
       that searching won't be as heavy.
-TODO: Change AttributeList to be 2D, as it would be too slow to search
-      in 3D fields anyway.
 
 TODO: Remove HMParams
 
 TODO: Flowing water to actually contain flow direction information
 
 TODO: Remove duplicate lighting implementation from Map (leave
-      VoxelManipulator)
+      VoxelManipulator, which is faster)
 
 Doing now:
 ----------
diff --git a/src/map.cpp b/src/map.cpp
index bbcc0f36f..0b5872e05 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -1804,7 +1804,7 @@ ServerMap::ServerMap(std::string savedir, HMParams hmp, MapParams mp):
 			float randmax = 0;
 			float randfactor = 0;
 
-			if(myrand()%5 == 0)
+			/*if(myrand()%5 == 0)
 			{
 				baseheight = 100;
 				randmax = 50;
@@ -1833,7 +1833,11 @@ ServerMap::ServerMap(std::string savedir, HMParams hmp, MapParams mp):
 				baseheight = -3;
 				randmax = 20;
 				randfactor = 0.5;
-			}
+			}*/
+			
+			baseheight = 0;
+			randmax = 15;
+			randfactor = 0.63;
 
 			list_baseheight->addPoint(p, Attribute(baseheight));
 			list_randmax->addPoint(p, Attribute(randmax));
diff --git a/src/mapblock.cpp b/src/mapblock.cpp
index 620c29fdd..3eb65b4da 100644
--- a/src/mapblock.cpp
+++ b/src/mapblock.cpp
@@ -1504,13 +1504,13 @@ void MapBlock::serialize(std::ostream &os, u8 version)
 		
 		if(version >= 10)
 		{
-			// Get and compress pressure
-			SharedBuffer<u8> pressuredata(nodecount);
+			// Get and compress param2
+			SharedBuffer<u8> param2data(nodecount);
 			for(u32 i=0; i<nodecount; i++)
 			{
-				pressuredata[i] = data[i].pressure;
+				param2data[i] = data[i].param2;
 			}
-			compress(pressuredata, os, version);
+			compress(param2data, os, version);
 		}
 	}
 	// All other versions (newest)
@@ -1544,10 +1544,10 @@ void MapBlock::serialize(std::ostream &os, u8 version)
 			databuf[i+nodecount] = data[i].param;
 		}
 
-		// Get pressure
+		// Get param2
 		for(u32 i=0; i<nodecount; i++)
 		{
-			databuf[i+nodecount*2] = data[i].pressure;
+			databuf[i+nodecount*2] = data[i].param2;
 		}
 
 		/*
@@ -1621,7 +1621,7 @@ void MapBlock::deSerialize(std::istream &is, u8 version)
 	
 		if(version >= 10)
 		{
-			// Uncompress and set pressure data
+			// Uncompress and set param2 data
 			std::ostringstream os(std::ios_base::binary);
 			decompress(is, os, version);
 			std::string s = os.str();
@@ -1630,7 +1630,7 @@ void MapBlock::deSerialize(std::istream &is, u8 version)
 						("MapBlock::deSerialize: invalid format");
 			for(u32 i=0; i<s.size(); i++)
 			{
-				data[i].pressure = s[i];
+				data[i].param2 = s[i];
 			}
 		}
 	}
@@ -1662,10 +1662,10 @@ void MapBlock::deSerialize(std::istream &is, u8 version)
 		{
 			data[i].param = s[i+nodecount];
 		}
-		// Set pressure
+		// Set param2
 		for(u32 i=0; i<nodecount; i++)
 		{
-			data[i].pressure = s[i+nodecount*2];
+			data[i].param2 = s[i+nodecount*2];
 		}
 	}
 }
diff --git a/src/mapnode.h b/src/mapnode.h
index 286edcc2b..69a5a08cd 100644
--- a/src/mapnode.h
+++ b/src/mapnode.h
@@ -374,11 +374,6 @@ struct MapNode
 	union
 	{
 		u8 param2;
-		
-		/*
-			Pressure for liquids
-		*/
-		u8 pressure;
 
 		/*
 			Direction for torches and other stuff.
@@ -392,18 +387,18 @@ struct MapNode
 		*this = n;
 	}
 	
-	MapNode(u8 data=CONTENT_AIR, u8 a_param=0, u8 a_pressure=0)
+	MapNode(u8 data=CONTENT_AIR, u8 a_param=0, u8 a_param2=0)
 	{
 		d = data;
 		param = a_param;
-		pressure = a_pressure;
+		param2 = a_param2;
 	}
 
 	bool operator==(const MapNode &other)
 	{
 		return (d == other.d
 				&& param == other.param
-				&& pressure == other.pressure);
+				&& param2 == other.param2);
 	}
 
 	bool light_propagates()
@@ -557,7 +552,7 @@ struct MapNode
 		{
 			dest[0] = d;
 			dest[1] = param;
-			dest[2] = pressure;
+			dest[2] = param2;
 		}
 	}
 	void deSerialize(u8 *source, u8 version)
@@ -587,7 +582,7 @@ struct MapNode
 		{
 			d = source[0];
 			param = source[1];
-			pressure = source[2];
+			param2 = source[2];
 		}
 	}
 };
diff --git a/src/tile.cpp b/src/tile.cpp
index 79d68d4c3..18a2f155a 100644
--- a/src/tile.cpp
+++ b/src/tile.cpp
@@ -23,51 +23,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "main.h"
 #include <string>
 
-// A mapping from tiles to paths of textures
-
-/*const char * g_tile_texture_filenames[TILES_COUNT] =
-{
-	NULL,
-	"stone.png",
-	"water.png",
-	"grass.png",
-	"tree.png",
-	"leaves.png",
-	"grass_footsteps.png",
-	"mese.png",
-	"mud.png",
-	"tree_top.png",
-	"mud.png_sidegrass",
-	"cloud.png",
-	"coalstone.png",
-	"wood.png",
-};*/
-
 /*
 	These can either be real paths or generated names of preloaded
 	textures (like "mud.png_sidegrass")
 */
 std::string g_tile_texture_paths[TILES_COUNT];
 
-/*std::string g_tile_texture_path_strings[TILES_COUNT];
-const char * g_tile_texture_paths[TILES_COUNT] = {0};
-
-void init_tile_texture_paths()
-{
-	for(s32 i=0; i<TILES_COUNT; i++)
-	{
-		const char *filename = g_tile_texture_filenames[i];
-
-		if(filename != NULL)
-		{
-			g_tile_texture_path_strings[i] =
-					porting::getDataPath(filename);
-			g_tile_texture_paths[i] =
-					g_tile_texture_path_strings[i].c_str();
-		}
-	}
-}*/
-
 const char * tile_texture_path_get(u32 i)
 {
 	assert(i < TILES_COUNT);
diff --git a/src/voxel.cpp b/src/voxel.cpp
index a0cc44d71..272e11ccc 100644
--- a/src/voxel.cpp
+++ b/src/voxel.cpp
@@ -96,7 +96,7 @@ void VoxelManipulator::print(std::ostream &o, VoxelPrintMode mode)
 				{
 					c = 'X';
 					u8 m = m_data[m_area.index(x,y,z)].d;
-					u8 pr = m_data[m_area.index(x,y,z)].pressure;
+					u8 pr = m_data[m_area.index(x,y,z)].param2;
 					if(mode == VOXELPRINT_MATERIAL)
 					{
 						if(m <= 9)
-- 
GitLab