Improve robustness of editor actor cell checks.

This commit is contained in:
Paul Chote
2019-12-26 12:53:02 +00:00
committed by abcdefg30
parent 1282650274
commit fe25fdf0ff
2 changed files with 18 additions and 4 deletions

View File

@@ -58,9 +58,15 @@ namespace OpenRA.Mods.Cnc.Traits
var cell = location + cellOffset;
// Some mods may define terrain-specific bibs
var sequence = Sequence;
if (map.Tiles.Contains(cell))
{
var terrain = map.GetTerrainInfo(cell).Type;
var testSequence = Sequence + "-" + terrain;
var sequence = anim.HasSequence(testSequence) ? testSequence : Sequence;
if (anim.HasSequence(testSequence))
sequence = testSequence;
}
anim.PlayFetchIndex(sequence, () => index);
anim.IsDecoration = true;

View File

@@ -263,8 +263,16 @@ namespace OpenRA.Mods.Common.Traits
return map.Grid.DefaultSubCell;
for (var i = (byte)SubCell.First; i < map.Grid.SubCellOffsets.Length; i++)
if (!previews.Any(p => p.Footprint[cell] == (SubCell)i))
{
var blocked = previews.Any(p =>
{
SubCell s;
return p.Footprint.TryGetValue(cell, out s) && s == (SubCell)i;
});
if (!blocked)
return (SubCell)i;
}
return SubCell.Invalid;
}