public ushort YMax;// Y feature height
[ProtoMember(5)]
- public Dictionary<int,uint> RockRatio;//[Column] Geographic region (rock) Ratio. [BlockID * count]
+ public Dictionary<int, uint> RockRatio;//[Column] Geographic region (rock) Ratio. [BlockID * count]
[ProtoMember(6)]
public float Fertility;
//[ProtoMember(12,OverwriteList = true)]
[ProtoIgnore]
- public ushort[ , ] HeightMap;
+ public ushort[,] HeightMap;
public ColumnMeta(Vec2i loc, int chunkSize = 32)
{
- Location = loc;
- ChunkAge = TimeSpan.Zero;
- Temperature = 0f;
- YMax = 0;
- RockRatio = new Dictionary<int, uint>( 10 );
- Fertility = 0f;
- ForestDensity = 0f;
- Rainfall = 0f;
- ShrubDensity = 0f;
- AirBlocks = 0;
- NonAirBlocks = 0;
- HeightMap = new ushort[chunkSize, chunkSize];
- }
-
- internal void UpdateFieldsFrom(ClimateCondition climate, IMapChunk mapChunk ,TimeSpan chunkAge)
+ Location = loc;
+ ChunkAge = TimeSpan.Zero;
+ Temperature = 0f;
+ YMax = 0;
+ RockRatio = new Dictionary<int, uint>(10);
+ Fertility = 0f;
+ ForestDensity = 0f;
+ Rainfall = 0f;
+ ShrubDensity = 0f;
+ AirBlocks = 0;
+ NonAirBlocks = 0;
+ HeightMap = new ushort[chunkSize, chunkSize];
+ }
+
+ internal void UpdateFieldsFrom(ClimateCondition climate, IMapChunk mapChunk, TimeSpan chunkAge)
{
- this.ChunkAge = chunkAge;
- this.Temperature = climate.Temperature;
- this.Fertility = climate.Fertility;
- this.ForestDensity = climate.ForestDensity;
- this.Rainfall = climate.Rainfall;
- this.ShrubDensity = climate.ShrubDensity;
-
- this.YMax = mapChunk.YMax;
-
+ this.ChunkAge = chunkAge;
+ this.Temperature = climate.Temperature;
+ this.Fertility = climate.Fertility;
+ this.ForestDensity = climate.ForestDensity;
+ this.Rainfall = climate.Rainfall;
+ this.ShrubDensity = climate.ShrubDensity;
+
+ this.YMax = mapChunk.YMax;
+
}
}
public class ColumnsMetadata : KeyedCollection<Vec2i, ColumnMeta>
{
- private ColumnsMetadata( )
+ private ColumnsMetadata()
{
throw new NotSupportedException();
}
public ColumnsMetadata(Vec2i startChunkColumn)
{
- North_mostChunk = startChunkColumn.Y;
- South_mostChunk = startChunkColumn.Y;
- East_mostChunk = startChunkColumn.X;
- West_mostChunk = startChunkColumn.X;
+ North_mostChunk = startChunkColumn.Y;
+ South_mostChunk = startChunkColumn.Y;
+ East_mostChunk = startChunkColumn.X;
+ West_mostChunk = startChunkColumn.X;
}
- public int North_mostChunk {
+ public int North_mostChunk
+ {
get; private set;
}
- public int South_mostChunk {
+ public int South_mostChunk
+ {
get; private set;
}
- public int East_mostChunk {
+ public int East_mostChunk
+ {
get; private set;
}
- public int West_mostChunk {
+ public int West_mostChunk
+ {
get; private set;
}
protected override Vec2i GetKeyForItem(ColumnMeta item)
{
- return item.Location;
+ return item.Location;
}
internal void Update(ColumnMeta metaData)
{
- if (this.Contains(metaData.Location)) {
- this.Remove(metaData.Location);
- this.Add(metaData);
- }
- else {
- this.Add(metaData);
- }
+ if (this.Contains(metaData.Location))
+ {
+ this.Remove(metaData.Location);
+ this.Add(metaData);
+ }
+ else
+ {
+ this.Add(metaData);
+ }
}
public new void Add(ColumnMeta newItem)
{
- if (North_mostChunk > newItem.Location.Y) {
- North_mostChunk = newItem.Location.Y;
- }
-
- if (South_mostChunk < newItem.Location.Y) {
- South_mostChunk = newItem.Location.Y;
- }
-
- if (East_mostChunk < newItem.Location.X) {
- East_mostChunk = newItem.Location.X;
- }
-
- if (West_mostChunk > newItem.Location.X) {
- West_mostChunk = newItem.Location.X;
- }
-
- base.Add(newItem);
+ if (North_mostChunk > newItem.Location.Y)
+ {
+ North_mostChunk = newItem.Location.Y;
+ }
+
+ if (South_mostChunk < newItem.Location.Y)
+ {
+ South_mostChunk = newItem.Location.Y;
+ }
+
+ if (East_mostChunk < newItem.Location.X)
+ {
+ East_mostChunk = newItem.Location.X;
+ }
+
+ if (West_mostChunk > newItem.Location.X)
+ {
+ West_mostChunk = newItem.Location.X;
+ }
+
+ base.Add(newItem);
}
}