PathFinder doesn't really need it's own ref to Rules.Map
This commit is contained in:
@@ -1,31 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ClassDiagram MajorVersion="1" MinorVersion="1">
|
||||
<Class Name="OpenRa.Game.Game">
|
||||
<Position X="6.75" Y="3.25" Width="1.5" />
|
||||
<Position X="9.5" Y="9.25" Width="1.5" />
|
||||
<Members>
|
||||
<Method Name="FindUnits" Hidden="true" />
|
||||
<Field Name="lastTime" Hidden="true" />
|
||||
<Method Name="LoadMapBuildings" Hidden="true" />
|
||||
<Method Name="LoadMapUnits" Hidden="true" />
|
||||
<Method Name="LoadSound" Hidden="true" />
|
||||
<Field Name="localPlayerIndex" Hidden="true" />
|
||||
<Field Name="oreFrequency" Hidden="true" />
|
||||
<Field Name="oreTicks" Hidden="true" />
|
||||
<Field Name="soundEngine" Hidden="true" />
|
||||
<Field Name="sounds" Hidden="true" />
|
||||
</Members>
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAbAkDQAABBAAQEEBEECEggYQUBEAAAAIYALBCAA0iA=</HashCode>
|
||||
<HashCode>AAaAkDQAABJAAQEEBEECEgAQQUBAAAAAIYAKBCAAwiA=</HashCode>
|
||||
<FileName>Game.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<ShowAsAssociation>
|
||||
<Field Name="world" />
|
||||
<Field Name="viewport" />
|
||||
<Field Name="controller" />
|
||||
<Field Name="PathFinder" />
|
||||
</ShowAsAssociation>
|
||||
</Class>
|
||||
<Class Name="OpenRa.Game.Controller">
|
||||
<Position X="3.5" Y="6.5" Width="1.75" />
|
||||
<Position X="6.5" Y="10.75" Width="1.75" />
|
||||
<Members>
|
||||
<Method Name="ApplyOrders" Hidden="true" />
|
||||
<Field Name="dragEnd" Hidden="true" />
|
||||
@@ -33,7 +29,7 @@
|
||||
<Field Name="recentOrders" Hidden="true" />
|
||||
</Members>
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAACAACoAAAAAAAAAAQCEgQAABAAAAAAAAAABAACCAA=</HashCode>
|
||||
<HashCode>ACACAACoAAAAAAAAAAQDEgQAABAAAAAAAAAAKAACCAA=</HashCode>
|
||||
<FileName>Controller.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<ShowAsAssociation>
|
||||
@@ -42,14 +38,14 @@
|
||||
<Lollipop Position="0.2" />
|
||||
</Class>
|
||||
<Class Name="OpenRa.Game.Graphics.Viewport">
|
||||
<Position X="3.75" Y="0.5" Width="1.5" />
|
||||
<Position X="12.5" Y="10.25" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAIAAAAABAAACABCAAYAEEAAAABAAAAAAAAgAEEAwBE=</HashCode>
|
||||
<HashCode>AAIAAAAABAAACABCAAYAEEAAAABAAAAAAAAgAEEIwBE=</HashCode>
|
||||
<FileName>Graphics\Viewport.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="OpenRa.Game.World">
|
||||
<Position X="12.75" Y="7.25" Width="1.5" />
|
||||
<Position X="4.75" Y="17.25" Width="1.5" />
|
||||
<Members>
|
||||
<Field Name="actors" Hidden="true" />
|
||||
<Field Name="effects" Hidden="true" />
|
||||
@@ -62,74 +58,79 @@
|
||||
</TypeIdentifier>
|
||||
<ShowAsCollectionAssociation>
|
||||
<Property Name="Actors" />
|
||||
<Property Name="Effects" />
|
||||
</ShowAsCollectionAssociation>
|
||||
</Class>
|
||||
<Class Name="OpenRa.Game.Actor">
|
||||
<Position X="15.75" Y="6.75" Width="1.5" />
|
||||
<Position X="9.5" Y="16.75" Width="1.5" />
|
||||
<Members>
|
||||
<Field Name="currentActivity" Hidden="true" />
|
||||
</Members>
|
||||
<TypeIdentifier>
|
||||
<HashCode>AgEACAiAAAAAAAAAAQIAEIAkAQQAAAAAABAgAAAAQgA=</HashCode>
|
||||
<HashCode>AgEACACAAAAAAAAAAQIAEIAkAQQAAAAAABAgAEAAQgA=</HashCode>
|
||||
<FileName>Actor.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
<ShowAsAssociation>
|
||||
<Field Name="unitInfo" />
|
||||
<Field Name="Owner" />
|
||||
</ShowAsAssociation>
|
||||
</Class>
|
||||
<Class Name="OpenRa.Game.GameRules.UnitInfo" Collapsed="true">
|
||||
<Position X="18.75" Y="10.75" Width="1.5" />
|
||||
<Position X="11" Y="1.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>ACAAAAKAAJAgwiAAgAAAgFQAJAhQAHAAGCACAADIRAA=</HashCode>
|
||||
<HashCode>ACIAAAKAAJAgwiAAgAAAgFQAJAhQAHAAGCACAADIRAA=</HashCode>
|
||||
<FileName>GameRules\UnitInfo.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="OpenRa.Game.Player" Collapsed="true">
|
||||
<Position X="15.75" Y="5.25" Width="1.5" />
|
||||
<Class Name="OpenRa.Game.Player">
|
||||
<Position X="11.75" Y="16.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>QEEEgAQEAEIAQQQACAIAACAAAQAAAAAACAEBAAARQAA=</HashCode>
|
||||
<HashCode>QEEEAAQAAAIAQQAACAMAACCAAAAAAA0gCAEAAQABQAA=</HashCode>
|
||||
<FileName>Player.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="OpenRa.Game.GameRules.MobileInfo" Collapsed="true">
|
||||
<Position X="17.5" Y="12" Width="1.5" />
|
||||
<Position X="9.75" Y="3.25" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAQAAAAAAAAAAAABAQAAAAAAAAAAAAAAAAg=</HashCode>
|
||||
<FileName>GameRules\UnitInfo.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="OpenRa.Game.GameRules.BuildingInfo" Collapsed="true">
|
||||
<Position X="21" Y="12" Width="1.5" />
|
||||
<Position X="13.25" Y="3.25" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAJQAAAIAAAAgAAACAAAABIAAAICAAABAAAAQAAAAgA=</HashCode>
|
||||
<FileName>GameRules\UnitInfo.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="OpenRa.Game.GameRules.InfantryInfo" Collapsed="true">
|
||||
<Position X="16.5" Y="13.5" Width="1.5" />
|
||||
<Position X="8.75" Y="4.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAEEAAAAABIAAAAAAAAAAAAAAAACAAAQA=</HashCode>
|
||||
<FileName>GameRules\UnitInfo.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Class Name="OpenRa.Game.GameRules.VehicleInfo" Collapsed="true">
|
||||
<Position X="18.75" Y="13.5" Width="1.5" />
|
||||
<Position X="11" Y="4.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAEAAAAAAAAAAAAAEAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>GameRules\UnitInfo.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Interface Name="OpenRa.Game.IEffect">
|
||||
<Position X="9.75" Y="7" Width="1.5" />
|
||||
<Class Name="OpenRa.Game.GameRules.ActorInfo" Collapsed="true">
|
||||
<Position X="11" Y="0.5" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAQAA=</HashCode>
|
||||
<FileName>IEffect.cs</FileName>
|
||||
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
|
||||
<FileName>GameRules\ActorInfo.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Interface>
|
||||
<Interface Name="OpenRa.Game.IOrderGenerator" Collapsed="true">
|
||||
<Position X="3.75" Y="10.25" Width="1.5" />
|
||||
</Class>
|
||||
<Class Name="OpenRa.Game.PathFinder">
|
||||
<Position X="15" Y="7.75" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAAAAAAAAAAAAAAgAACAAAICAAgAEoAAMAAAAAAAAgA=</HashCode>
|
||||
<FileName>PathFinder.cs</FileName>
|
||||
</TypeIdentifier>
|
||||
</Class>
|
||||
<Interface Name="OpenRa.Game.IOrderGenerator">
|
||||
<Position X="3.5" Y="12" Width="1.5" />
|
||||
<TypeIdentifier>
|
||||
<HashCode>AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAQAA=</HashCode>
|
||||
<FileName>IOrderGenerator.cs</FileName>
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace OpenRa.Game
|
||||
|
||||
LoadMapActors(Rules.AllRules);
|
||||
|
||||
PathFinder = new PathFinder(Rules.Map);
|
||||
PathFinder = new PathFinder();
|
||||
|
||||
if (Replay != "")
|
||||
orderManager = new OrderManager(new IOrderSource[] { new ReplayOrderSource(Replay) });
|
||||
|
||||
@@ -9,19 +9,16 @@ namespace OpenRa.Game
|
||||
class PathFinder
|
||||
{
|
||||
float[][,] passableCost = new float[4][,];
|
||||
Map map;
|
||||
|
||||
public PathFinder(Map map)
|
||||
public PathFinder()
|
||||
{
|
||||
this.map = map;
|
||||
|
||||
for (var umt = UnitMovementType.Foot; umt <= UnitMovementType.Float; umt++)
|
||||
passableCost[(int)umt] = new float[128, 128];
|
||||
for( int x = 0 ; x < 128 ; x++ )
|
||||
for( int y = 0 ; y < 128 ; y++ )
|
||||
for (var umt = UnitMovementType.Foot; umt <= UnitMovementType.Float; umt++ )
|
||||
passableCost[(int)umt][ x, y ] = ( map.IsInMap( x, y ) )
|
||||
? (float)TerrainCosts.Cost( umt, Rules.TileSet.GetWalkability( map.MapTiles[ x, y ] ) )
|
||||
passableCost[(int)umt][ x, y ] = ( Rules.Map.IsInMap( x, y ) )
|
||||
? (float)TerrainCosts.Cost( umt, Rules.TileSet.GetWalkability( Rules.Map.MapTiles[ x, y ] ) )
|
||||
: float.PositiveInfinity;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user