removed alternative name "pressure" from param2

This commit is contained in:
Perttu Ahola 2011-01-25 09:53:21 +02:00
parent de3fdba568
commit d3a6a12bae
6 changed files with 41 additions and 66 deletions

View File

@ -236,7 +236,7 @@ Map:
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?
@ -247,17 +247,32 @@ TODO: Map generator version 2
- 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:
----------

View File

@ -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));

View File

@ -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];
}
}
}

View File

@ -375,11 +375,6 @@ struct MapNode
{
u8 param2;
/*
Pressure for liquids
*/
u8 pressure;
/*
Direction for torches and other stuff.
Format is freeform. e.g. packDir or encode_dirs can be used.
@ -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];
}
}
};

View File

@ -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);

View File

@ -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)