git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1316 993157c7-ee19-0410-b2c4-bb4e9862e678

This commit is contained in:
(no author)
2007-07-21 03:14:48 +00:00
parent c4267e2241
commit cb7b5dedd7
4 changed files with 10 additions and 4 deletions

View File

@@ -13,6 +13,7 @@ namespace OpenRa.FileFormats
public readonly int XOffset; public readonly int XOffset;
public readonly int YOffset; public readonly int YOffset;
public int2 Offset { get { return new int2( XOffset, YOffset ); } }
public readonly int Width; public readonly int Width;
public readonly int Height; public readonly int Height;

View File

@@ -56,6 +56,12 @@
<Compile Include="TreeReference.cs" /> <Compile Include="TreeReference.cs" />
<Compile Include="Walkability.cs" /> <Compile Include="Walkability.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenRa.DataStructures\OpenRa.DataStructures.csproj">
<Project>{2F9E7A23-56C0-4286-9C8E-1060A9B2F073}</Project>
<Name>OpenRa.DataStructures</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View File

@@ -31,8 +31,7 @@ namespace OpenRa.Game
public List<int2> FindUnitPath( World world, Unit unit, DestinationFunc estimator ) public List<int2> FindUnitPath( World world, Unit unit, DestinationFunc estimator )
{ {
int2 offset = new int2( map.XOffset, map.YOffset ); int2 startLocation = unit.Location + map.Offset;
int2 startLocation = unit.Location + offset;
CellInfo[ , ] cellInfo = new CellInfo[ 128, 128 ]; CellInfo[ , ] cellInfo = new CellInfo[ 128, 128 ];
@@ -40,7 +39,7 @@ namespace OpenRa.Game
for( int y = 0 ; y < 128 ; y++ ) for( int y = 0 ; y < 128 ; y++ )
cellInfo[ x, y ] = new CellInfo( double.PositiveInfinity, new int2( x, y ), false ); cellInfo[ x, y ] = new CellInfo( double.PositiveInfinity, new int2( x, y ), false );
return FindUnitPath( startLocation, estimator, offset, cellInfo ); return FindUnitPath( startLocation, estimator, map.Offset, cellInfo );
} }
List<int2> FindUnitPath( int2 startLocation, DestinationFunc estimator, int2 offset, CellInfo[,] cellInfo ) List<int2> FindUnitPath( int2 startLocation, DestinationFunc estimator, int2 offset, CellInfo[,] cellInfo )

View File

@@ -12,7 +12,7 @@ namespace OpenRa.Game
public Tree(TreeReference r, TreeCache renderer, Map map) public Tree(TreeReference r, TreeCache renderer, Map map)
{ {
location = new int2( r.Location ) - new int2( map.XOffset, map.YOffset ); location = new int2( r.Location ) - map.Offset;
currentImages = new Sprite[] { renderer.GetImage(r.Image) }; currentImages = new Sprite[] { renderer.GetImage(r.Image) };
} }