Fixes: GDscript min and max are inverted

This commit is contained in:
Andrea Catania 2020-12-24 18:03:50 +01:00 committed by GitHub
parent 187be733aa
commit 7c6506e028
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -291,7 +291,7 @@ struct VariantUtilityFunctions {
Variant ret; Variant ret;
for (int i = 1; i < p_argcount; i++) { for (int i = 1; i < p_argcount; i++) {
bool valid; bool valid;
Variant::evaluate(Variant::OP_GREATER, base, *p_args[i], ret, valid); Variant::evaluate(Variant::OP_LESS, base, *p_args[i], ret, valid);
if (!valid) { if (!valid) {
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.expected = base.get_type(); r_error.expected = base.get_type();
@ -324,7 +324,7 @@ struct VariantUtilityFunctions {
Variant ret; Variant ret;
for (int i = 1; i < p_argcount; i++) { for (int i = 1; i < p_argcount; i++) {
bool valid; bool valid;
Variant::evaluate(Variant::OP_LESS, base, *p_args[i], ret, valid); Variant::evaluate(Variant::OP_GREATER, base, *p_args[i], ret, valid);
if (!valid) { if (!valid) {
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.expected = base.get_type(); r_error.expected = base.get_type();