diff --git a/Source/Core/Compilers/AccCompiler.cs b/Source/Core/Compilers/AccCompiler.cs index 9158ad35bf3c2023271fbbd72b248b006c43e378..57a84e12044e30985b8d63a3e4d08073d7e9bba0 100644 --- a/Source/Core/Compilers/AccCompiler.cs +++ b/Source/Core/Compilers/AccCompiler.cs @@ -90,13 +90,11 @@ namespace CodeImp.DoomBuilder.Compilers TextResourceData data = General.Map.Data.GetTextResourceData(includefile); if(data == null) { - // Fial - ReportError(new CompilerError("Unable to find include file \"" + includefile + "\"")); - } - else - { - se.Parse(data, true, includetype, false); + se.ReportError("Unable to find include file \"" + includefile + "\""); + return false; // Fial } + + return se.Parse(data, true, includetype, false); } }; @@ -105,10 +103,9 @@ namespace CodeImp.DoomBuilder.Compilers { // Map SCRIPTS lump is empty. Abort the process without generating any warnings or errors. if(SourceIsMapScriptsLump && stream.Length == 0) return false; - - string targetfile = (SourceIsMapScriptsLump ? Path.GetDirectoryName(General.Map.FilePathName) : inputfile); - DataLocation dl = new DataLocation(DataLocation.RESOURCE_DIRECTORY, Path.GetDirectoryName(General.Map.FilePathName), false, false, false); - TextResourceData data = new TextResourceData(stream, dl, targetfile, false); + + DataLocation dl = new DataLocation(DataLocation.RESOURCE_DIRECTORY, Path.GetDirectoryName(inputfilepath), false, false, false); + TextResourceData data = new TextResourceData(stream, dl, inputfile, false); if(!parser.Parse(data, info.Files, true, AcsParserSE.IncludeType.NONE, false)) { // Check for errors diff --git a/Source/Core/General/MapManager.cs b/Source/Core/General/MapManager.cs index b59c688a81ecfe376b61d2718c8b848145213838..b630c43d3b27f81aafb95dc9e07d216dd38f1599 100644 --- a/Source/Core/General/MapManager.cs +++ b/Source/Core/General/MapManager.cs @@ -2037,15 +2037,10 @@ namespace CodeImp.DoomBuilder OnInclude = delegate(AcsParserSE se, string includefile, AcsParserSE.IncludeType includetype) { TextResourceData includedata = General.Map.Data.GetTextResourceData(includefile); - if(includedata != null) - { - includedata.Trackable = true; - se.Parse(includedata, true, includetype, false); - } - else - { - General.ErrorLogger.Add(ErrorType.Error, "Unable to find include file \"" + includefile + "\""); - } + if(includedata == null) return false; // Fial + + includedata.Trackable = true; + return se.Parse(includedata, true, includetype, false); } }; diff --git a/Source/Core/Map/MapSet.cs b/Source/Core/Map/MapSet.cs index 125fded350b638489b9646c10e424f1c2244fcd1..84712161dc611793197378e5967e465de343291b 100644 --- a/Source/Core/Map/MapSet.cs +++ b/Source/Core/Map/MapSet.cs @@ -2408,6 +2408,13 @@ namespace CodeImp.DoomBuilder.Map line.FlipVertices(); line.FlipSidedefs(); } + + // Adjust textures + if(line.Front != null) line.Front.RemoveUnneededTextures(line.Back != null, false, true); + if(line.Back != null) line.Back.RemoveUnneededTextures(line.Front != null, false, true); + + // Correct the sided flags + line.ApplySidedFlags(); } foreach(KeyValuePair<Linedef, Sector> group in linebacksectorref) @@ -2427,16 +2434,13 @@ namespace CodeImp.DoomBuilder.Map line.FlipVertices(); line.FlipSidedefs(); } - } - // Adjust textures - foreach(Linedef l in changedlines) - { - if(l.Front != null) l.Front.RemoveUnneededTextures(l.Back != null); - if(l.Back != null) l.Back.RemoveUnneededTextures(l.Front != null); + // Adjust textures + if(line.Front != null) line.Front.RemoveUnneededTextures(line.Back != null, false, true); + if(line.Back != null) line.Back.RemoveUnneededTextures(line.Front != null, false, true); // Correct the sided flags - l.ApplySidedFlags(); + line.ApplySidedFlags(); } } diff --git a/Source/Core/ZDoom/Scripting/AcsParserSE.cs b/Source/Core/ZDoom/Scripting/AcsParserSE.cs index d1b34aa53d566c7a75ae78a86537efc518ec6952..8a807f0ed6b9ad28e7f5c4df10cefad60cece5cb 100644 --- a/Source/Core/ZDoom/Scripting/AcsParserSE.cs +++ b/Source/Core/ZDoom/Scripting/AcsParserSE.cs @@ -17,7 +17,7 @@ namespace CodeImp.DoomBuilder.ZDoom.Scripting { #region ================== Event Delegates - internal delegate void IncludeDelegate(AcsParserSE parser, string includefile, IncludeType includetype); + internal delegate bool IncludeDelegate(AcsParserSE parser, string includefile, IncludeType includetype); internal IncludeDelegate OnInclude; #endregion @@ -217,8 +217,8 @@ namespace CodeImp.DoomBuilder.ZDoom.Scripting case "#library": if(IsMapScriptsLump) { - ReportError("SCRIPTS lump can not be compiled as a library"); - if(!IgnoreErrors) return false; + if(!IgnoreErrors) ReportError("SCRIPTS lump can not be compiled as a library"); + return IgnoreErrors; } SkipWhitespace(true); @@ -226,7 +226,7 @@ namespace CodeImp.DoomBuilder.ZDoom.Scripting if(!libname.StartsWith("\"") || !libname.EndsWith("\"")) { - ReportError("#library name should be quoted"); + if(!IgnoreErrors) ReportError("#library name should be quoted"); return IgnoreErrors; } @@ -234,7 +234,7 @@ namespace CodeImp.DoomBuilder.ZDoom.Scripting if(string.IsNullOrEmpty(libname)) { - ReportError("Expected library name"); + if(!IgnoreErrors) ReportError("Expected library name"); return IgnoreErrors; } @@ -260,7 +260,7 @@ namespace CodeImp.DoomBuilder.ZDoom.Scripting if(!includelump.StartsWith("\"") || !includelump.EndsWith("\"")) { - ReportError(token + " filename should be quoted"); + if(!IgnoreErrors) ReportError(token + " filename should be quoted"); return IgnoreErrors; } @@ -268,7 +268,7 @@ namespace CodeImp.DoomBuilder.ZDoom.Scripting if(string.IsNullOrEmpty(includelump)) { - ReportError("Expected file name to " + token); + if(!IgnoreErrors) ReportError("Expected file name to " + token); return IgnoreErrors; } @@ -280,7 +280,7 @@ namespace CodeImp.DoomBuilder.ZDoom.Scripting // These can also be included several times... if(includes[includecategory].Contains(includelump)) { - ReportError("Already parsed \"" + includelump + "\". Check your " + token + " directives"); + if(!IgnoreErrors) ReportError("Already parsed \"" + includelump + "\". Check your " + token + " directives"); return IgnoreErrors; } @@ -293,13 +293,13 @@ namespace CodeImp.DoomBuilder.ZDoom.Scripting string includelumppath = GetRootedPath(source, includelump); // Rooting succeeded? - if((HasError && !IgnoreErrors) || string.IsNullOrEmpty(includelumppath)) + if(this.HasError || string.IsNullOrEmpty(includelumppath)) return IgnoreErrors; // Already parsed? if(includes[includecategory].Contains(includelumppath)) { - ReportError("Already parsed \"" + includelump + "\". Check your " + token + " directives"); + if(!IgnoreErrors) ReportError("Already parsed \"" + includelump + "\". Check your " + token + " directives"); return IgnoreErrors; } @@ -310,11 +310,12 @@ namespace CodeImp.DoomBuilder.ZDoom.Scripting if(OnInclude != null) { IsMapScriptsLump = false; - OnInclude(this, includelumppath, (token == "#import" ? IncludeType.LIBRARY : IncludeType.INCLUDE)); + if(!OnInclude(this, includelumppath, (token == "#import" ? IncludeType.LIBRARY : IncludeType.INCLUDE))) + return IgnoreErrors; // Bail out on errors } // Bail out on error - if(this.HasError && !IgnoreErrors) return false; + if(this.HasError) return IgnoreErrors; // Set our buffers back to continue parsing datastream = localstream;