Load map smudges

This commit is contained in:
Paul Chote
2010-04-08 19:59:07 +12:00
committed by Bob
parent 60bc0c3f69
commit f5787476f7
8 changed files with 24 additions and 4 deletions

View File

@@ -90,7 +90,7 @@ namespace OpenRA.FileFormats
foreach (var kv in yaml["Actors"].Nodes)
{
string[] vals = kv.Value.Value.Split(' ');
string[] loc = vals[1].Split(',');
string[] loc = vals[2].Split(',');
var a = new ActorReference(vals[0], new int2(int.Parse(loc[0]),int.Parse(loc[1])) ,vals[2]);
Actors.Add(kv.Key,a);
}
@@ -99,9 +99,10 @@ namespace OpenRA.FileFormats
foreach (var kv in yaml["Smudges"].Nodes)
{
string[] vals = kv.Key.Split(' ');
string[] loc = vals[2].Split(',');
Smudges.Add(new SmudgeReference(vals[0], new int2(int.Parse(loc[0]),int.Parse(loc[1])) ,int.Parse(vals[1])));
string[] loc = vals[1].Split(',');
Smudges.Add(new SmudgeReference(vals[0], new int2(int.Parse(loc[0]),int.Parse(loc[1])) ,int.Parse(vals[2])));
}
// Rules
Rules = yaml["Rules"].Nodes;

View File

@@ -54,7 +54,14 @@ namespace OpenRA.Traits
world = w;
tiles = new TileReference<byte,byte>[w.Map.MapSize.X,w.Map.MapSize.Y];
// TODO: Parse map and add initial smudges
// Add map smudges
foreach (var s in w.Map.Smudges)
{
if (!Info.Types.Contains(s.Type))
continue;
tiles[s.Location.X,s.Location.Y] = new TileReference<byte,byte>((byte)Array.IndexOf(Info.Types,s.Type),
(byte)s.Depth);
}
}
public void AddSmudge(int2 loc)

View File

@@ -90,5 +90,7 @@ Waypoints:
spawn1: 18,12
spawn0: 5,19
Smudges:
Rules:

View File

@@ -56,5 +56,7 @@ Waypoints:
spawn1: 33,16
spawn0: 6,16
Smudges:
Rules:

View File

@@ -73,5 +73,7 @@ Waypoints:
spawn1: 57,59
spawn0: 49,4
Smudges:
Rules:

View File

@@ -105,5 +105,7 @@ Waypoints:
spawn6: 19,52
spawn7: 95,65
Smudges:
Rules:

View File

@@ -57,5 +57,7 @@ Waypoints:
spawn0: 34,84
spawn1: 35,34
Smudges:
Rules:

View File

@@ -54,5 +54,7 @@ Waypoints:
spawn3: 47,81
spawn4: 47,81
Smudges:
Rules: