nexusforever/Source/NexusForever.MapGenerator/IO/Map/WritableMapFileGrid.cs
Rawaho 7bd3966fe8 Implemented base map files.
Currently only contain zones information, in the future terrain height, auras and liquid data will be stored in them too.
2019-01-29 22:48:40 +13:00

34 lines
805 B
C#

using System;
using System.IO;
using NexusForever.Shared.IO;
using NexusForever.Shared.IO.Map;
namespace NexusForever.MapGenerator.IO.Map
{
public class WritableMapFileGrid : MapFileGrid, IWritable
{
public WritableMapFileGrid(uint x, uint y)
{
X = x;
Y = y;
}
public void Write(BinaryWriter writer)
{
writer.Write(X);
writer.Write(Y);
writer.Write(cells.Count);
foreach (WritableMapFileCell cell in cells.Values)
cell.Write(writer);
}
public void AddCell(WritableMapFileCell cell)
{
if (cell == null)
throw new ArgumentNullException();
cells.Add((cell.X << 16) | cell.Y, cell);
}
}
}