Allow error message to be formatted

This commit is contained in:
SirLynix
2023-08-14 23:16:37 +02:00
committed by Jérôme Leclercq
parent 25957c4b7f
commit a741672a51
119 changed files with 707 additions and 490 deletions

View File

@@ -101,7 +101,7 @@ namespace Nz
{
if (!stream.Read(&rleValue, 1))
{
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
NazaraError("failed to read stream (byte {0})", stream.GetCursorPos());
return Err(ResourceLoadingError::DecodingError);
}
@@ -112,7 +112,7 @@ namespace Nz
rleCount = rleValue - 0xc0;
if (!stream.Read(&rleValue, 1))
{
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
NazaraError("failed to read stream (byte {0})", stream.GetCursorPos());
return Err(ResourceLoadingError::DecodingError);
}
}
@@ -156,7 +156,7 @@ namespace Nz
{
if (!stream.Read(&rleValue, 1))
{
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
NazaraError("failed to read stream (byte {0})", stream.GetCursorPos());
return Err(ResourceLoadingError::DecodingError);
}
@@ -167,7 +167,7 @@ namespace Nz
rleCount = rleValue - 0xc0;
if (!stream.Read(&rleValue, 1))
{
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
NazaraError("failed to read stream (byte {0})", stream.GetCursorPos());
return Err(ResourceLoadingError::DecodingError);
}
}
@@ -207,14 +207,14 @@ namespace Nz
UInt8 magic;
if (!stream.Read(&magic, 1))
{
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
NazaraError("failed to read stream (byte {0})", stream.GetCursorPos());
return Err(ResourceLoadingError::DecodingError);
}
/* first byte must be equal to 0x0c (12) */
if (magic != 0x0c)
{
NazaraError("Colormap's first byte must be 0x0c (0x" + NumberToString(magic, 16) + ')');
NazaraError("Colormap's first byte must be 0x0c ({0:#x})", magic);
return Err(ResourceLoadingError::DecodingError);
}
@@ -240,7 +240,7 @@ namespace Nz
{
if (!stream.Read(&rleValue, 1))
{
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
NazaraError("failed to read stream (byte {0})", stream.GetCursorPos());
return Err(ResourceLoadingError::DecodingError);
}
@@ -251,7 +251,7 @@ namespace Nz
rleCount = rleValue - 0xc0;
if (!stream.Read(&rleValue, 1))
{
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
NazaraError("failed to read stream (byte {0})", stream.GetCursorPos());
return Err(ResourceLoadingError::DecodingError);
}
}
@@ -284,7 +284,7 @@ namespace Nz
{
if (!stream.Read(&rleValue, 1))
{
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
NazaraError("failed to read stream (byte {0})", stream.GetCursorPos());
return Err(ResourceLoadingError::DecodingError);
}
@@ -295,7 +295,7 @@ namespace Nz
rleCount = rleValue - 0xc0;
if (!stream.Read(&rleValue, 1))
{
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
NazaraError("failed to read stream (byte {0})", stream.GetCursorPos());
return Err(ResourceLoadingError::DecodingError);
}
}
@@ -311,7 +311,7 @@ namespace Nz
}
default:
NazaraError("Unsupported " + NumberToString(bitCount) + " bitcount for pcx files");
NazaraError("unsupported {0} bitcount for pcx files", bitCount);
return Err(ResourceLoadingError::DecodingError);
}