Bake PickAny tiles on map save. Translate maxvalue index to random tile for backwards compat.

This commit is contained in:
Paul Chote
2011-02-11 16:49:25 +13:00
parent 9407c55262
commit db770eb997
6 changed files with 17 additions and 24 deletions

View File

@@ -14,20 +14,11 @@ namespace OpenRA.FileFormats
{
public T type;
public U index;
public U image;
public TileReference(T t, U i)
{
type = t;
index = i;
image = i;
}
public TileReference(T t, U i, U im)
{
type = t;
index = i;
image = im;
}
public override int GetHashCode() { return type.GetHashCode() ^ index.GetHashCode(); }

View File

@@ -136,7 +136,7 @@ namespace OpenRA.FileFormats
{
Terrain tile;
if( Tiles.TryGetValue( r.type, out tile ) )
return tile.TileBitmapBytes[ r.image ];
return tile.TileBitmapBytes[ r.index ];
byte[] missingTile = new byte[ TileSize * TileSize ];
for( int i = 0 ; i < missingTile.Length ; i++ )
@@ -149,7 +149,7 @@ namespace OpenRA.FileFormats
{
var tt = Templates[r.type].Tiles;
string ret;
if (!tt.TryGetValue(r.image, out ret))
if (!tt.TryGetValue(r.index, out ret))
return "Clear"; // Default walkable
return ret;
}