1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-30 05:15:59 +02:00

GetCurFloat conversion

This commit is contained in:
Brian Fiete 2024-08-12 14:11:17 -04:00
parent cacfba0d82
commit a28fe5be7d

View file

@ -707,8 +707,16 @@ namespace Beefy.utils
public float GetCurFloat(float theDefault = 0)
{
Object aVal = GetCurrent();
if ((aVal == null) || (!(aVal is float)))
return theDefault;
if (aVal == null)
return theDefault;
if (aVal is double)
return (float)(double)aVal;
if (aVal is int64)
return (float)(int64)aVal;
if (aVal is int32)
return (float)(int32)aVal;
if (!(aVal is float))
return theDefault;
return (float)aVal;
}