feat: updated godot version

This commit is contained in:
Sara Gerretsen 2026-04-04 19:38:56 +02:00
parent 0c508b0831
commit 42b028dbb5
4694 changed files with 236470 additions and 401376 deletions

View file

@ -39,6 +39,7 @@ STATIC_ASSERT_INCOMPLETE_TYPE(class, Object);
#include "core/math/color.h"
#include "core/math/math_funcs.h"
#include "core/object/object.h"
#include "core/os/memory.h"
#include "core/os/os.h"
#include "core/string/print_string.h"
#include "core/string/string_name.h"
@ -47,9 +48,7 @@ STATIC_ASSERT_INCOMPLETE_TYPE(class, Object);
#include "core/variant/variant.h"
#include "core/version_generated.gen.h"
#include <thirdparty/grisu2/grisu2.h>
#include <cstdio>
#include "thirdparty/grisu2/grisu2.h"
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS // to disable build-time warning which suggested to use strcpy_s instead strcpy
@ -352,7 +351,7 @@ bool operator==(const wchar_t *p_chr, const String &p_str) {
// wchar_t is 16-bit
return p_str == String::utf16((const char16_t *)p_chr);
#else
// wchar_t is 32-bit
// wchar_t is 32-bi
return p_str == (const char32_t *)p_chr;
#endif
}
@ -366,7 +365,7 @@ bool operator!=(const wchar_t *p_chr, const String &p_str) {
// wchar_t is 16-bit
return !(p_str == String::utf16((const char16_t *)p_chr));
#else
// wchar_t is 32-bit
// wchar_t is 32-bi
return !(p_str == String((const char32_t *)p_chr));
#endif
}
@ -1658,16 +1657,16 @@ String String::hex_encode_buffer(const uint8_t *p_buffer, int p_len) {
Vector<uint8_t> String::hex_decode() const {
ERR_FAIL_COND_V_MSG(length() % 2 != 0, Vector<uint8_t>(), "Hexadecimal string of uneven length.");
#define HEX_TO_BYTE(m_output, m_index) \
uint8_t m_output; \
c = operator[](m_index); \
if (is_digit(c)) { \
m_output = c - '0'; \
} else if (c >= 'a' && c <= 'f') { \
m_output = c - 'a' + 10; \
} else if (c >= 'A' && c <= 'F') { \
m_output = c - 'A' + 10; \
} else { \
#define HEX_TO_BYTE(m_output, m_index) \
uint8_t m_output; \
c = operator[](m_index); \
if (is_digit(c)) { \
m_output = c - '0'; \
} else if (c >= 'a' && c <= 'f') { \
m_output = c - 'a' + 10; \
} else if (c >= 'A' && c <= 'F') { \
m_output = c - 'A' + 10; \
} else { \
ERR_FAIL_V_MSG(Vector<uint8_t>(), "Invalid hexadecimal character \"" + chr(c) + "\" at index " + m_index + "."); \
}
@ -5189,13 +5188,10 @@ String String::sprintf(const Span<Variant> &values, bool *error) const {
static const String MINUS("-");
static const String PLUS("+");
LocalVector<bool> used_args;
used_args.resize_initialized(values.size());
String formatted;
char32_t *self = (char32_t *)get_data();
bool in_format = false;
uint64_t value_index = 0;
int selected_index = -1;
int min_chars = 0;
int min_decimals = 0;
bool in_decimals = false;
@ -5222,16 +5218,15 @@ String String::sprintf(const Span<Variant> &values, bool *error) const {
case 'o': // Octal
case 'x': // Hexadecimal (lowercase)
case 'X': { // Hexadecimal (uppercase)
uint64_t index = (selected_index >= 0 ? selected_index : value_index);
if (index >= values.size()) {
if (value_index >= values.size()) {
return "not enough arguments for format string";
}
if (!values[index].is_num()) {
if (!values[value_index].is_num()) {
return "a number is required";
}
int64_t value = values[index];
int64_t value = values[value_index];
int base = 16;
bool capitalize = false;
switch (c) {
@ -5287,25 +5282,21 @@ String String::sprintf(const Span<Variant> &values, bool *error) const {
}
formatted += str;
if (selected_index == -1) {
++value_index;
}
used_args[index] = true;
++value_index;
in_format = false;
break;
}
case 'f': { // Float
uint64_t index = (selected_index >= 0 ? selected_index : value_index);
if (index >= values.size()) {
if (value_index >= values.size()) {
return "not enough arguments for format string";
}
if (!values[index].is_num()) {
if (!values[value_index].is_num()) {
return "a number is required";
}
double value = values[index];
double value = values[value_index];
bool is_negative = std::signbit(value);
String str = String::num(Math::abs(value), min_decimals);
const bool is_finite = Math::is_finite(value);
@ -5337,21 +5328,17 @@ String String::sprintf(const Span<Variant> &values, bool *error) const {
}
formatted += str;
if (selected_index == -1) {
++value_index;
}
used_args[index] = true;
++value_index;
in_format = false;
break;
}
case 'v': { // Vector2/3/4/2i/3i/4i
uint64_t index = (selected_index >= 0 ? selected_index : value_index);
if (index >= values.size()) {
if (value_index >= values.size()) {
return "not enough arguments for format string";
}
int count;
switch (values[index].get_type()) {
switch (values[value_index].get_type()) {
case Variant::VECTOR2:
case Variant::VECTOR2I: {
count = 2;
@ -5369,7 +5356,7 @@ String String::sprintf(const Span<Variant> &values, bool *error) const {
}
}
Vector4 vec = values[index];
Vector4 vec = values[value_index];
String str = "(";
for (int i = 0; i < count; i++) {
double val = vec[i];
@ -5411,20 +5398,16 @@ String String::sprintf(const Span<Variant> &values, bool *error) const {
str += ")";
formatted += str;
if (selected_index == -1) {
++value_index;
}
used_args[index] = true;
++value_index;
in_format = false;
break;
}
case 's': { // String
uint64_t index = (selected_index >= 0 ? selected_index : value_index);
if (index >= values.size()) {
if (value_index >= values.size()) {
return "not enough arguments for format string";
}
String str = values[index];
String str = values[value_index];
// Padding.
if (left_justified) {
str = str.rpad(min_chars);
@ -5433,23 +5416,19 @@ String String::sprintf(const Span<Variant> &values, bool *error) const {
}
formatted += str;
if (selected_index == -1) {
++value_index;
}
used_args[index] = true;
++value_index;
in_format = false;
break;
}
case 'c': {
uint64_t index = (selected_index >= 0 ? selected_index : value_index);
if (index >= values.size()) {
if (value_index >= values.size()) {
return "not enough arguments for format string";
}
// Convert to character.
String str;
if (values[index].is_num()) {
int value = values[index];
if (values[value_index].is_num()) {
int value = values[value_index];
if (value < 0) {
return "unsigned integer is lower than minimum";
} else if (value >= 0xd800 && value <= 0xdfff) {
@ -5457,9 +5436,9 @@ String String::sprintf(const Span<Variant> &values, bool *error) const {
} else if (value > 0x10ffff) {
return "unsigned integer is greater than maximum";
}
str = chr(values[index]);
} else if (values[index].get_type() == Variant::STRING) {
str = values[index];
str = chr(values[value_index]);
} else if (values[value_index].get_type() == Variant::STRING) {
str = values[value_index];
if (str.length() != 1) {
return "%c requires number or single-character string";
}
@ -5475,10 +5454,7 @@ String String::sprintf(const Span<Variant> &values, bool *error) const {
}
formatted += str;
if (selected_index == -1) {
++value_index;
}
used_args[index] = true;
++value_index;
in_format = false;
break;
}
@ -5522,14 +5498,6 @@ String String::sprintf(const Span<Variant> &values, bool *error) const {
}
break;
}
case '$': {
if (min_chars > 0) {
selected_index = min_chars - 1;
}
min_chars = 0;
pad_with_zeros = false;
break;
}
case '.': { // Float/Vector separator.
if (in_decimals) {
return "too many decimal points in format";
@ -5540,30 +5508,27 @@ String String::sprintf(const Span<Variant> &values, bool *error) const {
}
case '*': { // Dynamic width, based on value.
uint64_t index = (selected_index >= 0 ? selected_index : value_index);
if (index >= values.size()) {
if (value_index >= values.size()) {
return "not enough arguments for format string";
}
Variant::Type value_type = values[index].get_type();
if (!values[index].is_num() &&
Variant::Type value_type = values[value_index].get_type();
if (!values[value_index].is_num() &&
value_type != Variant::VECTOR2 && value_type != Variant::VECTOR2I &&
value_type != Variant::VECTOR3 && value_type != Variant::VECTOR3I &&
value_type != Variant::VECTOR4 && value_type != Variant::VECTOR4I) {
return "* wants number or vector";
}
int size = values[index];
int size = values[value_index];
if (in_decimals) {
min_decimals = size;
} else {
min_chars = size;
}
if (selected_index == -1) {
++value_index;
}
used_args[index] = true;
++value_index;
break;
}
@ -5582,7 +5547,6 @@ String String::sprintf(const Span<Variant> &values, bool *error) const {
left_justified = false;
show_sign = false;
in_decimals = false;
selected_index = -1;
break;
default:
formatted += c;
@ -5594,10 +5558,8 @@ String String::sprintf(const Span<Variant> &values, bool *error) const {
return "incomplete format";
}
for (const bool &b : used_args) {
if (!b) {
return "not all arguments converted during string formatting";
}
if (value_index != values.size()) {
return "not all arguments converted during string formatting";
}
if (error) {