diff --git a/gdnative/array.cpp b/gdnative/array.cpp index 36735d4..a9f6720 100644 --- a/gdnative/array.cpp +++ b/gdnative/array.cpp @@ -55,57 +55,9 @@ void GDAPI pandemonium_array_new_copy(pandemonium_array *r_dest, const pandemoni memnew_placement(dest, Array(*src)); } -void GDAPI pandemonium_array_new_pool_color_array(pandemonium_array *r_dest, const pandemonium_pool_color_array *p_pca) { +void GDAPI pandemonium_array_new_pool_byte_array(pandemonium_array *r_dest, const pandemonium_pool_byte_array *p_pba) { Array *dest = (Array *)r_dest; - PoolVector *pca = (PoolVector *)p_pca; - memnew_placement(dest, Array); - dest->resize(pca->size()); - - for (int i = 0; i < dest->size(); i++) { - Variant v = pca->operator[](i); - dest->operator[](i) = v; - } -} - -void GDAPI pandemonium_array_new_pool_vector3_array(pandemonium_array *r_dest, const pandemonium_pool_vector3_array *p_pv3a) { - Array *dest = (Array *)r_dest; - PoolVector *pca = (PoolVector *)p_pv3a; - memnew_placement(dest, Array); - dest->resize(pca->size()); - - for (int i = 0; i < dest->size(); i++) { - Variant v = pca->operator[](i); - dest->operator[](i) = v; - } -} - -void GDAPI pandemonium_array_new_pool_vector2_array(pandemonium_array *r_dest, const pandemonium_pool_vector2_array *p_pv2a) { - Array *dest = (Array *)r_dest; - PoolVector *pca = (PoolVector *)p_pv2a; - memnew_placement(dest, Array); - dest->resize(pca->size()); - - for (int i = 0; i < dest->size(); i++) { - Variant v = pca->operator[](i); - dest->operator[](i) = v; - } -} - -void GDAPI pandemonium_array_new_pool_string_array(pandemonium_array *r_dest, const pandemonium_pool_string_array *p_psa) { - Array *dest = (Array *)r_dest; - PoolVector *pca = (PoolVector *)p_psa; - memnew_placement(dest, Array); - dest->resize(pca->size()); - - for (int i = 0; i < dest->size(); i++) { - Variant v = pca->operator[](i); - dest->operator[](i) = v; - } -} - -void GDAPI pandemonium_array_new_pool_real_array(pandemonium_array *r_dest, const pandemonium_pool_real_array *p_pra) { - Array *dest = (Array *)r_dest; - PoolVector *pca = (PoolVector *)p_pra; + PoolVector *pca = (PoolVector *)p_pba; memnew_placement(dest, Array); dest->resize(pca->size()); @@ -127,9 +79,105 @@ void GDAPI pandemonium_array_new_pool_int_array(pandemonium_array *r_dest, const } } -void GDAPI pandemonium_array_new_pool_byte_array(pandemonium_array *r_dest, const pandemonium_pool_byte_array *p_pba) { +void GDAPI pandemonium_array_new_pool_real_array(pandemonium_array *r_dest, const pandemonium_pool_real_array *p_pra) { Array *dest = (Array *)r_dest; - PoolVector *pca = (PoolVector *)p_pba; + PoolVector *pca = (PoolVector *)p_pra; + memnew_placement(dest, Array); + dest->resize(pca->size()); + + for (int i = 0; i < dest->size(); i++) { + Variant v = pca->operator[](i); + dest->operator[](i) = v; + } +} + +void GDAPI pandemonium_array_new_pool_string_array(pandemonium_array *r_dest, const pandemonium_pool_string_array *p_psa) { + Array *dest = (Array *)r_dest; + PoolVector *pca = (PoolVector *)p_psa; + memnew_placement(dest, Array); + dest->resize(pca->size()); + + for (int i = 0; i < dest->size(); i++) { + Variant v = pca->operator[](i); + dest->operator[](i) = v; + } +} + +void GDAPI pandemonium_array_new_pool_vector2_array(pandemonium_array *r_dest, const pandemonium_pool_vector2_array *p_pv2a) { + Array *dest = (Array *)r_dest; + PoolVector *pca = (PoolVector *)p_pv2a; + memnew_placement(dest, Array); + dest->resize(pca->size()); + + for (int i = 0; i < dest->size(); i++) { + Variant v = pca->operator[](i); + dest->operator[](i) = v; + } +} + +void GDAPI pandemonium_array_new_pool_vector2i_array(pandemonium_array *r_dest, const pandemonium_pool_vector2i_array *p_pv2ia) { + Array *dest = (Array *)r_dest; + PoolVector *pca = (PoolVector *)p_pv2ia; + memnew_placement(dest, Array); + dest->resize(pca->size()); + + for (int i = 0; i < dest->size(); i++) { + Variant v = pca->operator[](i); + dest->operator[](i) = v; + } +} + +void GDAPI pandemonium_array_new_pool_vector3_array(pandemonium_array *r_dest, const pandemonium_pool_vector3_array *p_pv3a) { + Array *dest = (Array *)r_dest; + PoolVector *pca = (PoolVector *)p_pv3a; + memnew_placement(dest, Array); + dest->resize(pca->size()); + + for (int i = 0; i < dest->size(); i++) { + Variant v = pca->operator[](i); + dest->operator[](i) = v; + } +} + +void GDAPI pandemonium_array_new_pool_vector3i_array(pandemonium_array *r_dest, const pandemonium_pool_vector3i_array *p_pv3ia) { + Array *dest = (Array *)r_dest; + PoolVector *pca = (PoolVector *)p_pv3ia; + memnew_placement(dest, Array); + dest->resize(pca->size()); + + for (int i = 0; i < dest->size(); i++) { + Variant v = pca->operator[](i); + dest->operator[](i) = v; + } +} + +void GDAPI pandemonium_array_new_pool_vector4_array(pandemonium_array *r_dest, const pandemonium_pool_vector4_array *p_pv4a) { + Array *dest = (Array *)r_dest; + PoolVector *pca = (PoolVector *)p_pv4a; + memnew_placement(dest, Array); + dest->resize(pca->size()); + + for (int i = 0; i < dest->size(); i++) { + Variant v = pca->operator[](i); + dest->operator[](i) = v; + } +} + +void GDAPI pandemonium_array_new_pool_vector4i_array(pandemonium_array *r_dest, const pandemonium_pool_vector4i_array *p_pv4ia) { + Array *dest = (Array *)r_dest; + PoolVector *pca = (PoolVector *)p_pv4ia; + memnew_placement(dest, Array); + dest->resize(pca->size()); + + for (int i = 0; i < dest->size(); i++) { + Variant v = pca->operator[](i); + dest->operator[](i) = v; + } +} + +void GDAPI pandemonium_array_new_pool_color_array(pandemonium_array *r_dest, const pandemonium_pool_color_array *p_pca) { + Array *dest = (Array *)r_dest; + PoolVector *pca = (PoolVector *)p_pca; memnew_placement(dest, Array); dest->resize(pca->size()); @@ -190,10 +238,10 @@ pandemonium_bool GDAPI pandemonium_array_deep_equal_recursion_count(const pandem const Array *array = (const Array *)p_array; return self->deep_equal(*array, p_recursion_count); } -void GDAPI pandemonium_array_operator_equal(pandemonium_array *p_self, const pandemonium_array *p_array) { +pandemonium_bool GDAPI pandemonium_array_operator_equals(pandemonium_array *p_self, const pandemonium_array *p_array) { Array *self = (Array *)p_self; const Array *array = (const Array *)p_array; - self->operator=(*array); + return self->operator==(*array); } pandemonium_int GDAPI pandemonium_array_count(const pandemonium_array *p_self, const pandemonium_variant *p_value) { diff --git a/include/gdn/array.h b/include/gdn/array.h index 1a238d0..e6acd94 100644 --- a/include/gdn/array.h +++ b/include/gdn/array.h @@ -72,7 +72,7 @@ void GDAPI pandemonium_array_clear(pandemonium_array *p_self); pandemonium_bool GDAPI pandemonium_array_deep_equal(const pandemonium_array *p_self, const pandemonium_array *p_array); pandemonium_bool GDAPI pandemonium_array_deep_equal_recursion_count(const pandemonium_array *p_self, const pandemonium_array *p_array, pandemonium_int p_recursion_count); -void GDAPI pandemonium_array_operator_equal(pandemonium_array *p_self, const pandemonium_array *p_array); +pandemonium_bool GDAPI pandemonium_array_operator_equals(pandemonium_array *p_self, const pandemonium_array *p_array); pandemonium_int GDAPI pandemonium_array_hash(const pandemonium_array *p_self); //bool operator=(const Array &p_array) const; @@ -125,15 +125,17 @@ pandemonium_variant GDAPI pandemonium_array_max(const pandemonium_array *p_self) void GDAPI pandemonium_array_new(pandemonium_array *r_dest); void GDAPI pandemonium_array_new_copy(pandemonium_array *r_dest, const pandemonium_array *p_src); -void GDAPI pandemonium_array_new_pool_color_array(pandemonium_array *r_dest, const pandemonium_pool_color_array *p_pca); -void GDAPI pandemonium_array_new_pool_vector3_array(pandemonium_array *r_dest, const pandemonium_pool_vector3_array *p_pv3a); -void GDAPI pandemonium_array_new_pool_vector2_array(pandemonium_array *r_dest, const pandemonium_pool_vector2_array *p_pv2a); -void GDAPI pandemonium_array_new_pool_string_array(pandemonium_array *r_dest, const pandemonium_pool_string_array *p_psa); -void GDAPI pandemonium_array_new_pool_real_array(pandemonium_array *r_dest, const pandemonium_pool_real_array *p_pra); -void GDAPI pandemonium_array_new_pool_int_array(pandemonium_array *r_dest, const pandemonium_pool_int_array *p_pia); void GDAPI pandemonium_array_new_pool_byte_array(pandemonium_array *r_dest, const pandemonium_pool_byte_array *p_pba); -//Add the new ones - +void GDAPI pandemonium_array_new_pool_int_array(pandemonium_array *r_dest, const pandemonium_pool_int_array *p_pia); +void GDAPI pandemonium_array_new_pool_real_array(pandemonium_array *r_dest, const pandemonium_pool_real_array *p_pra); +void GDAPI pandemonium_array_new_pool_string_array(pandemonium_array *r_dest, const pandemonium_pool_string_array *p_psa); +void GDAPI pandemonium_array_new_pool_vector2_array(pandemonium_array *r_dest, const pandemonium_pool_vector2_array *p_pv2a); +void GDAPI pandemonium_array_new_pool_vector2i_array(pandemonium_array *r_dest, const pandemonium_pool_vector2i_array *p_pv2a); +void GDAPI pandemonium_array_new_pool_vector3_array(pandemonium_array *r_dest, const pandemonium_pool_vector3_array *p_pv3a); +void GDAPI pandemonium_array_new_pool_vector3i_array(pandemonium_array *r_dest, const pandemonium_pool_vector3i_array *p_pv3a); +void GDAPI pandemonium_array_new_pool_vector4_array(pandemonium_array *r_dest, const pandemonium_pool_vector4_array *p_pv3a); +void GDAPI pandemonium_array_new_pool_vector4i_array(pandemonium_array *r_dest, const pandemonium_pool_vector4i_array *p_pv3a); +void GDAPI pandemonium_array_new_pool_color_array(pandemonium_array *r_dest, const pandemonium_pool_color_array *p_pca); void GDAPI pandemonium_array_destroy(pandemonium_array *p_self); #ifdef __cplusplus