- Added type coercion for action function parameters.

- I add PARAMI, and then I don't even do it right...

SVN r1919 (scripting)
This commit is contained in:
Randy Heit 2009-10-15 22:15:55 +00:00
commit 3cbac657d6
4 changed files with 18 additions and 3 deletions

View file

@ -151,6 +151,21 @@ FxExpression *ParseParameter(FScanner &sc, PClass *cls, char type, bool constant
{
sc.ScriptError("Default parameter must be constant.");
}
// Do automatic coercion between ints and floats.
if (type == 'x' || type == 'X')
{
if (x->ValueType != VAL_Int)
{
x = new FxIntCast(x);
}
}
else
{
if (x->ValueType != VAL_Float)
{
x = new FxFloatCast(x);
}
}
break;
default: