- 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:
parent
126c738116
commit
3cbac657d6
4 changed files with 18 additions and 3 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue