diff --git a/Source/Core/Data/WADReader.cs b/Source/Core/Data/WADReader.cs index b2a93dc9..da9cdc12 100644 --- a/Source/Core/Data/WADReader.cs +++ b/Source/Core/Data/WADReader.cs @@ -381,7 +381,7 @@ namespace CodeImp.DoomBuilder.Data while(lumpindex > -1) { MemoryStream filedata = new MemoryStream(file.Lumps[lumpindex].Stream.ReadAllBytes()); - WADReader.LoadHighresTextures(filedata, "TEXTURES", ref images, null, null); + WADReader.LoadHighresTextures(filedata, Path.Combine(Path.GetFileName(file.Filename), "TEXTURES#" + lumpindex), ref images, null, null); filedata.Dispose(); // Find next @@ -611,7 +611,7 @@ namespace CodeImp.DoomBuilder.Data while(lumpindex > -1) { MemoryStream filedata = new MemoryStream(file.Lumps[lumpindex].Stream.ReadAllBytes()); - WADReader.LoadHighresFlats(filedata, "TEXTURES", ref images, null, null); + WADReader.LoadHighresFlats(filedata, Path.Combine(Path.GetFileName(file.Filename), "TEXTURES#" + lumpindex), ref images, null, null); filedata.Dispose(); // Find next @@ -676,7 +676,7 @@ namespace CodeImp.DoomBuilder.Data while(lumpindex > -1) { MemoryStream filedata = new MemoryStream(file.Lumps[lumpindex].Stream.ReadAllBytes()); - WADReader.LoadHighresSprites(filedata, "TEXTURES", ref images, null, null); + WADReader.LoadHighresSprites(filedata, Path.Combine(Path.GetFileName(file.Filename), "TEXTURES#" + lumpindex), ref images, null, null); filedata.Dispose(); // Find next diff --git a/Source/Core/General/General.cs b/Source/Core/General/General.cs index c7420e18..57886301 100644 --- a/Source/Core/General/General.cs +++ b/Source/Core/General/General.cs @@ -1023,13 +1023,13 @@ namespace CodeImp.DoomBuilder General.Actions.UnbindMethods(typeof(General)); // Save colors - colors.SaveColors(settings.Config); + if(colors != null) colors.SaveColors(settings.Config); // Save action controls actions.SaveSettings(); // Save game configuration settings - foreach(ConfigurationInfo ci in configs) ci.SaveSettings(); + if(configs != null) foreach(ConfigurationInfo ci in configs) ci.SaveSettings(); // Save settings configuration if(!General.NoSettings) diff --git a/Source/Core/Plugins/Plug.cs b/Source/Core/Plugins/Plug.cs index d920c9b6..9edf7b98 100644 --- a/Source/Core/Plugins/Plug.cs +++ b/Source/Core/Plugins/Plug.cs @@ -52,11 +52,16 @@ namespace CodeImp.DoomBuilder.Plugins public virtual string Name { get { return plugin.Name; } } /// - /// Override this to return the minimum revision of the Doom Builder 2 core that is + /// Override this to return the minimum revision of the GZDoom Builder core that is /// required to use this plugin. You can find the revision number in the About dialog, /// it is the right most part of the version number. /// public virtual int MinimumRevision { get { return 0; } } + + /// + /// Set to true to indicate that plugin revision number must match the main module revision number. + /// + public virtual bool StrictRevisionMatching { get { return false; } } //mxd #endregion diff --git a/Source/Core/Plugins/Plugin.cs b/Source/Core/Plugins/Plugin.cs index 02934e34..3b909ffe 100644 --- a/Source/Core/Plugins/Plugin.cs +++ b/Source/Core/Plugins/Plugin.cs @@ -71,7 +71,6 @@ namespace CodeImp.DoomBuilder.Plugins try { // Load assembly - //asm = Assembly.LoadFile(filename); //mxd asm = Assembly.LoadFrom(filename); } catch(Exception) @@ -95,8 +94,30 @@ namespace CodeImp.DoomBuilder.Plugins plug = CreateObject(t); plug.Plugin = this; - // Verify minimum revision number + // Verify revision numbers int thisrevision = General.ThisAssembly.GetName().Version.Revision; + + //mxd. Revision numbers should match? + if(plug.StrictRevisionMatching && plug.MinimumRevision != thisrevision) + { + string message = shortfilename + " plugin's assembly version (" + plug.MinimumRevision + ") doesn't match main module version (" + thisrevision + ")."; + if(General.ShowWarningMessage(message + Environment.NewLine + + "It's strongly recomended to update the editor." + Environment.NewLine + + "Program stability is not guaranteed." + Environment.NewLine + Environment.NewLine + + "Continue anyway?", MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button2, false) == DialogResult.No) + { + General.WriteLogLine("Quiting on " + shortfilename + " module version mismatch"); + General.Exit(General.Map != null); + return; + } + else + { + General.ErrorLogger.Add(ErrorType.Warning, message); + throw new InvalidProgramException(); + } + } + + // Verify minimum revision number if((thisrevision != 0) && (plug.MinimumRevision > thisrevision)) { // Can't load this plugin because it is meant for a newer version diff --git a/Source/Core/Properties/AssemblyInfo.cs b/Source/Core/Properties/AssemblyInfo.cs index ce6ac15f..89734aa1 100644 --- a/Source/Core/Properties/AssemblyInfo.cs +++ b/Source/Core/Properties/AssemblyInfo.cs @@ -9,7 +9,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("CodeImp, MaxED")] [assembly: AssemblyProduct("GZDoom Builder")] -[assembly: AssemblyCopyright("Copyright © 2007, 2015")] +[assembly: AssemblyCopyright("Copyright © 2007, 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/Source/Core/ZDoom/ZDTextParser.cs b/Source/Core/ZDoom/ZDTextParser.cs index 481f26bf..7f6aad9d 100644 --- a/Source/Core/ZDoom/ZDTextParser.cs +++ b/Source/Core/ZDoom/ZDTextParser.cs @@ -97,11 +97,15 @@ namespace CodeImp.DoomBuilder.ZDoom if(stream.Length == 0) { - if(!string.IsNullOrEmpty(sourcename)) + if(!string.IsNullOrEmpty(sourcename) && sourcename != sourcefilename) + { LogWarning("Include file \"" + sourcefilename + "\" is empty"); + } else + { + sourcename = sourcefilename; // LogWarning() needs "sourcename" property to properly log the warning... LogWarning("File is empty"); - return true; + } } datastream = stream; @@ -526,7 +530,7 @@ namespace CodeImp.DoomBuilder.ZDoom protected internal void LogWarning(string message) { // Add a warning - int errline = GetCurrentLineNumber(); + int errline = (datastream != null ? GetCurrentLineNumber() : CompilerError.NO_LINE_NUMBER); General.ErrorLogger.Add(ErrorType.Warning, GetLanguageType() + " warning in '" + sourcename + (errline != CompilerError.NO_LINE_NUMBER ? "', line " + (errline + 1) : "'") + ". " + message + "."); diff --git a/Source/Plugins/BuilderModes/General/BuilderPlug.cs b/Source/Plugins/BuilderModes/General/BuilderPlug.cs index b227eae5..f637bca0 100644 --- a/Source/Plugins/BuilderModes/General/BuilderPlug.cs +++ b/Source/Plugins/BuilderModes/General/BuilderPlug.cs @@ -137,9 +137,8 @@ namespace CodeImp.DoomBuilder.BuilderModes public override string Name { get { return "GZDoom Builder"; } } //mxd public static BuilderPlug Me { get { return me; } } - // It is only safe to do this dynamically because we compile and distribute both - // the core and this plugin together with the same revision number! In third party - // plugins this should just contain a fixed number. + //mxd. BuilderModes.dll revision should always match the main module revision + public override bool StrictRevisionMatching { get { return true; } } public override int MinimumRevision { get { return Assembly.GetExecutingAssembly().GetName().Version.Revision; } } public MenusForm MenusForm { get { return menusform; } } diff --git a/Source/Plugins/BuilderModes/Properties/AssemblyInfo.cs b/Source/Plugins/BuilderModes/Properties/AssemblyInfo.cs index e7951eca..d5a9e37c 100644 --- a/Source/Plugins/BuilderModes/Properties/AssemblyInfo.cs +++ b/Source/Plugins/BuilderModes/Properties/AssemblyInfo.cs @@ -9,7 +9,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("CodeImp, MaxED")] [assembly: AssemblyProduct("Doom Builder")] -[assembly: AssemblyCopyright("Copyright © 2007, 2014")] +[assembly: AssemblyCopyright("Copyright © 2007, 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -28,4 +28,4 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("2.3.0.1885")] +[assembly: AssemblyVersion("2.3.0.2411")]