forked from RosaryMala/DwarvenRealms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmapData.cs
81 lines (71 loc) · 2.37 KB
/
mapData.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
namespace DwarvenRealms
{
public struct internalData
{
public int riverType;
public Structures.Type structureType;
public int waterLevel;
public int riverLevel;
public int biomeIndex;
public int height;
public internalData(int height, int biome, int riverType, int riverLevel, int waterLevel, Structures.Type structureType)
{
this.riverLevel = riverLevel;
this.structureType = structureType;
this.waterLevel = waterLevel;
this.height = height;
this.biomeIndex = biome;
this.riverType = riverType;
}
}
class mapData
{
internalData[,] data;
int offsetX;
int offsetY;
public mapData(int x, int y, int offsetX, int offsetY)
{
this.data = new internalData[x, y];
this.offsetX = offsetX;
this.offsetY = offsetY;
}
public static internalData defaultData = new internalData(-1, -1, -1, -1, -1, Structures.Type.Unknown);
public void setAll(internalData id, int x, int y)
{
this.data[x-offsetX, y-offsetY] = id;
}
public void setStructure(Structures.Type v, int x, int y)
{
this.data[x-offsetX, y-offsetY].structureType = v;
}
public void setHeight(int v, int x, int y)
{
this.data[x-offsetX, y-offsetY].height = v;
}
public void setBiome(int v, int x, int y)
{
this.data[x-offsetX, y-offsetY].biomeIndex = v;
}
public void setWaterLevel(int v, int x, int y)
{
this.data[x-offsetX, y-offsetY].waterLevel = v;
}
public void setRiverLevel(int v, int x, int y)
{
this.data[x-offsetX, y-offsetY].riverLevel = v;
}
public void setRiverType(int v, int x, int y)
{
this.data[x-offsetX, y-offsetY].riverType = v;
}
public internalData getInternalData(int x, int y)
{
if (x-offsetX > this.data.GetUpperBound(0) || x - offsetX < this.data.GetLowerBound(0) ||
y - offsetY> this.data.GetUpperBound(1) || y - offsetY < this.data.GetLowerBound(1))
{
return mapData.defaultData;
}
return this.data[x-offsetX, y-offsetY];
}
}
}