I can't remember if this was reported as part of another thread, but anyway:
I saw a message in "error.log" about an integer function returning a float result. It tracked to this:
The system presumably doesn't check that the arguments of a function match the type declared in the function. That caused another problem which had to be solved by using a variable inside the function. And so it is here. Something is presumably calling 'iclamp' but feeding ia float parameter to "val", and if it's within the limits, the function returns "val" unaltered - which may be a float. So:
That copies "val", whatever it is, into an integer variable. Then, if the value is within the limits, it returns the variable, not the original "val".
I saw a message in "error.log" about an integer function returning a float result. It tracked to this:
Code:
int iClamp(int min, int max, int val)
{
if(val < min) val = min;
else
{
if(val > max) val = max;
}
return val;
}
Code:
int iClamp(int min, int max, int val)
{
int retval = val;
if(retval < min) retval = min;
else
{
if(retval > max) retval = max;
}
return retval;
}