Improve --check-missing-sprites error handling.
This commit is contained in:
@@ -217,39 +217,32 @@ namespace OpenRA.Mods.Common.Graphics
|
||||
Stride = LoadField(d, "Stride", Length);
|
||||
|
||||
if (Length > Stride)
|
||||
throw new InvalidOperationException(
|
||||
"{0}: Sequence {1}.{2}: Length must be <= stride"
|
||||
.F(info.Nodes[0].Location, sequence, animation));
|
||||
throw new YamlException("Sequence {0}.{1}: Length must be <= stride"
|
||||
.F(sequence, animation));
|
||||
|
||||
if (Frames != null && Length > Frames.Length)
|
||||
throw new InvalidOperationException(
|
||||
"{0}: Sequence {1}.{2}: Length must be <= Frames.Length"
|
||||
.F(info.Nodes[0].Location, sequence, animation));
|
||||
throw new YamlException("Sequence {0}.{1}: Length must be <= Frames.Length"
|
||||
.F(sequence, animation));
|
||||
|
||||
var end = Start + (Facings - 1) * Stride + Length - 1;
|
||||
if (Frames != null)
|
||||
{
|
||||
foreach (var f in Frames)
|
||||
if (f < 0 || f >= frameCount)
|
||||
throw new InvalidOperationException(
|
||||
"{5}: Sequence {0}.{1} defines a Frames override that references frame {4}, but only [{2}..{3}] actually exist"
|
||||
.F(sequence, animation, Start, end, f, info.Nodes[0].Location));
|
||||
throw new YamlException("Sequence {0}.{1} defines a Frames override that references frame {2}, but only [{3}..{4}] actually exist"
|
||||
.F(sequence, animation, f, Start, end));
|
||||
|
||||
if (Start < 0 || end >= Frames.Length)
|
||||
throw new InvalidOperationException(
|
||||
"{5}: Sequence {0}.{1} uses indices [{2}..{3}] of the Frames list, but only {4} frames are defined"
|
||||
.F(sequence, animation, Start, end, Frames.Length, info.Nodes[0].Location));
|
||||
throw new YamlException("Sequence {0}.{1} uses indices [{2}..{3}] of the Frames list, but only {4} frames are defined"
|
||||
.F(sequence, animation, Start, end, Frames.Length));
|
||||
}
|
||||
else if (Start < 0 || end >= frameCount)
|
||||
throw new InvalidOperationException(
|
||||
"{5}: Sequence {0}.{1} uses frames [{2}..{3}], but only 0..{4} actually exist"
|
||||
.F(sequence, animation, Start, end, frameCount - 1, info.Nodes[0].Location));
|
||||
throw new YamlException("Sequence {0}.{1} uses frames [{2}..{3}], but only [0..{4}] actually exist"
|
||||
.F(sequence, animation, Start, end, frameCount - 1));
|
||||
|
||||
if (ShadowStart >= 0 && ShadowStart + (Facings - 1) * Stride + Length > frameCount)
|
||||
throw new InvalidOperationException(
|
||||
"{5}: Sequence {0}.{1}'s shadow frames use frames [{2}..{3}], but only [0..{4}] actually exist"
|
||||
.F(sequence, animation, ShadowStart, ShadowStart + (Facings - 1) * Stride + Length - 1, frameCount - 1,
|
||||
info.Nodes[0].Location));
|
||||
throw new YamlException("Sequence {0}.{1}'s shadow frames use frames [{2}..{3}], but only [0..{4}] actually exist"
|
||||
.F(sequence, animation, ShadowStart, ShadowStart + (Facings - 1) * Stride + Length - 1, frameCount - 1));
|
||||
|
||||
var usedFrames = new List<int>();
|
||||
for (var facing = 0; facing < Facings; facing++)
|
||||
|
||||
Reference in New Issue
Block a user