Factor out the CVec direction list.
This commit is contained in:
@@ -73,5 +73,17 @@ namespace OpenRA
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString() { return "{0},{1}".F(X, Y); }
|
public override string ToString() { return "{0},{1}".F(X, Y); }
|
||||||
|
|
||||||
|
public static readonly CVec[] directions =
|
||||||
|
{
|
||||||
|
new CVec(-1, -1),
|
||||||
|
new CVec(-1, 0),
|
||||||
|
new CVec(-1, 1),
|
||||||
|
new CVec(0, -1),
|
||||||
|
new CVec(0, 1),
|
||||||
|
new CVec(1, -1),
|
||||||
|
new CVec(1, 0),
|
||||||
|
new CVec(1, 1),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
queue = new PriorityQueue<PathDistance>();
|
queue = new PriorityQueue<PathDistance>();
|
||||||
considered = new HashSet<CPos>();
|
considered = new HashSet<CPos>();
|
||||||
maxCost = 0;
|
maxCost = 0;
|
||||||
nextDirections = directions.Select(d => new Pair<CVec, int>(d, 0)).ToArray();
|
nextDirections = CVec.directions.Select(d => new Pair<CVec, int>(d, 0)).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PathSearch InReverse()
|
public PathSearch InReverse()
|
||||||
@@ -190,18 +190,6 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
return p.Location;
|
return p.Location;
|
||||||
}
|
}
|
||||||
|
|
||||||
static readonly CVec[] directions =
|
|
||||||
{
|
|
||||||
new CVec( -1, -1 ),
|
|
||||||
new CVec( -1, 0 ),
|
|
||||||
new CVec( -1, 1 ),
|
|
||||||
new CVec( 0, -1 ),
|
|
||||||
new CVec( 0, 1 ),
|
|
||||||
new CVec( 1, -1 ),
|
|
||||||
new CVec( 1, 0 ),
|
|
||||||
new CVec( 1, 1 ),
|
|
||||||
};
|
|
||||||
|
|
||||||
public void AddInitialCell(CPos location)
|
public void AddInitialCell(CPos location)
|
||||||
{
|
{
|
||||||
if (!world.Map.IsInMap(location.X, location.Y))
|
if (!world.Map.IsInMap(location.X, location.Y))
|
||||||
|
|||||||
Reference in New Issue
Block a user