Added error check for unknown flat names.

@ Some fixes in default texture/flat determination and added nicer functions to check if texture/flat exists.
This commit is contained in:
codeimp 2010-08-12 09:01:22 +00:00
parent 78b0285edc
commit f8aea7cbc4
8 changed files with 273 additions and 95 deletions

View file

@ -418,9 +418,12 @@ namespace CodeImp.DoomBuilder.Config
{
if(!sd.MiddleTexture.StartsWith("-"))
{
foundone = true;
defaulttexture = sd.MiddleTexture;
break;
if(General.Map.Data.GetTextureExists(defaulttexture))
{
foundone = true;
break;
}
}
}
@ -455,10 +458,18 @@ namespace CodeImp.DoomBuilder.Config
foundone = false;
if(General.Map.Map.Sectors.Count > 0)
{
foundone = true;
defaultfloortexture = General.GetByIndex(General.Map.Map.Sectors, 0).FloorTexture;
// Find one that is known
foreach(Sector s in General.Map.Map.Sectors)
{
defaultfloortexture = s.FloorTexture;
if(General.Map.Data.GetFlatExists(defaultfloortexture))
{
foundone = true;
break;
}
}
}
// Pick the first FLOOR from the list.
if(!foundone)
{
@ -480,7 +491,7 @@ namespace CodeImp.DoomBuilder.Config
defaultfloortexture = General.Map.Data.FlatNames[0];
}
}
// Default ceiling missing?
if((defaultceiltexture == null) || (defaultceiltexture.Length == 0))
{
@ -488,10 +499,18 @@ namespace CodeImp.DoomBuilder.Config
foundone = false;
if(General.Map.Map.Sectors.Count > 0)
{
foundone = true;
defaultceiltexture = General.GetByIndex(General.Map.Map.Sectors, 0).CeilTexture;
// Find one that is known
foreach(Sector s in General.Map.Map.Sectors)
{
defaultceiltexture = s.CeilTexture;
if(General.Map.Data.GetFlatExists(defaultceiltexture))
{
foundone = true;
break;
}
}
}
// Pick the first CEIL from the list.
if(!foundone)
{