Write the missing char U+FFFD when unable to render a char in term.write

This commit is contained in:
Alessandro Proto 2023-02-18 21:25:36 +01:00
parent 001ce2f626
commit 3f9f036b49

View file

@ -202,8 +202,17 @@ internal class Term : IComponent
var charpos = realpos + CharOffset;
_game.Drawing.DrawRectangle(realpos, new(CharWidth, CharHeight), bg, Math.Min(CharWidth, CharHeight));
//_game.Drawing.DrawRectangle(realpos, new(CharWidth, CharHeight), Color.Red, 1);
try
{
_game.Drawing.DrawString(charpos, ch.ToString(), fg);
}
catch (ArgumentException ex) // UTF-16 fuckery
{
_game.Drawing.DrawString(charpos, "\xFFFD", fg);
}
if (!save)
return;
@ -316,14 +325,7 @@ internal class Term : IComponent
if (!L.IsNone(1))
str = L.ToString(1);
try
{
Write(str);
}
catch (ArgumentException ex) // UTF-16 fuckery
{
L.Error(ex.Message);
}
return 0;
}