mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-07 16:31:34 +00:00
We can use settings from parent when creating a child thing category.
This commit is contained in:
parent
5a7b599a46
commit
922404bf10
2 changed files with 36 additions and 16 deletions
|
@ -88,7 +88,7 @@ namespace CodeImp.DoomBuilder.Config
|
||||||
#region ================== Constructor / Disposer
|
#region ================== Constructor / Disposer
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
internal ThingCategory(string name, string title)
|
internal ThingCategory(ThingCategory parent, string name, string title)
|
||||||
{
|
{
|
||||||
// Initialize
|
// Initialize
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
@ -96,20 +96,40 @@ namespace CodeImp.DoomBuilder.Config
|
||||||
this.things = new List<ThingTypeInfo>();
|
this.things = new List<ThingTypeInfo>();
|
||||||
this.children = new List<ThingCategory>();
|
this.children = new List<ThingCategory>();
|
||||||
|
|
||||||
|
//mxd. Copy properties from the parent
|
||||||
|
if(parent != null)
|
||||||
|
{
|
||||||
|
this.sprite = parent.sprite;
|
||||||
|
this.sorted = parent.sorted;
|
||||||
|
this.color = parent.color;
|
||||||
|
this.arrow = parent.arrow;
|
||||||
|
this.radius = parent.radius;
|
||||||
|
this.height = parent.height;
|
||||||
|
this.hangs = parent.hangs;
|
||||||
|
this.blocking = parent.blocking;
|
||||||
|
this.errorcheck = parent.errorcheck;
|
||||||
|
this.fixedsize = parent.fixedsize;
|
||||||
|
this.fixedrotation = parent.fixedrotation;
|
||||||
|
this.absolutez = parent.absolutez;
|
||||||
|
this.spritescale = parent.spritescale;
|
||||||
|
}
|
||||||
// Set default properties
|
// Set default properties
|
||||||
this.sprite = "";
|
else
|
||||||
this.sorted = true;
|
{
|
||||||
this.color = 18;
|
this.sprite = "";
|
||||||
this.arrow = 1;
|
this.sorted = true;
|
||||||
this.radius = 10;
|
this.color = 18;
|
||||||
this.height = 20;
|
this.arrow = 1;
|
||||||
this.hangs = 0;
|
this.radius = 10;
|
||||||
this.blocking = 0;
|
this.height = 20;
|
||||||
this.errorcheck = 1;
|
this.hangs = 0;
|
||||||
this.fixedsize = false;
|
this.blocking = 0;
|
||||||
this.fixedrotation = false; //mxd
|
this.errorcheck = 1;
|
||||||
this.absolutez = false;
|
this.fixedsize = false;
|
||||||
this.spritescale = 1.0f;
|
this.fixedrotation = false; //mxd
|
||||||
|
this.absolutez = false;
|
||||||
|
this.spritescale = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
// We have no destructor
|
// We have no destructor
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
|
|
|
@ -1575,7 +1575,7 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
if(c.Title.ToLowerInvariant() == catname) cat = c;
|
if(c.Title.ToLowerInvariant() == catname) cat = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
//... then - by Name
|
//...then - by Name
|
||||||
if(cat == null)
|
if(cat == null)
|
||||||
{
|
{
|
||||||
foreach(ThingCategory c in categories)
|
foreach(ThingCategory c in categories)
|
||||||
|
@ -1589,7 +1589,7 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
{
|
{
|
||||||
string cattitle = catnames[0].Trim();
|
string cattitle = catnames[0].Trim();
|
||||||
if(string.IsNullOrEmpty(cattitle)) cattitle = "Decorate";
|
if(string.IsNullOrEmpty(cattitle)) cattitle = "Decorate";
|
||||||
cat = new ThingCategory(catname, cattitle);
|
cat = new ThingCategory(parent, catname, cattitle);
|
||||||
categories.Add(cat); // ^.^
|
categories.Add(cat); // ^.^
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue