Add workaround for double slashes in SOC causing freezes

This commit is contained in:
spherallic 2024-02-09 22:47:00 +01:00
parent 85bc168377
commit 8b7bd3ce8c
2 changed files with 8 additions and 6 deletions

View file

@ -121,7 +121,7 @@ namespace CodeImp.DoomBuilder.ZDoom
while (SkipWhitespace(true, true))
{
// Read a token
string token = ReadToken();
string token = ReadToken(true, true);
if (!string.IsNullOrEmpty(token))
{
@ -131,7 +131,7 @@ namespace CodeImp.DoomBuilder.ZDoom
if (token.StartsWith("thing") || token.EndsWith("mobj") || token.EndsWith("object"))
{
SkipWhitespace(true, true);
token = ReadToken();
token = ReadToken(true, true);
if (!token.ToUpper().StartsWith("MT_"))
continue;
@ -148,7 +148,7 @@ namespace CodeImp.DoomBuilder.ZDoom
else if (token.Equals("level"))
{
SkipWhitespace(true, true);
token = ReadToken();
token = ReadToken(true, true);
string mapname = GetMapName(token);

View file

@ -328,8 +328,9 @@ namespace CodeImp.DoomBuilder.ZDoom
// This reads a token (all sequential non-whitespace characters or a single character)
// Returns null when the end of the stream has been reached
protected internal string ReadToken() { return ReadToken(true); } //mxd. Added "multiline" param
protected internal string ReadToken(bool multiline)
protected internal string ReadToken() { return ReadToken(true, false); } //mxd. Added "multiline" param
protected internal string ReadToken(bool multiline) { return ReadToken(multiline, false); } //sphere
protected internal string ReadToken(bool multiline, bool SOC)
{
//mxd. Return empty string when the end of the stream has been reached
if(datastream.Position == datastream.Length) return string.Empty;
@ -387,7 +388,8 @@ namespace CodeImp.DoomBuilder.ZDoom
if(!quotedstring) break;
}
// Potential comment?
else if((c == '/') && !quotedstring)
// TODO: figure out why double slashes in SOC scripts cause UZB to freeze forever
else if (!SOC && (c == '/') && !quotedstring)
{
// Check the next byte
if(datastream.Position == datastream.Length) return token;