made a real terrain type for it; still not quite right though. will crash on snow maps atm too.

This commit is contained in:
Chris Forbes
2010-01-18 23:22:00 +13:00
parent 3101ffa671
commit faf28a90ae
10 changed files with 26 additions and 7 deletions

View File

@@ -23,16 +23,17 @@ namespace OpenRa
Wall = 7,
Beach = 8,
Ore = 9,
Special = 10,
}
static class TerrainCosts
{
static double[][] costs = Util.MakeArray<double[]>( 4,
a => Util.MakeArray<double>( 10, b => double.PositiveInfinity ));
a => Util.MakeArray<double>( 11, b => double.PositiveInfinity ));
static TerrainCosts()
{
for( int i = 0 ; i < 10 ; i++ )
for( int i = 0 ; i < 11 ; i++ )
{
if( i == 4 ) continue;
var section = Rules.AllRules.GetSection( ( (TerrainMovementType)i ).ToString() );
@@ -46,6 +47,7 @@ namespace OpenRa
public static double Cost( UnitMovementType unitMovementType, int r )
{
if (r >= 10) return 1.0;
return costs[ (byte)unitMovementType ][ r ];
}
}