mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-12-04 09:32:19 +00:00
dbcc57b7a6
Fixed, Script Editor: in some cases clicking on an error in the errors list didn't navigate to the error location. Fixed, Script Editor: in some cases incorrect error line number was shown. Fixed, Text lump parsers: fixed a crash when trying to get a filename from a quoted string with missing closing quote. Fixed, Text lump parsers: in several cases parsing errors were ignored by overlaying data structures. Fixed: in some cases Thing Filter thing flags were cleared when switching game configurations in the "Game Configurations" window. Changed, PK3 reader: loading of files with invalid path chars is now skipped instead of skipping loading of the whole resource. Also more helpful warning message is now displayed. Updated SharpCompress library to v.0.11.2.0.
56 lines
1.6 KiB
C#
56 lines
1.6 KiB
C#
using System.IO;
|
|
using System.Collections.Generic;
|
|
using CodeImp.DoomBuilder.ZDoom;
|
|
using CodeImp.DoomBuilder.GZBuilder.Data;
|
|
|
|
//mxd. Decorate parser used to create ScriptItems for use in script editor's navigator
|
|
//Should be able to parse actor definitions even from invalid DECORATE and should never fail parsing
|
|
namespace CodeImp.DoomBuilder.GZBuilder.GZDoom
|
|
{
|
|
internal sealed class DecorateParserSE : ZDTextParser
|
|
{
|
|
private readonly List<ScriptItem> actors;
|
|
public List<ScriptItem> Actors { get { return actors; } }
|
|
|
|
public DecorateParserSE()
|
|
{
|
|
actors = new List<ScriptItem>();
|
|
}
|
|
|
|
public override bool Parse(Stream stream, string sourcefilename)
|
|
{
|
|
base.Parse(stream, sourcefilename);
|
|
|
|
// Continue until at the end of the stream
|
|
while(SkipWhitespace(true))
|
|
{
|
|
string token = ReadToken();
|
|
if(string.IsNullOrEmpty(token) || token.ToUpperInvariant() != "ACTOR") continue;
|
|
|
|
SkipWhitespace(true);
|
|
int startpos = (int)stream.Position;
|
|
|
|
List<string> definition = new List<string>();
|
|
|
|
do
|
|
{
|
|
token = ReadToken(false); // Don't skip newline
|
|
if(string.IsNullOrEmpty(token) || token == "{" || token == "}") break;
|
|
definition.Add(token);
|
|
} while(SkipWhitespace(false)); // Don't skip newline
|
|
|
|
string name = string.Join(" ", definition.ToArray());
|
|
if(!string.IsNullOrEmpty(name)) actors.Add(new ScriptItem(name, startpos, false));
|
|
}
|
|
|
|
// Sort nodes
|
|
actors.Sort(ScriptItem.SortByName);
|
|
return true;
|
|
}
|
|
|
|
protected override string GetLanguageType()
|
|
{
|
|
return "DECORATE";
|
|
}
|
|
}
|
|
}
|