mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-25 05:11:56 +00:00
UDBScript: fixed a crash when trying to access the UDMF fields of a thing that has its scale set. Fixes #1079
This commit is contained in:
parent
11f864bb6e
commit
e1ce00aa84
1 changed files with 22 additions and 6 deletions
|
@ -530,10 +530,10 @@ namespace CodeImp.DoomBuilder.UDBScript.Wrapper
|
||||||
/// <param name="fields">UniFields of the map element</param>
|
/// <param name="fields">UniFields of the map element</param>
|
||||||
internal override void AddManagedFields(IDictionary<string, object> fields)
|
internal override void AddManagedFields(IDictionary<string, object> fields)
|
||||||
{
|
{
|
||||||
if (thing.ScaleX != 1.0)
|
if (!fields.ContainsKey("scalex") && thing.ScaleX != 1.0)
|
||||||
fields.Add("scalex", thing.ScaleX);
|
fields.Add("scalex", thing.ScaleX);
|
||||||
|
|
||||||
if (thing.ScaleY != 1.0)
|
if (!fields.ContainsKey("scaley") && thing.ScaleY != 1.0)
|
||||||
fields.Add("scaley", thing.ScaleY);
|
fields.Add("scaley", thing.ScaleY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -549,12 +549,28 @@ namespace CodeImp.DoomBuilder.UDBScript.Wrapper
|
||||||
switch(pname)
|
switch(pname)
|
||||||
{
|
{
|
||||||
case "scalex":
|
case "scalex":
|
||||||
if (newvalue == null) thing.SetScale(1.0, thing.ScaleY);
|
if (newvalue == null)
|
||||||
else thing.SetScale((double)newvalue, thing.ScaleY);
|
{
|
||||||
|
thing.SetScale(1.0, thing.ScaleY);
|
||||||
|
UniFields.RemoveField(fields, "scalex");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
thing.SetScale((double)newvalue, thing.ScaleY);
|
||||||
|
UniFields.SetFloat(fields, "scalex", (double)newvalue);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
case "scaley":
|
case "scaley":
|
||||||
if(newvalue == null) thing.SetScale(thing.ScaleX, 1.0);
|
if (newvalue == null)
|
||||||
else thing.SetScale(thing.ScaleX, (double)newvalue);
|
{
|
||||||
|
thing.SetScale(thing.ScaleX, 1.0);
|
||||||
|
UniFields.RemoveField(fields, "scaley");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
thing.SetScale(thing.ScaleX, (double)newvalue);
|
||||||
|
UniFields.SetFloat(fields, "scaley", (double)newvalue);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue