Support tmp(ts) templates with empty tiles.

This commit is contained in:
Paul Chote
2014-10-05 16:53:27 +13:00
parent 6a72e87028
commit fff8c7680b

View File

@@ -29,6 +29,8 @@ namespace OpenRA.Mods.TS.SpriteLoaders
public bool DisableExportPadding { get { return false; } } public bool DisableExportPadding { get { return false; } }
public TmpTSFrame(Stream s, Size size) public TmpTSFrame(Stream s, Size size)
{
if (s.Position != 0)
{ {
Size = size; Size = size;
@@ -51,6 +53,9 @@ namespace OpenRA.Mods.TS.SpriteLoaders
// Ignore Z-data for now // Ignore Z-data for now
// Ignore extra data for now // Ignore extra data for now
} }
else
Data = new byte[0];
}
} }
bool IsTmpTS(Stream s) bool IsTmpTS(Stream s)
@@ -60,8 +65,10 @@ namespace OpenRA.Mods.TS.SpriteLoaders
var sx = s.ReadUInt32(); var sx = s.ReadUInt32();
var sy = s.ReadUInt32(); var sy = s.ReadUInt32();
// Find the first frame // Find the first non-empty frame
var offset = s.ReadUInt32(); var offset = s.ReadUInt32();
while (offset == 0)
offset = s.ReadUInt32();
if (offset > s.Length - 52) if (offset > s.Length - 52)
{ {