mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-26 22:01:45 +00:00
Fixed a case when TEXTRES image was trying to load itself as a patch, which resulted in an infinite loop.
Cosmetic: standardized the way resource names are displayed in warning/error messages in the Errors and Warnings window.
This commit is contained in:
parent
4c60662374
commit
db42e17a86
3 changed files with 37 additions and 10 deletions
|
@ -33,6 +33,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
// Members
|
||||
public int type;
|
||||
public string location;
|
||||
private string name; //mxd
|
||||
public bool option1;
|
||||
public bool option2;
|
||||
public bool notfortesting;
|
||||
|
@ -46,6 +47,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
this.option1 = option1;
|
||||
this.option2 = option2;
|
||||
this.notfortesting = notfortesting;
|
||||
this.name = string.Empty; //mxd
|
||||
}
|
||||
|
||||
// This displays the struct as string
|
||||
|
@ -55,6 +57,31 @@ namespace CodeImp.DoomBuilder.Data
|
|||
return location;
|
||||
}
|
||||
|
||||
//mxd. This returns short location name
|
||||
public string GetShortName()
|
||||
{
|
||||
if(string.IsNullOrEmpty(name))
|
||||
{
|
||||
// Make shorter name for display purposes
|
||||
switch(type)
|
||||
{
|
||||
case RESOURCE_DIRECTORY:
|
||||
name = location.Substring(location.LastIndexOf(Path.DirectorySeparatorChar) + 1);
|
||||
break;
|
||||
|
||||
case RESOURCE_WAD:
|
||||
case RESOURCE_PK3:
|
||||
name = Path.GetFileName(location);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new NotImplementedException("Unknown location type: " + type);
|
||||
}
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
// This compares two locations
|
||||
public int CompareTo(DataLocation other)
|
||||
{
|
||||
|
@ -88,7 +115,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
break;
|
||||
|
||||
default:
|
||||
throw new NotImplementedException("ResourceListEditor.FixedResourceLocationList: got unknown location type: " + type);
|
||||
throw new NotImplementedException("Unknown location type: " + type);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -1513,7 +1513,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
{
|
||||
// Parse the data
|
||||
group.Value.Seek(0, SeekOrigin.Begin);
|
||||
decorate.Parse(group.Value, group.Key, true);
|
||||
decorate.Parse(group.Value, Path.Combine(currentreader.Location.GetShortName(), group.Key), true);
|
||||
|
||||
//mxd. DECORATE lumps are interdepandable. Can't carry on...
|
||||
if(decorate.HasError)
|
||||
|
@ -1765,7 +1765,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
foreach(KeyValuePair<string, Stream> group in decostreams)
|
||||
{
|
||||
// Parse this data
|
||||
parser.Parse(group.Value, Path.Combine(currentreader.Location.location, group.Key), false);
|
||||
parser.Parse(group.Value, group.Key, false);
|
||||
|
||||
//mxd. DECORATE lumps are interdepandable. Can't carry on...
|
||||
if(parser.HasError)
|
||||
|
@ -1909,7 +1909,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
foreach(KeyValuePair<string, Stream> group in streams)
|
||||
{
|
||||
// Parse the data
|
||||
if(parser.Parse(group.Value, Path.Combine(currentreader.Location.location, group.Key), true))
|
||||
if(parser.Parse(group.Value, Path.Combine(currentreader.Location.GetShortName(), group.Key), true))
|
||||
{
|
||||
foreach(KeyValuePair<string, ModelData> g in parser.Entries)
|
||||
{
|
||||
|
@ -1992,7 +1992,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
KeyValuePair<string, Stream> group = dr.GetVoxeldefData();
|
||||
if(group.Value != null)
|
||||
{
|
||||
if(parser.Parse(group.Value, group.Key, true))
|
||||
if(parser.Parse(group.Value, Path.Combine(currentreader.Location.GetShortName(), group.Key), true))
|
||||
{
|
||||
foreach(KeyValuePair<string, ModelData> entry in parser.Entries)
|
||||
{
|
||||
|
@ -2049,7 +2049,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
|
||||
foreach(KeyValuePair<string, Stream> group in streams)
|
||||
{
|
||||
parser.Parse(group.Value, group.Key, false);
|
||||
parser.Parse(group.Value, Path.Combine(currentreader.Location.GetShortName(), group.Key), false);
|
||||
|
||||
// Gldefs can be interdependable. Can't carry on
|
||||
if(parser.HasError)
|
||||
|
@ -2149,7 +2149,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
foreach(KeyValuePair<string, Stream> group in streams)
|
||||
{
|
||||
// Parse the data
|
||||
parser.Parse(group.Value, group.Key, true);
|
||||
parser.Parse(group.Value, Path.Combine(currentreader.Location.GetShortName(), group.Key), true);
|
||||
|
||||
// Report errors?
|
||||
if(parser.HasError) parser.LogError();
|
||||
|
@ -2177,7 +2177,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
// Parse the data
|
||||
foreach(KeyValuePair<string, Stream> group in streams)
|
||||
{
|
||||
parser.Parse(group.Value, group.Key, true);
|
||||
parser.Parse(group.Value, Path.Combine(currentreader.Location.GetShortName(), group.Key), true);
|
||||
|
||||
// Report errors?
|
||||
if(parser.HasError) parser.LogError();
|
||||
|
@ -2203,7 +2203,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
// Parse the data
|
||||
foreach(KeyValuePair<string, Stream> group in streams)
|
||||
{
|
||||
parser.Parse(group.Value, group.Key, true);
|
||||
parser.Parse(group.Value, Path.Combine(currentreader.Location.GetShortName(), group.Key), true);
|
||||
|
||||
// Report errors?
|
||||
if(parser.HasError) parser.LogError();
|
||||
|
|
|
@ -200,7 +200,7 @@ namespace CodeImp.DoomBuilder.Data
|
|||
if(General.Map.Config.MixTexturesFlats)
|
||||
{
|
||||
ImageData img = General.Map.Data.GetTextureImage(p.lumpname);
|
||||
if(!(img is UnknownImage))
|
||||
if(!(img is UnknownImage) && img != this)
|
||||
{
|
||||
if(!img.IsImageLoaded) img.LoadImage();
|
||||
|
||||
|
|
Loading…
Reference in a new issue