mirror of
https://github.com/godotengine/godot.git
synced 2025-01-24 21:01:50 +08:00
Fix type check for max/min
This commit is contained in:
parent
b31d00a914
commit
c8c43997c7
@ -542,7 +542,8 @@ struct VariantUtilityFunctions {
|
||||
}
|
||||
Variant base = *p_args[0];
|
||||
Variant ret;
|
||||
for (int i = 1; i < p_argcount; i++) {
|
||||
|
||||
for (int i = 0; i < p_argcount; i++) {
|
||||
Variant::Type arg_type = p_args[i]->get_type();
|
||||
if (arg_type != Variant::INT && arg_type != Variant::FLOAT) {
|
||||
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
||||
@ -550,6 +551,9 @@ struct VariantUtilityFunctions {
|
||||
r_error.argument = i;
|
||||
return Variant();
|
||||
}
|
||||
if (i == 0) {
|
||||
continue;
|
||||
}
|
||||
bool valid;
|
||||
Variant::evaluate(Variant::OP_LESS, base, *p_args[i], ret, valid);
|
||||
if (!valid) {
|
||||
@ -582,7 +586,8 @@ struct VariantUtilityFunctions {
|
||||
}
|
||||
Variant base = *p_args[0];
|
||||
Variant ret;
|
||||
for (int i = 1; i < p_argcount; i++) {
|
||||
|
||||
for (int i = 0; i < p_argcount; i++) {
|
||||
Variant::Type arg_type = p_args[i]->get_type();
|
||||
if (arg_type != Variant::INT && arg_type != Variant::FLOAT) {
|
||||
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
|
||||
@ -590,6 +595,9 @@ struct VariantUtilityFunctions {
|
||||
r_error.argument = i;
|
||||
return Variant();
|
||||
}
|
||||
if (i == 0) {
|
||||
continue;
|
||||
}
|
||||
bool valid;
|
||||
Variant::evaluate(Variant::OP_GREATER, base, *p_args[i], ret, valid);
|
||||
if (!valid) {
|
||||
|
Loading…
Reference in New Issue
Block a user