Merge pull request #43 from Xabis/master

Fixed crash with arg type 14, and support target class filter
This commit is contained in:
jewalky 2017-02-15 22:48:26 +02:00 committed by GitHub
commit 4a79c7488f
2 changed files with 14 additions and 2 deletions

View file

@ -237,7 +237,7 @@ namespace CodeImp.DoomBuilder.Config
//mxd. Constructor for an argument info defined in DECORATE
internal ArgumentInfo(string actorname, string argtitle, string tooltip, string renderstyle, string rendercolor,
string minrange, string minrangecolor, string maxrange, string maxrangecolor,
string minrange, string minrangecolor, string maxrange, string maxrangecolor, string targetclasses,
int type, int defaultvalue, string enumstr, IDictionary<string, EnumList> enums)
{
this.used = true;
@ -306,6 +306,17 @@ namespace CodeImp.DoomBuilder.Config
}
}
//Check for TargetClass
this.targetclasses = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
if(type == (int)UniversalType.ThingTag)
{
if(!string.IsNullOrEmpty(targetclasses))
{
foreach(string tclass in targetclasses.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries))
this.targetclasses.Add(tclass.Trim());
}
}
// Get argument type
if(System.Enum.IsDefined(typeof(UniversalType), type))
{

View file

@ -479,6 +479,7 @@ namespace CodeImp.DoomBuilder.Config
string argtitle = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i));
string argtooltip = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "tooltip").Replace("\\n", Environment.NewLine));
int argtype = actor.GetPropertyValueInt("$arg" + i + "type", 0);
string targetclasses = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "targetclasses"));
int defaultvalue = actor.GetPropertyValueInt("$arg" + i + "default", 0);
string argenum = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "enum"));
string argrenderstyle = ZDTextParser.StripQuotes(actor.GetPropertyAllValues("$arg" + i + "renderstyle"));
@ -497,7 +498,7 @@ namespace CodeImp.DoomBuilder.Config
}
args[i] = new ArgumentInfo(title, argtitle, argtooltip, argrenderstyle, argrendercolor,
minrange, minrangecolor, maxrange, maxrangecolor,
minrange, minrangecolor, maxrange, maxrangecolor, targetclasses,
argtype, defaultvalue, argenum, General.Map.Config.Enums);
}