Improved error reporting for invalid ZScript input

This commit is contained in:
ZZYZX 2022-09-15 03:12:27 +03:00
parent 5f677e9ad6
commit aee47aacb0
3 changed files with 9 additions and 3 deletions

View file

@ -1780,9 +1780,11 @@ namespace CodeImp.DoomBuilder.Data
// Go for all opened containers
foreach (DataReader dr in containers)
{
// Load Decorate info cumulatively (the last Decorate is added to the previous)
// I'm not sure if this is the right thing to do though.
currentreader = dr;
// Load Decorate info cumulatively (the last Decorate is added to the previous)
// I'm not sure if this is the right thing to do though.
long t = DateTimeOffset.Now.ToUnixTimeMilliseconds();
currentreader = dr;
IEnumerable<TextResourceData> streams = dr.GetDecorateData("ZSCRIPT");
foreach (TextResourceData data in streams)
{
@ -1801,6 +1803,8 @@ namespace CodeImp.DoomBuilder.Data
break;
}
}
DebugConsole.WriteLine(string.Format("Loading ZScript lumps from {0} took {1}ms", DateTimeOffset.Now.ToUnixTimeMilliseconds() - t));
}
zscript.Finalize();

View file

@ -39,6 +39,7 @@ namespace CodeImp.DoomBuilder.ZDoom
if (outs.Length > 0)
{
ZScriptToken tok = new ZScriptToken();
tok.Position = cpos;
tok.Type = ZScriptTokenType.String;
tok.Value = outs;
return tok;

View file

@ -735,6 +735,7 @@ namespace CodeImp.DoomBuilder.ZDoom
// token not found.
tok = new ZScriptToken();
tok.Position = reader.BaseStream.Position;
tok.Type = ZScriptTokenType.Invalid;
tok.Value = "" + reader.ReadChar();
tok.IsValid = false;