fix AudLoader failing to load sounds that use only half of the final byte

This commit is contained in:
Chris Forbes
2011-03-31 10:59:22 +13:00
parent 1f12306924
commit cee021ef17

View File

@@ -1,4 +1,4 @@
#region Copyright & License Information
\#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
@@ -141,9 +141,13 @@ namespace OpenRA.FileFormats
output[offset++] = (byte)t;
output[offset++] = (byte)(t >> 8);
t = DecodeSample((byte)(b >> 4), ref index, ref currentSample);
output[offset++] = (byte)t;
output[offset++] = (byte)(t >> 8);
if (offset < outputSize)
{
/* possible that only half of the final byte is used! */
t = DecodeSample((byte)(b >> 4), ref index, ref currentSample);
output[offset++] = (byte)t;
output[offset++] = (byte)(t >> 8);
}
}
dataSize -= 8 + chunk.CompressedSize;