UDMF type handler: fixed a problem where default values provided as integers for floating point fields failed to convert properly

This commit is contained in:
biwa 2023-10-14 15:16:29 +02:00
parent ef444b5c8e
commit 1f21b797cf

View file

@ -52,7 +52,8 @@ namespace CodeImp.DoomBuilder.Types
public override void SetupField(TypeHandlerAttribute attr, UniversalFieldInfo fieldinfo)
{
defaultvalue = (fieldinfo == null || fieldinfo.Default == null) ? 0.0 : (double)fieldinfo.Default;
// The default value might be given as int instead as a floating point number, so try to convert it
defaultvalue = (fieldinfo == null || fieldinfo.Default == null) ? 0.0 : Convert.ToDouble(fieldinfo.Default);
base.SetupField(attr, fieldinfo);
}