Ver código fonte

GDScript: Fix type detection for String formatting operator

George Marques 7 anos atrás
pai
commit
7db7b43cb0
1 arquivos alterados com 3 adições e 0 exclusões
  1. 3 0
      modules/gdscript/gdscript_parser.cpp

+ 3 - 0
modules/gdscript/gdscript_parser.cpp

@@ -5438,6 +5438,9 @@ GDScriptParser::DataType GDScriptParser::_get_operation_type(const Variant::Oper
 	if (b_type == Variant::INT || b_type == Variant::REAL) {
 		Variant::evaluate(Variant::OP_ADD, b, 1, b, r_valid);
 	}
+	if (a_type == Variant::STRING) {
+		a = "%s"; // Work around for formatting operator (%)
+	}
 
 	Variant ret;
 	Variant::evaluate(p_op, a, b, ret, r_valid);