Improve robustness of editor actor cell checks.
This commit is contained in:
@@ -58,9 +58,15 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
var cell = location + cellOffset;
|
var cell = location + cellOffset;
|
||||||
|
|
||||||
// Some mods may define terrain-specific bibs
|
// Some mods may define terrain-specific bibs
|
||||||
|
var sequence = Sequence;
|
||||||
|
if (map.Tiles.Contains(cell))
|
||||||
|
{
|
||||||
var terrain = map.GetTerrainInfo(cell).Type;
|
var terrain = map.GetTerrainInfo(cell).Type;
|
||||||
var testSequence = Sequence + "-" + terrain;
|
var testSequence = Sequence + "-" + terrain;
|
||||||
var sequence = anim.HasSequence(testSequence) ? testSequence : Sequence;
|
if (anim.HasSequence(testSequence))
|
||||||
|
sequence = testSequence;
|
||||||
|
}
|
||||||
|
|
||||||
anim.PlayFetchIndex(sequence, () => index);
|
anim.PlayFetchIndex(sequence, () => index);
|
||||||
anim.IsDecoration = true;
|
anim.IsDecoration = true;
|
||||||
|
|
||||||
|
|||||||
@@ -263,8 +263,16 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
return map.Grid.DefaultSubCell;
|
return map.Grid.DefaultSubCell;
|
||||||
|
|
||||||
for (var i = (byte)SubCell.First; i < map.Grid.SubCellOffsets.Length; i++)
|
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)i;
|
||||||
|
}
|
||||||
|
|
||||||
return SubCell.Invalid;
|
return SubCell.Invalid;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user