summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-07-07 09:09:38 +0200
committerGitHub <noreply@github.com>2020-07-07 09:09:38 +0200
commit624eff4633bfb847a08e2354d57db429c51d0900 (patch)
tree9b532df600ab71575efe0e558b0c09450b4f42e1 /modules
parent141ce4d1f9e195ec3235d0fcbd164414e50370ee (diff)
parentaf80bcd2f8e01130357b090126c26717b736665a (diff)
Merge pull request #32144 from aaronfranke/poolarray
Add sort and has methods to PackedArrays
Diffstat (limited to 'modules')
-rw-r--r--modules/gdnative/gdnative/packed_arrays.cpp94
-rw-r--r--modules/gdnative/gdnative_api.json157
-rw-r--r--modules/gdnative/include/gdnative/packed_arrays.h36
3 files changed, 276 insertions, 11 deletions
diff --git a/modules/gdnative/gdnative/packed_arrays.cpp b/modules/gdnative/gdnative/packed_arrays.cpp
index fc71d50289..de93c1d9b3 100644
--- a/modules/gdnative/gdnative/packed_arrays.cpp
+++ b/modules/gdnative/gdnative/packed_arrays.cpp
@@ -104,6 +104,16 @@ godot_error GDAPI godot_packed_byte_array_insert(godot_packed_byte_array *p_self
return (godot_error)self->insert(p_idx, p_data);
}
+godot_bool GDAPI godot_packed_byte_array_has(godot_packed_byte_array *p_self, const uint8_t p_value) {
+ Vector<uint8_t> *self = (Vector<uint8_t> *)p_self;
+ return (godot_bool)self->has(p_value);
+}
+
+void GDAPI godot_packed_byte_array_sort(godot_packed_byte_array *p_self) {
+ Vector<uint8_t> *self = (Vector<uint8_t> *)p_self;
+ self->sort();
+}
+
void GDAPI godot_packed_byte_array_invert(godot_packed_byte_array *p_self) {
Vector<uint8_t> *self = (Vector<uint8_t> *)p_self;
self->invert();
@@ -198,6 +208,16 @@ godot_error GDAPI godot_packed_int32_array_insert(godot_packed_int32_array *p_se
return (godot_error)self->insert(p_idx, p_data);
}
+godot_bool GDAPI godot_packed_int32_array_has(godot_packed_int32_array *p_self, const int32_t p_value) {
+ Vector<int32_t> *self = (Vector<int32_t> *)p_self;
+ return (godot_bool)self->has(p_value);
+}
+
+void GDAPI godot_packed_int32_array_sort(godot_packed_int32_array *p_self) {
+ Vector<int32_t> *self = (Vector<int32_t> *)p_self;
+ self->sort();
+}
+
void GDAPI godot_packed_int32_array_invert(godot_packed_int32_array *p_self) {
Vector<int32_t> *self = (Vector<int32_t> *)p_self;
self->invert();
@@ -292,6 +312,16 @@ godot_error GDAPI godot_packed_int64_array_insert(godot_packed_int64_array *p_se
return (godot_error)self->insert(p_idx, p_data);
}
+godot_bool GDAPI godot_packed_int64_array_has(godot_packed_int64_array *p_self, const int64_t p_value) {
+ Vector<int64_t> *self = (Vector<int64_t> *)p_self;
+ return (godot_bool)self->has(p_value);
+}
+
+void GDAPI godot_packed_int64_array_sort(godot_packed_int64_array *p_self) {
+ Vector<int64_t> *self = (Vector<int64_t> *)p_self;
+ self->sort();
+}
+
void GDAPI godot_packed_int64_array_invert(godot_packed_int64_array *p_self) {
Vector<int64_t> *self = (Vector<int64_t> *)p_self;
self->invert();
@@ -386,6 +416,16 @@ godot_error GDAPI godot_packed_float32_array_insert(godot_packed_float32_array *
return (godot_error)self->insert(p_idx, p_data);
}
+godot_bool GDAPI godot_packed_float32_array_has(godot_packed_float32_array *p_self, const float p_value) {
+ Vector<float> *self = (Vector<float> *)p_self;
+ return (godot_bool)self->has(p_value);
+}
+
+void GDAPI godot_packed_float32_array_sort(godot_packed_float32_array *p_self) {
+ Vector<float> *self = (Vector<float> *)p_self;
+ self->sort();
+}
+
void GDAPI godot_packed_float32_array_invert(godot_packed_float32_array *p_self) {
Vector<float> *self = (Vector<float> *)p_self;
self->invert();
@@ -480,6 +520,16 @@ godot_error GDAPI godot_packed_float64_array_insert(godot_packed_float64_array *
return (godot_error)self->insert(p_idx, p_data);
}
+godot_bool GDAPI godot_packed_float64_array_has(godot_packed_float64_array *p_self, const double p_value) {
+ Vector<double> *self = (Vector<double> *)p_self;
+ return (godot_bool)self->has(p_value);
+}
+
+void GDAPI godot_packed_float64_array_sort(godot_packed_float64_array *p_self) {
+ Vector<double> *self = (Vector<double> *)p_self;
+ self->sort();
+}
+
void GDAPI godot_packed_float64_array_invert(godot_packed_float64_array *p_self) {
Vector<double> *self = (Vector<double> *)p_self;
self->invert();
@@ -576,6 +626,17 @@ godot_error GDAPI godot_packed_string_array_insert(godot_packed_string_array *p_
return (godot_error)self->insert(p_idx, s);
}
+godot_bool GDAPI godot_packed_string_array_has(godot_packed_string_array *p_self, const godot_string *p_value) {
+ Vector<String> *self = (Vector<String> *)p_self;
+ String &s = *(String *)p_value;
+ return (godot_bool)self->has(s);
+}
+
+void GDAPI godot_packed_string_array_sort(godot_packed_string_array *p_self) {
+ Vector<String> *self = (Vector<String> *)p_self;
+ self->sort();
+}
+
void GDAPI godot_packed_string_array_invert(godot_packed_string_array *p_self) {
Vector<String> *self = (Vector<String> *)p_self;
self->invert();
@@ -678,6 +739,17 @@ godot_error GDAPI godot_packed_vector2_array_insert(godot_packed_vector2_array *
return (godot_error)self->insert(p_idx, s);
}
+godot_bool GDAPI godot_packed_vector2_array_has(godot_packed_vector2_array *p_self, const godot_vector2 *p_value) {
+ Vector<Vector2> *self = (Vector<Vector2> *)p_self;
+ Vector2 &v = *(Vector2 *)p_value;
+ return (godot_bool)self->has(v);
+}
+
+void GDAPI godot_packed_vector2_array_sort(godot_packed_vector2_array *p_self) {
+ Vector<Vector2> *self = (Vector<Vector2> *)p_self;
+ self->sort();
+}
+
void GDAPI godot_packed_vector2_array_invert(godot_packed_vector2_array *p_self) {
Vector<Vector2> *self = (Vector<Vector2> *)p_self;
self->invert();
@@ -779,6 +851,17 @@ godot_error GDAPI godot_packed_vector3_array_insert(godot_packed_vector3_array *
return (godot_error)self->insert(p_idx, s);
}
+godot_bool GDAPI godot_packed_vector3_array_has(godot_packed_vector3_array *p_self, const godot_vector3 *p_value) {
+ Vector<Vector3> *self = (Vector<Vector3> *)p_self;
+ Vector3 &v = *(Vector3 *)p_value;
+ return (godot_bool)self->has(v);
+}
+
+void GDAPI godot_packed_vector3_array_sort(godot_packed_vector3_array *p_self) {
+ Vector<Vector3> *self = (Vector<Vector3> *)p_self;
+ self->sort();
+}
+
void GDAPI godot_packed_vector3_array_invert(godot_packed_vector3_array *p_self) {
Vector<Vector3> *self = (Vector<Vector3> *)p_self;
self->invert();
@@ -880,6 +963,17 @@ godot_error GDAPI godot_packed_color_array_insert(godot_packed_color_array *p_se
return (godot_error)self->insert(p_idx, s);
}
+godot_bool GDAPI godot_packed_color_array_has(godot_packed_color_array *p_self, const godot_color *p_value) {
+ Vector<Color> *self = (Vector<Color> *)p_self;
+ Color &c = *(Color *)p_value;
+ return (godot_bool)self->has(c);
+}
+
+void GDAPI godot_packed_color_array_sort(godot_packed_color_array *p_self) {
+ Vector<Color> *self = (Vector<Color> *)p_self;
+ self->sort();
+}
+
void GDAPI godot_packed_color_array_invert(godot_packed_color_array *p_self) {
Vector<Color> *self = (Vector<Color> *)p_self;
self->invert();
diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json
index 1284ebbd66..eb122089b6 100644
--- a/modules/gdnative/gdnative_api.json
+++ b/modules/gdnative/gdnative_api.json
@@ -918,42 +918,42 @@
["const godot_variant **", "p_arguments"],
["godot_int", "p_argcount"]
]
- },
+ },
{
"name": "godot_callable_is_null",
"return_type": "godot_bool",
"arguments": [
["const godot_callable *", "p_self"]
]
- },
+ },
{
"name": "godot_callable_is_custom",
"return_type": "godot_bool",
"arguments": [
["const godot_callable *", "p_self"]
]
- },
+ },
{
"name": "godot_callable_is_standard",
"return_type": "godot_bool",
"arguments": [
["const godot_callable *", "p_self"]
]
- },
+ },
{
"name": "godot_callable_get_object",
"return_type": "godot_object *",
"arguments": [
["const godot_callable *", "p_self"]
]
- },
+ },
{
"name": "godot_callable_get_object_id",
"return_type": "uint64_t",
"arguments": [
["const godot_callable *", "p_self"]
]
- },
+ },
{
"name": "godot_callable_get_method",
"return_type": "godot_string_name",
@@ -1093,14 +1093,14 @@
"arguments": [
["const godot_signal *", "p_self"]
]
- },
+ },
{
"name": "godot_signal_as_string",
"return_type": "godot_string",
"arguments": [
["const godot_signal *", "p_self"]
]
- },
+ },
{
"name": "godot_signal_operator_equal",
"return_type": "godot_bool",
@@ -1108,7 +1108,7 @@
["const godot_signal *", "p_self"],
["const godot_signal *", "p_other"]
]
- },
+ },
{
"name": "godot_signal_operator_less",
"return_type": "godot_bool",
@@ -1671,6 +1671,21 @@
]
},
{
+ "name": "godot_packed_byte_array_has",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["godot_packed_byte_array *", "p_self"],
+ ["const uint8_t", "p_value"]
+ ]
+ },
+ {
+ "name": "godot_packed_byte_array_sort",
+ "return_type": "void",
+ "arguments": [
+ ["godot_packed_byte_array *", "p_self"]
+ ]
+ },
+ {
"name": "godot_packed_byte_array_invert",
"return_type": "void",
"arguments": [
@@ -1802,6 +1817,21 @@
]
},
{
+ "name": "godot_packed_int32_array_has",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["godot_packed_int32_array *", "p_self"],
+ ["const int32_t", "p_value"]
+ ]
+ },
+ {
+ "name": "godot_packed_int32_array_sort",
+ "return_type": "void",
+ "arguments": [
+ ["godot_packed_int32_array *", "p_self"]
+ ]
+ },
+ {
"name": "godot_packed_int32_array_invert",
"return_type": "void",
"arguments": [
@@ -1933,6 +1963,21 @@
]
},
{
+ "name": "godot_packed_int64_array_has",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["godot_packed_int64_array *", "p_self"],
+ ["const int64_t", "p_value"]
+ ]
+ },
+ {
+ "name": "godot_packed_int64_array_sort",
+ "return_type": "void",
+ "arguments": [
+ ["godot_packed_int64_array *", "p_self"]
+ ]
+ },
+ {
"name": "godot_packed_int64_array_invert",
"return_type": "void",
"arguments": [
@@ -2064,6 +2109,21 @@
]
},
{
+ "name": "godot_packed_float32_array_has",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["godot_packed_float32_array *", "p_self"],
+ ["const float", "p_value"]
+ ]
+ },
+ {
+ "name": "godot_packed_float32_array_sort",
+ "return_type": "void",
+ "arguments": [
+ ["godot_packed_float32_array *", "p_self"]
+ ]
+ },
+ {
"name": "godot_packed_float32_array_invert",
"return_type": "void",
"arguments": [
@@ -2195,6 +2255,21 @@
]
},
{
+ "name": "godot_packed_float64_array_has",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["godot_packed_float64_array *", "p_self"],
+ ["const double", "p_value"]
+ ]
+ },
+ {
+ "name": "godot_packed_float64_array_sort",
+ "return_type": "void",
+ "arguments": [
+ ["godot_packed_float64_array *", "p_self"]
+ ]
+ },
+ {
"name": "godot_packed_float64_array_invert",
"return_type": "void",
"arguments": [
@@ -2326,6 +2401,21 @@
]
},
{
+ "name": "godot_packed_string_array_has",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["godot_packed_string_array *", "p_self"],
+ ["const godot_string *", "p_value"]
+ ]
+ },
+ {
+ "name": "godot_packed_string_array_sort",
+ "return_type": "void",
+ "arguments": [
+ ["godot_packed_string_array *", "p_self"]
+ ]
+ },
+ {
"name": "godot_packed_string_array_invert",
"return_type": "void",
"arguments": [
@@ -2457,6 +2547,21 @@
]
},
{
+ "name": "godot_packed_vector2_array_has",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["godot_packed_vector2_array *", "p_self"],
+ ["const godot_vector2 *", "p_value"]
+ ]
+ },
+ {
+ "name": "godot_packed_vector2_array_sort",
+ "return_type": "void",
+ "arguments": [
+ ["godot_packed_vector2_array *", "p_self"]
+ ]
+ },
+ {
"name": "godot_packed_vector2_array_invert",
"return_type": "void",
"arguments": [
@@ -2588,6 +2693,21 @@
]
},
{
+ "name": "godot_packed_vector3_array_has",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["godot_packed_vector3_array *", "p_self"],
+ ["const godot_vector3 *", "p_value"]
+ ]
+ },
+ {
+ "name": "godot_packed_vector3_array_sort",
+ "return_type": "void",
+ "arguments": [
+ ["godot_packed_vector3_array *", "p_self"]
+ ]
+ },
+ {
"name": "godot_packed_vector3_array_invert",
"return_type": "void",
"arguments": [
@@ -2719,6 +2839,21 @@
]
},
{
+ "name": "godot_packed_color_array_has",
+ "return_type": "godot_bool",
+ "arguments": [
+ ["godot_packed_color_array *", "p_self"],
+ ["const godot_color *", "p_value"]
+ ]
+ },
+ {
+ "name": "godot_packed_color_array_sort",
+ "return_type": "void",
+ "arguments": [
+ ["godot_packed_color_array *", "p_self"]
+ ]
+ },
+ {
"name": "godot_packed_color_array_invert",
"return_type": "void",
"arguments": [
@@ -2748,7 +2883,7 @@
["godot_packed_color_array *", "p_self"],
["const godot_int", "p_size"]
]
- },
+ },
{
"name": "godot_packed_color_array_ptr",
"return_type": "const godot_color *",
@@ -5463,7 +5598,7 @@
["godot_variant *", "r_dest"],
["const godot_packed_int64_array *", "p_pia"]
]
- },
+ },
{
"name": "godot_variant_new_packed_float32_array",
"return_type": "void",
diff --git a/modules/gdnative/include/gdnative/packed_arrays.h b/modules/gdnative/include/gdnative/packed_arrays.h
index 87d467a5b8..6a1727d76f 100644
--- a/modules/gdnative/include/gdnative/packed_arrays.h
+++ b/modules/gdnative/include/gdnative/packed_arrays.h
@@ -167,6 +167,10 @@ void GDAPI godot_packed_byte_array_append_array(godot_packed_byte_array *p_self,
godot_error GDAPI godot_packed_byte_array_insert(godot_packed_byte_array *p_self, const godot_int p_idx, const uint8_t p_data);
+godot_bool GDAPI godot_packed_byte_array_has(godot_packed_byte_array *p_self, const uint8_t p_value);
+
+void GDAPI godot_packed_byte_array_sort(godot_packed_byte_array *p_self);
+
void GDAPI godot_packed_byte_array_invert(godot_packed_byte_array *p_self);
void GDAPI godot_packed_byte_array_push_back(godot_packed_byte_array *p_self, const uint8_t p_data);
@@ -199,6 +203,10 @@ void GDAPI godot_packed_int32_array_append_array(godot_packed_int32_array *p_sel
godot_error GDAPI godot_packed_int32_array_insert(godot_packed_int32_array *p_self, const godot_int p_idx, const int32_t p_data);
+godot_bool GDAPI godot_packed_int32_array_has(godot_packed_int32_array *p_self, const int32_t p_value);
+
+void GDAPI godot_packed_int32_array_sort(godot_packed_int32_array *p_self);
+
void GDAPI godot_packed_int32_array_invert(godot_packed_int32_array *p_self);
void GDAPI godot_packed_int32_array_push_back(godot_packed_int32_array *p_self, const int32_t p_data);
@@ -231,6 +239,10 @@ void GDAPI godot_packed_int64_array_append_array(godot_packed_int64_array *p_sel
godot_error GDAPI godot_packed_int64_array_insert(godot_packed_int64_array *p_self, const godot_int p_idx, const int64_t p_data);
+godot_bool GDAPI godot_packed_int64_array_has(godot_packed_int64_array *p_self, const int64_t p_value);
+
+void GDAPI godot_packed_int64_array_sort(godot_packed_int64_array *p_self);
+
void GDAPI godot_packed_int64_array_invert(godot_packed_int64_array *p_self);
void GDAPI godot_packed_int64_array_push_back(godot_packed_int64_array *p_self, const int64_t p_data);
@@ -263,6 +275,10 @@ void GDAPI godot_packed_float32_array_append_array(godot_packed_float32_array *p
godot_error GDAPI godot_packed_float32_array_insert(godot_packed_float32_array *p_self, const godot_int p_idx, const float p_data);
+godot_bool GDAPI godot_packed_float32_array_has(godot_packed_float32_array *p_self, const float p_value);
+
+void GDAPI godot_packed_float32_array_sort(godot_packed_float32_array *p_self);
+
void GDAPI godot_packed_float32_array_invert(godot_packed_float32_array *p_self);
void GDAPI godot_packed_float32_array_push_back(godot_packed_float32_array *p_self, const float p_data);
@@ -295,6 +311,10 @@ void GDAPI godot_packed_float64_array_append_array(godot_packed_float64_array *p
godot_error GDAPI godot_packed_float64_array_insert(godot_packed_float64_array *p_self, const godot_int p_idx, const double p_data);
+godot_bool GDAPI godot_packed_float64_array_has(godot_packed_float64_array *p_self, const double p_value);
+
+void GDAPI godot_packed_float64_array_sort(godot_packed_float64_array *p_self);
+
void GDAPI godot_packed_float64_array_invert(godot_packed_float64_array *p_self);
void GDAPI godot_packed_float64_array_push_back(godot_packed_float64_array *p_self, const double p_data);
@@ -327,6 +347,10 @@ void GDAPI godot_packed_string_array_append_array(godot_packed_string_array *p_s
godot_error GDAPI godot_packed_string_array_insert(godot_packed_string_array *p_self, const godot_int p_idx, const godot_string *p_data);
+godot_bool GDAPI godot_packed_string_array_has(godot_packed_string_array *p_self, const godot_string *p_value);
+
+void GDAPI godot_packed_string_array_sort(godot_packed_string_array *p_self);
+
void GDAPI godot_packed_string_array_invert(godot_packed_string_array *p_self);
void GDAPI godot_packed_string_array_push_back(godot_packed_string_array *p_self, const godot_string *p_data);
@@ -359,6 +383,10 @@ void GDAPI godot_packed_vector2_array_append_array(godot_packed_vector2_array *p
godot_error GDAPI godot_packed_vector2_array_insert(godot_packed_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data);
+godot_bool GDAPI godot_packed_vector2_array_has(godot_packed_vector2_array *p_self, const godot_vector2 *p_value);
+
+void GDAPI godot_packed_vector2_array_sort(godot_packed_vector2_array *p_self);
+
void GDAPI godot_packed_vector2_array_invert(godot_packed_vector2_array *p_self);
void GDAPI godot_packed_vector2_array_push_back(godot_packed_vector2_array *p_self, const godot_vector2 *p_data);
@@ -391,6 +419,10 @@ void GDAPI godot_packed_vector3_array_append_array(godot_packed_vector3_array *p
godot_error GDAPI godot_packed_vector3_array_insert(godot_packed_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data);
+godot_bool GDAPI godot_packed_vector3_array_has(godot_packed_vector3_array *p_self, const godot_vector3 *p_value);
+
+void GDAPI godot_packed_vector3_array_sort(godot_packed_vector3_array *p_self);
+
void GDAPI godot_packed_vector3_array_invert(godot_packed_vector3_array *p_self);
void GDAPI godot_packed_vector3_array_push_back(godot_packed_vector3_array *p_self, const godot_vector3 *p_data);
@@ -423,6 +455,10 @@ void GDAPI godot_packed_color_array_append_array(godot_packed_color_array *p_sel
godot_error GDAPI godot_packed_color_array_insert(godot_packed_color_array *p_self, const godot_int p_idx, const godot_color *p_data);
+godot_bool GDAPI godot_packed_color_array_has(godot_packed_color_array *p_self, const godot_color *p_value);
+
+void GDAPI godot_packed_color_array_sort(godot_packed_color_array *p_self);
+
void GDAPI godot_packed_color_array_invert(godot_packed_color_array *p_self);
void GDAPI godot_packed_color_array_push_back(godot_packed_color_array *p_self, const godot_color *p_data);