Standardise Theater -> Tileset.

This commit is contained in:
Paul Chote
2010-11-24 10:09:51 +13:00
parent 8b0255e2f7
commit 00dc91cf49
17 changed files with 44 additions and 45 deletions

View File

@@ -52,7 +52,6 @@ namespace OpenRA
// Temporary compat hacks
public int XOffset { get { return TopLeft.X; } }
public int YOffset { get { return TopLeft.Y; } }
public string Theater { get { return Tileset; } }
public Rectangle Bounds { get { return Rectangle.FromLTRB(TopLeft.X, TopLeft.Y, BottomRight.X, BottomRight.Y); } }
public Map()

View File

@@ -52,7 +52,7 @@ namespace OpenRA
return paths.Select(p => new MapStub(new Folder(p, int.MaxValue))).ToDictionary(m => m.Uid);
}
string cachedTheatre = null;
string cachedTileset = null;
bool previousMapHadSequences = true;
IFolder previousMapMount = null;
@@ -78,13 +78,13 @@ namespace OpenRA
Rules.LoadRules(Manifest, map);
if (map.Theater != cachedTheatre
if (map.Tileset != cachedTileset
|| previousMapHadSequences || map.Sequences.Count > 0)
{
SpriteSheetBuilder.Initialize( Rules.TileSets[map.Tileset] );
CursorProvider.Initialize(Manifest.Cursors);
SequenceProvider.Initialize(Manifest.Sequences, map.Sequences);
cachedTheatre = map.Theater;
cachedTileset = map.Tileset;
}
previousMapHadSequences = map.Sequences.Count > 0;

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Traits
public abstract class RenderSimpleInfo : ITraitInfo
{
public readonly string Image = null;
public readonly string[] OverrideTheater = null;
public readonly string[] OverrideTileset = null;
public readonly string[] OverrideImage = null;
public readonly string Palette = null;
public abstract object Create(ActorInitializer init);
@@ -35,9 +35,9 @@ namespace OpenRA.Traits
return cachedImage;
var Info = self.Info.Traits.Get<RenderSimpleInfo>();
if (Info.OverrideTheater != null)
for (int i = 0; i < Info.OverrideTheater.Length; i++)
if (Info.OverrideTheater[i] == self.World.Map.Theater)
if (Info.OverrideTileset != null)
for (int i = 0; i < Info.OverrideTileset.Length; i++)
if (Info.OverrideTileset[i] == self.World.Map.Tileset)
return cachedImage = Info.OverrideImage[i];
return cachedImage = Info.Image ?? self.Info.Name;