From 7b8b91f505d16f73ace0b22b8aa698ea936970c4 Mon Sep 17 00:00:00 2001 From: Kirill Diduk Date: Thu, 4 Nov 2021 14:30:12 +0100 Subject: [PATCH] [GDScript][GDNative] Add 'sort' and 'has' methods to pooled arrays This is a backport from 4.0 to 3.x that adds 'sort' and 'has' methods to the following types: - PoolByteArray - PoolIntArray - PoolRealArray - PoolStringArray - PoolVector2Array - PoolVector3Array - PoolColorArray For all the types above, the methods 'sort' and 'has' have been exposed to the GDNative API (v. 1.3) Since the method 'has' was already implemented in GDScript before, in this commit it has been only exposed to GDNative API. The classes documentation is updated. The method 'sort' uses the exisging class "Sorter". Pooled arrays in 4.0 are rewritten, that's why this backport is not completely indentical to the original PR made for 4.0 (see #32144). --- core/pool_vector.h | 13 +++ core/variant_call.cpp | 14 +++ doc/classes/PoolByteArray.xml | 5 + doc/classes/PoolColorArray.xml | 5 + doc/classes/PoolIntArray.xml | 5 + doc/classes/PoolRealArray.xml | 5 + doc/classes/PoolStringArray.xml | 5 + doc/classes/PoolVector2Array.xml | 5 + doc/classes/PoolVector3Array.xml | 5 + modules/gdnative/gdnative/pool_arrays.cpp | 74 ++++++++++++ modules/gdnative/gdnative_api.json | 105 ++++++++++++++++++ .../gdnative/include/gdnative/pool_arrays.h | 28 +++++ 12 files changed, 269 insertions(+) diff --git a/core/pool_vector.h b/core/pool_vector.h index b53061ad60fa..f8178214ed18 100644 --- a/core/pool_vector.h +++ b/core/pool_vector.h @@ -501,6 +501,7 @@ class PoolVector { Error resize(int p_size); void invert(); + void sort(); void operator=(const PoolVector &p_pool_vector) { _reference(p_pool_vector); } PoolVector() { alloc = nullptr; } @@ -682,4 +683,16 @@ void PoolVector::invert() { } } +template +void PoolVector::sort() { + int len = size(); + if (len == 0) { + return; + } + + Write w = write(); + SortArray sorter; + sorter.sort(w.ptr(), len); +} + #endif // POOL_VECTOR_H diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 7caa27cc68e5..11e9501ba24b 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -706,6 +706,7 @@ struct _VariantCall { VCALL_LOCALMEM2R(PoolByteArray, rfind); VCALL_LOCALMEM1R(PoolByteArray, count); VCALL_LOCALMEM1R(PoolByteArray, has); + VCALL_LOCALMEM0(PoolByteArray, sort); VCALL_LOCALMEM0R(PoolIntArray, size); VCALL_LOCALMEM0R(PoolIntArray, empty); @@ -723,6 +724,7 @@ struct _VariantCall { VCALL_LOCALMEM2R(PoolIntArray, rfind); VCALL_LOCALMEM1R(PoolIntArray, count); VCALL_LOCALMEM1R(PoolIntArray, has); + VCALL_LOCALMEM0(PoolIntArray, sort); VCALL_LOCALMEM0R(PoolRealArray, size); VCALL_LOCALMEM0R(PoolRealArray, empty); @@ -740,6 +742,7 @@ struct _VariantCall { VCALL_LOCALMEM2R(PoolRealArray, rfind); VCALL_LOCALMEM1R(PoolRealArray, count); VCALL_LOCALMEM1R(PoolRealArray, has); + VCALL_LOCALMEM0(PoolRealArray, sort); VCALL_LOCALMEM0R(PoolStringArray, size); VCALL_LOCALMEM0R(PoolStringArray, empty); @@ -758,6 +761,7 @@ struct _VariantCall { VCALL_LOCALMEM2R(PoolStringArray, rfind); VCALL_LOCALMEM1R(PoolStringArray, count); VCALL_LOCALMEM1R(PoolStringArray, has); + VCALL_LOCALMEM0(PoolStringArray, sort) VCALL_LOCALMEM0R(PoolVector2Array, size); VCALL_LOCALMEM0R(PoolVector2Array, empty); @@ -775,6 +779,7 @@ struct _VariantCall { VCALL_LOCALMEM2R(PoolVector2Array, rfind); VCALL_LOCALMEM1R(PoolVector2Array, count); VCALL_LOCALMEM1R(PoolVector2Array, has); + VCALL_LOCALMEM0(PoolVector2Array, sort); VCALL_LOCALMEM0R(PoolVector3Array, size); VCALL_LOCALMEM0R(PoolVector3Array, empty); @@ -792,6 +797,7 @@ struct _VariantCall { VCALL_LOCALMEM2R(PoolVector3Array, rfind); VCALL_LOCALMEM1R(PoolVector3Array, count); VCALL_LOCALMEM1R(PoolVector3Array, has); + VCALL_LOCALMEM0(PoolVector3Array, sort); VCALL_LOCALMEM0R(PoolColorArray, size); VCALL_LOCALMEM0R(PoolColorArray, empty); @@ -809,6 +815,7 @@ struct _VariantCall { VCALL_LOCALMEM2R(PoolColorArray, rfind); VCALL_LOCALMEM1R(PoolColorArray, count); VCALL_LOCALMEM1R(PoolColorArray, has); + VCALL_LOCALMEM0(PoolColorArray, sort); #define VCALL_PTR0(m_type, m_method) \ static void _call_##m_type##_##m_method(Variant &r_ret, Variant &p_self, const Variant **p_args) { reinterpret_cast(p_self._data._ptr)->m_method(); } @@ -1980,6 +1987,7 @@ void register_variant_methods() { ADDFUNC2R(POOL_BYTE_ARRAY, INT, PoolByteArray, rfind, INT, "value", INT, "from", varray(-1)); ADDFUNC1R(POOL_BYTE_ARRAY, INT, PoolByteArray, count, INT, "value", varray()); ADDFUNC1R(POOL_BYTE_ARRAY, BOOL, PoolByteArray, has, INT, "value", varray()); + ADDFUNC0(POOL_BYTE_ARRAY, NIL, PoolByteArray, sort, varray()); ADDFUNC0R(POOL_BYTE_ARRAY, STRING, PoolByteArray, get_string_from_ascii, varray()); ADDFUNC0R(POOL_BYTE_ARRAY, STRING, PoolByteArray, get_string_from_utf8, varray()); @@ -2003,6 +2011,7 @@ void register_variant_methods() { ADDFUNC2R(POOL_INT_ARRAY, INT, PoolIntArray, rfind, INT, "value", INT, "from", varray(-1)); ADDFUNC1R(POOL_INT_ARRAY, INT, PoolIntArray, count, INT, "value", varray()); ADDFUNC1R(POOL_INT_ARRAY, BOOL, PoolIntArray, has, INT, "value", varray()); + ADDFUNC0(POOL_INT_ARRAY, NIL, PoolIntArray, sort, varray()); ADDFUNC0R(POOL_REAL_ARRAY, INT, PoolRealArray, size, varray()); ADDFUNC0R(POOL_REAL_ARRAY, BOOL, PoolRealArray, empty, varray()); @@ -2019,6 +2028,7 @@ void register_variant_methods() { ADDFUNC2R(POOL_REAL_ARRAY, INT, PoolRealArray, rfind, REAL, "value", INT, "from", varray(-1)); ADDFUNC1R(POOL_REAL_ARRAY, INT, PoolRealArray, count, REAL, "value", varray()); ADDFUNC1R(POOL_REAL_ARRAY, BOOL, PoolRealArray, has, REAL, "value", varray()); + ADDFUNC0(POOL_REAL_ARRAY, NIL, PoolRealArray, sort, varray()); ADDFUNC0R(POOL_STRING_ARRAY, INT, PoolStringArray, size, varray()); ADDFUNC0R(POOL_STRING_ARRAY, BOOL, PoolStringArray, empty, varray()); @@ -2036,6 +2046,7 @@ void register_variant_methods() { ADDFUNC2R(POOL_STRING_ARRAY, INT, PoolStringArray, rfind, STRING, "value", INT, "from", varray(-1)); ADDFUNC1R(POOL_STRING_ARRAY, INT, PoolStringArray, count, STRING, "value", varray()); ADDFUNC1R(POOL_STRING_ARRAY, BOOL, PoolStringArray, has, STRING, "value", varray()); + ADDFUNC0(POOL_STRING_ARRAY, NIL, PoolStringArray, sort, varray()); ADDFUNC0R(POOL_VECTOR2_ARRAY, INT, PoolVector2Array, size, varray()); ADDFUNC0R(POOL_VECTOR2_ARRAY, BOOL, PoolVector2Array, empty, varray()); @@ -2052,6 +2063,7 @@ void register_variant_methods() { ADDFUNC2R(POOL_VECTOR2_ARRAY, INT, PoolVector2Array, rfind, VECTOR2, "value", INT, "from", varray(-1)); ADDFUNC1R(POOL_VECTOR2_ARRAY, INT, PoolVector2Array, count, VECTOR2, "value", varray()); ADDFUNC1R(POOL_VECTOR2_ARRAY, BOOL, PoolVector2Array, has, VECTOR2, "value", varray()); + ADDFUNC0(POOL_VECTOR2_ARRAY, NIL, PoolVector2Array, sort, varray()); ADDFUNC0R(POOL_VECTOR3_ARRAY, INT, PoolVector3Array, size, varray()); ADDFUNC0R(POOL_VECTOR3_ARRAY, BOOL, PoolVector3Array, empty, varray()); @@ -2068,6 +2080,7 @@ void register_variant_methods() { ADDFUNC2R(POOL_VECTOR3_ARRAY, INT, PoolVector3Array, rfind, VECTOR3, "value", INT, "from", varray(-1)); ADDFUNC1R(POOL_VECTOR3_ARRAY, INT, PoolVector3Array, count, VECTOR3, "value", varray()); ADDFUNC1R(POOL_VECTOR3_ARRAY, BOOL, PoolVector3Array, has, VECTOR3, "value", varray()); + ADDFUNC0(POOL_VECTOR3_ARRAY, NIL, PoolVector3Array, sort, varray()); ADDFUNC0R(POOL_COLOR_ARRAY, INT, PoolColorArray, size, varray()); ADDFUNC0R(POOL_COLOR_ARRAY, BOOL, PoolColorArray, empty, varray()); @@ -2084,6 +2097,7 @@ void register_variant_methods() { ADDFUNC2R(POOL_COLOR_ARRAY, INT, PoolColorArray, rfind, COLOR, "value", INT, "from", varray(-1)); ADDFUNC1R(POOL_COLOR_ARRAY, INT, PoolColorArray, count, COLOR, "value", varray()); ADDFUNC1R(POOL_COLOR_ARRAY, BOOL, PoolColorArray, has, COLOR, "value", varray()); + ADDFUNC0(POOL_COLOR_ARRAY, NIL, PoolColorArray, sort, varray()); //pointerbased diff --git a/doc/classes/PoolByteArray.xml b/doc/classes/PoolByteArray.xml index ec42d2ed8277..af51f87f415b 100644 --- a/doc/classes/PoolByteArray.xml +++ b/doc/classes/PoolByteArray.xml @@ -178,6 +178,11 @@ Returns the number of elements in the array. + + + Sorts the elements of the array in ascending order. + + diff --git a/doc/classes/PoolColorArray.xml b/doc/classes/PoolColorArray.xml index 8f63f0541e3a..478ba7c1be9c 100644 --- a/doc/classes/PoolColorArray.xml +++ b/doc/classes/PoolColorArray.xml @@ -129,6 +129,11 @@ Returns the number of elements in the array. + + + Sorts the elements of the array in ascending order. + + diff --git a/doc/classes/PoolIntArray.xml b/doc/classes/PoolIntArray.xml index 5ea87784487c..8d17db3632b5 100644 --- a/doc/classes/PoolIntArray.xml +++ b/doc/classes/PoolIntArray.xml @@ -131,6 +131,11 @@ Returns the number of elements in the array. + + + Sorts the elements of the array in ascending order. + + diff --git a/doc/classes/PoolRealArray.xml b/doc/classes/PoolRealArray.xml index 4ba010b661ad..73c678d43b2f 100644 --- a/doc/classes/PoolRealArray.xml +++ b/doc/classes/PoolRealArray.xml @@ -131,6 +131,11 @@ Returns the number of elements in the array. + + + Sorts the elements of the array in ascending order. + + diff --git a/doc/classes/PoolStringArray.xml b/doc/classes/PoolStringArray.xml index fc43adb164c6..30c3df327343 100644 --- a/doc/classes/PoolStringArray.xml +++ b/doc/classes/PoolStringArray.xml @@ -137,6 +137,11 @@ Returns the number of elements in the array. + + + Sorts the elements of the array in ascending order. + + diff --git a/doc/classes/PoolVector2Array.xml b/doc/classes/PoolVector2Array.xml index 8f10358e68e3..739a03da7395 100644 --- a/doc/classes/PoolVector2Array.xml +++ b/doc/classes/PoolVector2Array.xml @@ -130,6 +130,11 @@ Returns the number of elements in the array. + + + Sorts the elements of the array in ascending order. + + diff --git a/doc/classes/PoolVector3Array.xml b/doc/classes/PoolVector3Array.xml index 08098fb16071..fd42625db660 100644 --- a/doc/classes/PoolVector3Array.xml +++ b/doc/classes/PoolVector3Array.xml @@ -129,6 +129,11 @@ Returns the number of elements in the array. + + + Sorts the elements of the array in ascending order. + + diff --git a/modules/gdnative/gdnative/pool_arrays.cpp b/modules/gdnative/gdnative/pool_arrays.cpp index e48b82d62bcb..324fa451e36f 100644 --- a/modules/gdnative/gdnative/pool_arrays.cpp +++ b/modules/gdnative/gdnative/pool_arrays.cpp @@ -112,6 +112,11 @@ void GDAPI godot_pool_byte_array_resize(godot_pool_byte_array *p_self, const god self->resize(p_size); } +void GDAPI godot_pool_byte_array_sort(godot_pool_byte_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + self->sort(); +} + godot_pool_byte_array_read_access GDAPI *godot_pool_byte_array_read(const godot_pool_byte_array *p_self) { const PoolVector *self = (const PoolVector *)p_self; return (godot_pool_byte_array_read_access *)memnew(PoolVector::Read(self->read())); @@ -142,6 +147,11 @@ godot_bool GDAPI godot_pool_byte_array_empty(const godot_pool_byte_array *p_self return self->empty(); } +godot_bool GDAPI godot_pool_byte_array_has(godot_pool_byte_array *p_self, const uint8_t p_data) { + const PoolVector *self = (const PoolVector *)p_self; + return self->has(p_data); +} + void GDAPI godot_pool_byte_array_destroy(godot_pool_byte_array *p_self) { ((PoolVector *)p_self)->~PoolVector(); } @@ -206,6 +216,11 @@ void GDAPI godot_pool_int_array_resize(godot_pool_int_array *p_self, const godot self->resize(p_size); } +void GDAPI godot_pool_int_array_sort(godot_pool_int_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + self->sort(); +} + godot_pool_int_array_read_access GDAPI *godot_pool_int_array_read(const godot_pool_int_array *p_self) { const PoolVector *self = (const PoolVector *)p_self; return (godot_pool_int_array_read_access *)memnew(PoolVector::Read(self->read())); @@ -236,6 +251,11 @@ godot_bool GDAPI godot_pool_int_array_empty(const godot_pool_int_array *p_self) return self->empty(); } +godot_bool GDAPI godot_pool_int_array_has(godot_pool_int_array *p_self, const godot_int p_data) { + const PoolVector *self = (const PoolVector *)p_self; + return self->has(p_data); +} + void GDAPI godot_pool_int_array_destroy(godot_pool_int_array *p_self) { ((PoolVector *)p_self)->~PoolVector(); } @@ -300,6 +320,11 @@ void GDAPI godot_pool_real_array_resize(godot_pool_real_array *p_self, const god self->resize(p_size); } +void GDAPI godot_pool_real_array_sort(godot_pool_real_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + self->sort(); +} + godot_pool_real_array_read_access GDAPI *godot_pool_real_array_read(const godot_pool_real_array *p_self) { const PoolVector *self = (const PoolVector *)p_self; return (godot_pool_real_array_read_access *)memnew(PoolVector::Read(self->read())); @@ -330,6 +355,11 @@ godot_bool GDAPI godot_pool_real_array_empty(const godot_pool_real_array *p_self return self->empty(); } +godot_bool GDAPI godot_pool_real_array_has(godot_pool_real_array *p_self, const godot_real p_data) { + const PoolVector *self = (const PoolVector *)p_self; + return self->has(p_data); +} + void GDAPI godot_pool_real_array_destroy(godot_pool_real_array *p_self) { ((PoolVector *)p_self)->~PoolVector(); } @@ -408,6 +438,11 @@ void GDAPI godot_pool_string_array_resize(godot_pool_string_array *p_self, const self->resize(p_size); } +void GDAPI godot_pool_string_array_sort(godot_pool_string_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + self->sort(); +} + godot_pool_string_array_read_access GDAPI *godot_pool_string_array_read(const godot_pool_string_array *p_self) { const PoolVector *self = (const PoolVector *)p_self; return (godot_pool_string_array_read_access *)memnew(PoolVector::Read(self->read())); @@ -443,6 +478,12 @@ godot_bool GDAPI godot_pool_string_array_empty(const godot_pool_string_array *p_ return self->empty(); } +godot_bool GDAPI godot_pool_string_array_has(godot_pool_string_array *p_self, const godot_string *p_data) { + const PoolVector *self = (const PoolVector *)p_self; + String &s = *(String *)p_data; + return self->has(s); +} + void GDAPI godot_pool_string_array_destroy(godot_pool_string_array *p_self) { ((PoolVector *)p_self)->~PoolVector(); } @@ -510,6 +551,11 @@ void GDAPI godot_pool_vector2_array_resize(godot_pool_vector2_array *p_self, con self->resize(p_size); } +void GDAPI godot_pool_vector2_array_sort(godot_pool_vector2_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + self->sort(); +} + godot_pool_vector2_array_read_access GDAPI *godot_pool_vector2_array_read(const godot_pool_vector2_array *p_self) { const PoolVector *self = (const PoolVector *)p_self; return (godot_pool_vector2_array_read_access *)memnew(PoolVector::Read(self->read())); @@ -544,6 +590,12 @@ godot_bool GDAPI godot_pool_vector2_array_empty(const godot_pool_vector2_array * return self->empty(); } +godot_bool GDAPI godot_pool_vector2_array_has(godot_pool_vector2_array *p_self, const godot_vector2 *p_data) { + const PoolVector *self = (const PoolVector *)p_self; + Vector2 &s = *(Vector2 *)p_data; + return self->has(s); +} + void GDAPI godot_pool_vector2_array_destroy(godot_pool_vector2_array *p_self) { ((PoolVector *)p_self)->~PoolVector(); } @@ -611,6 +663,11 @@ void GDAPI godot_pool_vector3_array_resize(godot_pool_vector3_array *p_self, con self->resize(p_size); } +void GDAPI godot_pool_vector3_array_sort(godot_pool_vector3_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + self->sort(); +} + godot_pool_vector3_array_read_access GDAPI *godot_pool_vector3_array_read(const godot_pool_vector3_array *p_self) { const PoolVector *self = (const PoolVector *)p_self; return (godot_pool_vector3_array_read_access *)memnew(PoolVector::Read(self->read())); @@ -645,6 +702,12 @@ godot_bool GDAPI godot_pool_vector3_array_empty(const godot_pool_vector3_array * return self->empty(); } +godot_bool GDAPI godot_pool_vector3_array_has(godot_pool_vector3_array *p_self, const godot_vector3 *p_data) { + const PoolVector *self = (const PoolVector *)p_self; + Vector3 &s = *(Vector3 *)p_data; + return self->has(s); +} + void GDAPI godot_pool_vector3_array_destroy(godot_pool_vector3_array *p_self) { ((PoolVector *)p_self)->~PoolVector(); } @@ -712,6 +775,11 @@ void GDAPI godot_pool_color_array_resize(godot_pool_color_array *p_self, const g self->resize(p_size); } +void GDAPI godot_pool_color_array_sort(godot_pool_color_array *p_self) { + PoolVector *self = (PoolVector *)p_self; + self->sort(); +} + godot_pool_color_array_read_access GDAPI *godot_pool_color_array_read(const godot_pool_color_array *p_self) { const PoolVector *self = (const PoolVector *)p_self; return (godot_pool_color_array_read_access *)memnew(PoolVector::Read(self->read())); @@ -746,6 +814,12 @@ godot_bool GDAPI godot_pool_color_array_empty(const godot_pool_color_array *p_se return self->empty(); } +godot_bool GDAPI godot_pool_color_array_has(godot_pool_color_array *p_self, const godot_color *p_data) { + const PoolVector *self = (const PoolVector *)p_self; + Color &s = *(Color *)p_data; + return self->has(s); +} + void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_self) { ((PoolVector *)p_self)->~PoolVector(); } diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json index 4475c7f04996..a9f1633ab637 100644 --- a/modules/gdnative/gdnative_api.json +++ b/modules/gdnative/gdnative_api.json @@ -25,6 +25,59 @@ }, "next": null, "api": [ + { + "name": "godot_pool_byte_array_has", + "return_type": "godot_bool", + "arguments": [ + ["godot_pool_byte_array *", "p_self"], + ["const uint8_t", "p_data"] + ] + }, + { + "name": "godot_pool_byte_array_sort", + "return_type": "void", + "arguments": [ + ["godot_pool_byte_array *", "p_self"] + ] + }, + { + "name": "godot_pool_int_array_has", + "return_type": "godot_bool", + "arguments": [ + ["godot_pool_int_array *", "p_self"], + ["const godot_int", "p_data"] + ] + }, + { + "name": "godot_pool_int_array_sort", + "return_type": "void", + "arguments": [ + ["godot_pool_int_array *", "p_self"] + ] + }, + { + "name": "godot_pool_real_array_has", + "return_type": "godot_bool", + "arguments": [ + ["godot_pool_real_array *", "p_self"], + ["const godot_real", "p_data"] + ] + }, + { + "name": "godot_pool_real_array_sort", + "return_type": "void", + "arguments": [ + ["godot_pool_real_array *", "p_self"] + ] + }, + { + "name": "godot_pool_string_array_has", + "return_type": "godot_bool", + "arguments": [ + ["godot_pool_string_array *", "p_self"], + ["const godot_string *", "p_data"] + ] + }, { "name": "godot_pool_string_array_join", "return_type": "godot_string", @@ -32,6 +85,58 @@ ["godot_pool_string_array *", "p_self"], ["const godot_string *", "p_delimiter"] ] + }, + { + "name": "godot_pool_string_array_sort", + "return_type": "void", + "arguments": [ + ["godot_pool_string_array *", "p_self"] + ] + }, + { + "name": "godot_pool_vector2_array_has", + "return_type": "godot_bool", + "arguments": [ + ["godot_pool_vector2_array *", "p_self"], + ["const godot_vector2 *", "p_data"] + ] + }, + { + "name": "godot_pool_vector2_array_sort", + "return_type": "void", + "arguments": [ + ["godot_pool_vector2_array *", "p_self"] + ] + }, + { + "name": "godot_pool_vector3_array_has", + "return_type": "godot_bool", + "arguments": [ + ["godot_pool_vector3_array *", "p_self"], + ["const godot_vector3 *", "p_data"] + ] + }, + { + "name": "godot_pool_vector3_array_sort", + "return_type": "void", + "arguments": [ + ["godot_pool_vector3_array *", "p_self"] + ] + }, + { + "name": "godot_pool_color_array_has", + "return_type": "godot_bool", + "arguments": [ + ["godot_pool_color_array *", "p_self"], + ["const godot_color *", "p_data"] + ] + }, + { + "name": "godot_pool_color_array_sort", + "return_type": "void", + "arguments": [ + ["godot_pool_color_array *", "p_self"] + ] } ] }, diff --git a/modules/gdnative/include/gdnative/pool_arrays.h b/modules/gdnative/include/gdnative/pool_arrays.h index 680935017b4a..84ec4d34c4d9 100644 --- a/modules/gdnative/include/gdnative/pool_arrays.h +++ b/modules/gdnative/include/gdnative/pool_arrays.h @@ -182,6 +182,8 @@ void GDAPI godot_pool_byte_array_remove(godot_pool_byte_array *p_self, const god void GDAPI godot_pool_byte_array_resize(godot_pool_byte_array *p_self, const godot_int p_size); +void GDAPI godot_pool_byte_array_sort(godot_pool_byte_array *p_self); + godot_pool_byte_array_read_access GDAPI *godot_pool_byte_array_read(const godot_pool_byte_array *p_self); godot_pool_byte_array_write_access GDAPI *godot_pool_byte_array_write(godot_pool_byte_array *p_self); @@ -193,6 +195,8 @@ godot_int GDAPI godot_pool_byte_array_size(const godot_pool_byte_array *p_self); godot_bool GDAPI godot_pool_byte_array_empty(const godot_pool_byte_array *p_self); +godot_bool GDAPI godot_pool_byte_array_has(godot_pool_byte_array *p_self, const uint8_t p_data); + void GDAPI godot_pool_byte_array_destroy(godot_pool_byte_array *p_self); // int @@ -215,6 +219,8 @@ void GDAPI godot_pool_int_array_remove(godot_pool_int_array *p_self, const godot void GDAPI godot_pool_int_array_resize(godot_pool_int_array *p_self, const godot_int p_size); +void GDAPI godot_pool_int_array_sort(godot_pool_int_array *p_self); + godot_pool_int_array_read_access GDAPI *godot_pool_int_array_read(const godot_pool_int_array *p_self); godot_pool_int_array_write_access GDAPI *godot_pool_int_array_write(godot_pool_int_array *p_self); @@ -226,6 +232,8 @@ godot_int GDAPI godot_pool_int_array_size(const godot_pool_int_array *p_self); godot_bool GDAPI godot_pool_int_array_empty(const godot_pool_int_array *p_self); +godot_bool GDAPI godot_pool_int_array_has(godot_pool_int_array *p_self, const godot_int p_data); + void GDAPI godot_pool_int_array_destroy(godot_pool_int_array *p_self); // real @@ -248,6 +256,8 @@ void GDAPI godot_pool_real_array_remove(godot_pool_real_array *p_self, const god void GDAPI godot_pool_real_array_resize(godot_pool_real_array *p_self, const godot_int p_size); +void GDAPI godot_pool_real_array_sort(godot_pool_real_array *p_self); + godot_pool_real_array_read_access GDAPI *godot_pool_real_array_read(const godot_pool_real_array *p_self); godot_pool_real_array_write_access GDAPI *godot_pool_real_array_write(godot_pool_real_array *p_self); @@ -259,6 +269,8 @@ godot_int GDAPI godot_pool_real_array_size(const godot_pool_real_array *p_self); godot_bool GDAPI godot_pool_real_array_empty(const godot_pool_real_array *p_self); +godot_bool GDAPI godot_pool_real_array_has(godot_pool_real_array *p_self, const godot_real p_data); + void GDAPI godot_pool_real_array_destroy(godot_pool_real_array *p_self); // string @@ -283,6 +295,8 @@ void GDAPI godot_pool_string_array_remove(godot_pool_string_array *p_self, const void GDAPI godot_pool_string_array_resize(godot_pool_string_array *p_self, const godot_int p_size); +void GDAPI godot_pool_string_array_sort(godot_pool_string_array *p_self); + godot_pool_string_array_read_access GDAPI *godot_pool_string_array_read(const godot_pool_string_array *p_self); godot_pool_string_array_write_access GDAPI *godot_pool_string_array_write(godot_pool_string_array *p_self); @@ -294,6 +308,8 @@ godot_int GDAPI godot_pool_string_array_size(const godot_pool_string_array *p_se godot_bool GDAPI godot_pool_string_array_empty(const godot_pool_string_array *p_self); +godot_bool GDAPI godot_pool_string_array_has(godot_pool_string_array *p_self, const godot_string *p_data); + void GDAPI godot_pool_string_array_destroy(godot_pool_string_array *p_self); // vector2 @@ -316,6 +332,8 @@ void GDAPI godot_pool_vector2_array_remove(godot_pool_vector2_array *p_self, con void GDAPI godot_pool_vector2_array_resize(godot_pool_vector2_array *p_self, const godot_int p_size); +void GDAPI godot_pool_vector2_array_sort(godot_pool_vector2_array *p_self); + godot_pool_vector2_array_read_access GDAPI *godot_pool_vector2_array_read(const godot_pool_vector2_array *p_self); godot_pool_vector2_array_write_access GDAPI *godot_pool_vector2_array_write(godot_pool_vector2_array *p_self); @@ -327,6 +345,8 @@ godot_int GDAPI godot_pool_vector2_array_size(const godot_pool_vector2_array *p_ godot_bool GDAPI godot_pool_vector2_array_empty(const godot_pool_vector2_array *p_self); +godot_bool GDAPI godot_pool_vector2_array_has(godot_pool_vector2_array *p_self, const godot_vector2 *p_data); + void GDAPI godot_pool_vector2_array_destroy(godot_pool_vector2_array *p_self); // vector3 @@ -349,6 +369,8 @@ void GDAPI godot_pool_vector3_array_remove(godot_pool_vector3_array *p_self, con void GDAPI godot_pool_vector3_array_resize(godot_pool_vector3_array *p_self, const godot_int p_size); +void GDAPI godot_pool_vector3_array_sort(godot_pool_vector3_array *p_self); + godot_pool_vector3_array_read_access GDAPI *godot_pool_vector3_array_read(const godot_pool_vector3_array *p_self); godot_pool_vector3_array_write_access GDAPI *godot_pool_vector3_array_write(godot_pool_vector3_array *p_self); @@ -360,6 +382,8 @@ godot_int GDAPI godot_pool_vector3_array_size(const godot_pool_vector3_array *p_ godot_bool GDAPI godot_pool_vector3_array_empty(const godot_pool_vector3_array *p_self); +godot_bool GDAPI godot_pool_vector3_array_has(godot_pool_vector3_array *p_self, const godot_vector3 *p_data); + void GDAPI godot_pool_vector3_array_destroy(godot_pool_vector3_array *p_self); // color @@ -382,6 +406,8 @@ void GDAPI godot_pool_color_array_remove(godot_pool_color_array *p_self, const g void GDAPI godot_pool_color_array_resize(godot_pool_color_array *p_self, const godot_int p_size); +void GDAPI godot_pool_color_array_sort(godot_pool_color_array *p_self); + godot_pool_color_array_read_access GDAPI *godot_pool_color_array_read(const godot_pool_color_array *p_self); godot_pool_color_array_write_access GDAPI *godot_pool_color_array_write(godot_pool_color_array *p_self); @@ -393,6 +419,8 @@ godot_int GDAPI godot_pool_color_array_size(const godot_pool_color_array *p_self godot_bool GDAPI godot_pool_color_array_empty(const godot_pool_color_array *p_self); +godot_bool GDAPI godot_pool_color_array_has(godot_pool_color_array *p_self, const godot_color *p_data); + void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_self); //