From 1952932cc1802d77b6dafaa1e4ec6848f2acdfde Mon Sep 17 00:00:00 2001 From: spherallic Date: Sat, 10 Feb 2024 00:11:01 +0100 Subject: [PATCH] SOC/Lua parser tweaks: - Make Lua parser ignore unknown properties instead of throwing an error - Add Title/Angled/NotAngled properties as valid alternatives for Name/Arrow/NoArrow --- Source/Core/SRB2/LuaObjectParser.cs | 6 ++++-- Source/Core/SRB2/SOCObjectParser.cs | 13 +++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Source/Core/SRB2/LuaObjectParser.cs b/Source/Core/SRB2/LuaObjectParser.cs index 752703f..02e15bf 100644 --- a/Source/Core/SRB2/LuaObjectParser.cs +++ b/Source/Core/SRB2/LuaObjectParser.cs @@ -160,6 +160,7 @@ namespace CodeImp.DoomBuilder.SRB2 switch (token) { case "$Name": + case "$Title": SkipWhitespace(true); token = ReadLine(); name = ZDTextParser.StripQuotes(token); @@ -206,9 +207,11 @@ namespace CodeImp.DoomBuilder.SRB2 flagsvaluetext = ZDTextParser.StripQuotes(token); break; case "$Arrow": + case "$Angled": arrow = true; break; case "$NoArrow": + case "$NotAngled": arrow = false; break; case "$TagThing": @@ -287,8 +290,7 @@ namespace CodeImp.DoomBuilder.SRB2 blockclosed = true; break; default: - ReportError("Unknown object definition parameter " + token); - return false; + break; } if (!blockclosed) { diff --git a/Source/Core/SRB2/SOCObjectParser.cs b/Source/Core/SRB2/SOCObjectParser.cs index 3d7b136..2e58557 100644 --- a/Source/Core/SRB2/SOCObjectParser.cs +++ b/Source/Core/SRB2/SOCObjectParser.cs @@ -208,8 +208,13 @@ namespace CodeImp.DoomBuilder.SRB2 { name = ZDTextParser.StripQuotes(line.Substring(7)); continue; - } - if (line.StartsWith("#$Category ")) + } + if (line.StartsWith("#$Title ")) + { + name = ZDTextParser.StripQuotes(line.Substring(8)); + continue; + } + if (line.StartsWith("#$Category ")) { category = line.Substring(11); continue; @@ -236,12 +241,12 @@ namespace CodeImp.DoomBuilder.SRB2 flagsvaluetext = ZDTextParser.StripQuotes(line.Substring(17)); continue; } - if (line.StartsWith("#$Arrow")) + if (line.StartsWith("#$Arrow") || line.StartsWith("#$Angled")) { arrow = true; continue; } - if (line.StartsWith("#$NoArrow")) + if (line.StartsWith("#$NoArrow") || line.StartsWith("#$NotAngled")) { arrow = false; continue;