Do not clear all custom objects if one or more SOC/Lua scripts throws an error

Fix SOC errors being displayed as Lua errors
This commit is contained in:
spherallic 2023-10-11 00:17:29 +02:00
parent 9948645e77
commit f26492fa65
3 changed files with 9 additions and 8 deletions

View file

@ -1874,7 +1874,6 @@ namespace CodeImp.DoomBuilder.Data
if (lua.HasError)
{
lua.LogError();
break;
}
}
}
@ -1882,8 +1881,8 @@ namespace CodeImp.DoomBuilder.Data
//mxd. Add to text resources collection
currentreader = null;
if (lua.HasError)
lua.ClearActors();
//if (lua.HasError)
// lua.ClearActors();
}
// sphere: This loads things and level headers from SRB2 SOC files.
@ -1907,7 +1906,6 @@ namespace CodeImp.DoomBuilder.Data
if (soc.HasError)
{
soc.LogError();
break;
}
}
}
@ -1915,8 +1913,8 @@ namespace CodeImp.DoomBuilder.Data
//mxd. Add to text resources collection
currentreader = null;
if (soc.HasError)
soc.ClearActors();
//if (soc.HasError)
// soc.ClearActors();
}
// [ZZ] this retrieves ZDoom actor structure by class name.

View file

@ -23,7 +23,7 @@ namespace CodeImp.DoomBuilder.ZDoom
if (string.IsNullOrEmpty(objname))
{
parser.ReportError("Lua object structure has no object name or map thing number");
parser.ReportError("SOC object structure has no object name or map thing number");
return;
}
@ -67,6 +67,9 @@ namespace CodeImp.DoomBuilder.ZDoom
parser.SkipWhitespace(false, true);
token = parser.ReadToken();
General.WriteLogLine(tokenname);
General.WriteLogLine(token);
// SOC definitions are terminated by an empty line. Blegh.
if (tokenname == "\n")
{

View file

@ -44,7 +44,7 @@ namespace CodeImp.DoomBuilder.ZDoom
#region ================== Variables
//mxd. Script type
internal override ScriptType ScriptType { get { return ScriptType.LUA; } }
internal override ScriptType ScriptType { get { return ScriptType.SOC; } }
// SRB2 mobjs
private Dictionary<int, ActorStructure> mobjs;