"Texture 'XXX' is double defined in resource 'YYY'." warning is no longer displayed if a texture contains a patch with the same name as the texture.

This commit is contained in:
MaxED 2014-07-11 11:00:24 +00:00
parent f2c0d0a4c8
commit a485b40bee
2 changed files with 12 additions and 5 deletions

View file

@ -18,6 +18,7 @@
using System.Collections.Generic;
using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.IO;
#endregion
@ -64,7 +65,7 @@ namespace CodeImp.DoomBuilder.Config
// Add a texture
internal void AddTexture(ImageData image)
{
if(textures.ContainsKey(image.LongName))
if(textures.ContainsKey(image.LongName) && (!(image is HighResImage) || !(image as HighResImage).ContainsPatch(image.Name)) )
General.ErrorLogger.Add(ErrorType.Warning, "Texture \"" + image.Name + "\" is double defined in resource \"" + this.Location.location + "\".");
textures[image.LongName] = image;
}

View file

@ -32,7 +32,7 @@ namespace CodeImp.DoomBuilder.Data
{
#region ================== Variables
private List<TexturePatch> patches;
private Dictionary<string, TexturePatch> patches; //mxd
private bool gotFullName;//mxd
private string type;
@ -49,7 +49,7 @@ namespace CodeImp.DoomBuilder.Data
this.scale.x = scalex;
this.scale.y = scaley;
this.worldpanning = worldpanning;
this.patches = new List<TexturePatch>();
this.patches = new Dictionary<string, TexturePatch>(1);
this.type = type;
SetName(name);
@ -65,7 +65,7 @@ namespace CodeImp.DoomBuilder.Data
public void AddPatch(TexturePatch patch)
{
// Add it
patches.Add(patch);
patches.Add(patch.lumpname, patch);
//mxd. Get full name from first patch
if (!gotFullName) {
@ -111,7 +111,7 @@ namespace CodeImp.DoomBuilder.Data
if(!loadfailed)
{
// Go for all patches
foreach(TexturePatch p in patches)
foreach(TexturePatch p in patches.Values)
{
// Get the patch data stream
Stream patchdata;
@ -338,6 +338,12 @@ namespace CodeImp.DoomBuilder.Data
}
}
//mxd
public bool ContainsPatch(string name)
{
return patches.ContainsKey(name);
}
#endregion
}
}