mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-01 05:10:54 +00:00
Retain argument values if new thing/line action has the same argument(s)
This commit is contained in:
parent
82ef2ab3de
commit
86422d7498
1 changed files with 21 additions and 8 deletions
|
@ -140,7 +140,8 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
stringarginfo = General.Map.Config.LinedefActions[showaction].StringArgs;
|
stringarginfo = General.Map.Config.LinedefActions[showaction].StringArgs;
|
||||||
|
|
||||||
//mxd. Don't update action args when old and new argument infos match
|
//mxd. Don't update action args when old and new argument infos match
|
||||||
if (arginfo != null && oldarginfo != null && stringarginfo != null && oldstringarginfo != null && ArgumentInfosMatch(arginfo, oldarginfo) && ArgumentInfosMatch(stringarginfo, oldstringarginfo)) return;
|
if (arginfo != null && oldarginfo != null && stringarginfo != null && oldstringarginfo != null && ArgumentInfosMatch(arginfo, oldarginfo) && ArgumentInfosMatch(stringarginfo, oldstringarginfo))
|
||||||
|
return;
|
||||||
|
|
||||||
// Change the argument descriptions
|
// Change the argument descriptions
|
||||||
this.BeginUpdate();
|
this.BeginUpdate();
|
||||||
|
@ -157,6 +158,7 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
if (showaction != 0)
|
if (showaction != 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < args.Length; i++)
|
for (int i = 0; i < args.Length; i++)
|
||||||
|
if (!ArgumentInfoMatches(arginfo, oldarginfo, i))
|
||||||
args[i].SetDefaultValue();
|
args[i].SetDefaultValue();
|
||||||
}
|
}
|
||||||
else //or set them to 0
|
else //or set them to 0
|
||||||
|
@ -166,6 +168,7 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < stringargs.Length; i++)
|
for (int i = 0; i < stringargs.Length; i++)
|
||||||
|
if (!ArgumentInfoMatches(stringarginfo, oldstringarginfo, i))
|
||||||
stringargs[i].Text = string.Empty;
|
stringargs[i].Text = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +197,8 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
//mxd. Don't update args when old and new argument infos match
|
//mxd. Don't update args when old and new argument infos match
|
||||||
if (arginfo != null && oldarginfo != null && stringarginfo != null && oldstringarginfo != null && ArgumentInfosMatch(arginfo, oldarginfo) && ArgumentInfosMatch(stringarginfo, oldstringarginfo)) return;
|
if (arginfo != null && oldarginfo != null && stringarginfo != null && oldstringarginfo != null && ArgumentInfosMatch(arginfo, oldarginfo) && ArgumentInfosMatch(stringarginfo, oldstringarginfo))
|
||||||
|
return;
|
||||||
|
|
||||||
// Change the argument descriptions
|
// Change the argument descriptions
|
||||||
this.BeginUpdate();
|
this.BeginUpdate();
|
||||||
|
@ -209,6 +213,7 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
if (info != null)
|
if (info != null)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < args.Length; i++)
|
for (int i = 0; i < args.Length; i++)
|
||||||
|
if (!ArgumentInfoMatches(arginfo, oldarginfo, i))
|
||||||
args[i].SetDefaultValue();
|
args[i].SetDefaultValue();
|
||||||
}
|
}
|
||||||
else //or set them to 0
|
else //or set them to 0
|
||||||
|
@ -218,6 +223,7 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < stringargs.Length; i++)
|
for (int i = 0; i < stringargs.Length; i++)
|
||||||
|
if (!ArgumentInfoMatches(stringarginfo, oldstringarginfo, i))
|
||||||
stringargs[i].Text = string.Empty;
|
stringargs[i].Text = string.Empty;
|
||||||
|
|
||||||
this.EndUpdate();
|
this.EndUpdate();
|
||||||
|
@ -283,6 +289,13 @@ namespace CodeImp.DoomBuilder.Controls
|
||||||
return haveusedargs;
|
return haveusedargs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool ArgumentInfoMatches(ArgumentInfo[] info1, ArgumentInfo[] info2, int i)
|
||||||
|
{
|
||||||
|
if (info1 == null || info2 == null) return false;
|
||||||
|
return !(info1[i].Used != info2[i].Used || info1[i].Type != info2[i].Type
|
||||||
|
|| info1[i].Title.ToUpperInvariant() != info2[i].Title.ToUpperInvariant());
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ================== Redraw control
|
#region ================== Redraw control
|
||||||
|
|
Loading…
Reference in a new issue