be more verbose about missing sequences and files

as requested in #3039
This commit is contained in:
Matthias Mailänder
2013-04-20 21:36:57 +02:00
parent dc7b2c0f5d
commit 3649342317
2 changed files with 9 additions and 4 deletions

View File

@@ -40,7 +40,11 @@ namespace OpenRA.Graphics
var seq = sequences.NodesDict.ToDictionary(x => x.Key, x => new Sequence(unit,x.Key,x.Value)); var seq = sequences.NodesDict.ToDictionary(x => x.Key, x => new Sequence(unit,x.Key,x.Value));
units.Add(unit, seq); units.Add(unit, seq);
} }
catch (FileNotFoundException) {} // Do nothing; we can crash later if we actually wanted art catch (FileNotFoundException)
{
// Do nothing; we can crash later if we actually wanted art
Console.WriteLine("Can't find all files for unit {0}.".F(unit));
}
} }
public static Sequence GetSequence(string unitName, string sequenceName) public static Sequence GetSequence(string unitName, string sequenceName)
@@ -53,7 +57,7 @@ namespace OpenRA.Graphics
"Unit `{0}` does not have a sequence `{1}`".F(unitName, sequenceName)); "Unit `{0}` does not have a sequence `{1}`".F(unitName, sequenceName));
else else
throw new InvalidOperationException( throw new InvalidOperationException(
"Unit `{0}` does not have any sequences defined.".F(unitName)); "Unit `{0}` does not have all sequences defined.".F(unitName));
} }
} }
@@ -61,7 +65,7 @@ namespace OpenRA.Graphics
{ {
if (!units.ContainsKey(unit)) if (!units.ContainsKey(unit))
throw new InvalidOperationException( throw new InvalidOperationException(
"Unit `{0}` does not have any sequences defined.".F(unit)); "Unit `{0}` does not have sequence `{1}` defined.".F(unit, seq));
return units[unit].ContainsKey(seq); return units[unit].ContainsKey(seq);
} }

View File

@@ -73,7 +73,8 @@ namespace OpenRA
FileSystem.Mount(FileSystem.OpenPackage(map.Path, int.MaxValue)); FileSystem.Mount(FileSystem.OpenPackage(map.Path, int.MaxValue));
Rules.LoadRules(Manifest, map); Rules.LoadRules(Manifest, map);
SpriteLoader = new SpriteLoader( Rules.TileSets[map.Tileset].Extensions, SheetBuilder ); SpriteLoader = new SpriteLoader(Rules.TileSets[map.Tileset].Extensions, SheetBuilder);
// TODO: Don't load the sequences for assets that are not used in this tileset. Maybe use the existing EditorTilesetFilters.
SequenceProvider.Initialize(Manifest.Sequences, map.Sequences); SequenceProvider.Initialize(Manifest.Sequences, map.Sequences);
return map; return map;