diff options
author | kobewi <kobewi4e@gmail.com> | 2022-08-08 00:52:20 +0200 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2022-08-24 12:53:36 +0200 |
commit | f7f4873ed08d6b465c8108f7ce0c1cb76f9caf2f (patch) | |
tree | f5644c01ab66109f8f342d784c3a38240aa295ef /modules/enet | |
parent | 0626ce50cfd35d1eb81c6c9627f8540be9636b4b (diff) |
Replace Array return types with TypedArray 3
Diffstat (limited to 'modules/enet')
-rw-r--r-- | modules/enet/doc_classes/ENetConnection.xml | 2 | ||||
-rw-r--r-- | modules/enet/enet_connection.cpp | 5 | ||||
-rw-r--r-- | modules/enet/enet_connection.h | 5 |
3 files changed, 8 insertions, 4 deletions
diff --git a/modules/enet/doc_classes/ENetConnection.xml b/modules/enet/doc_classes/ENetConnection.xml index c9bf1c65e1..8c84fe87d7 100644 --- a/modules/enet/doc_classes/ENetConnection.xml +++ b/modules/enet/doc_classes/ENetConnection.xml @@ -118,7 +118,7 @@ </description> </method> <method name="get_peers"> - <return type="Array" /> + <return type="ENetPacketPeer[]" /> <description> Returns the list of peers associated with this host. [b]Note:[/b] This list might include some peers that are not fully connected or are still being disconnected. diff --git a/modules/enet/enet_connection.cpp b/modules/enet/enet_connection.cpp index 629974d7c7..6a4bbecf6a 100644 --- a/modules/enet/enet_connection.cpp +++ b/modules/enet/enet_connection.cpp @@ -34,6 +34,7 @@ #include "core/io/compression.h" #include "core/io/ip.h" +#include "core/variant/typed_array.h" void ENetConnection::broadcast(enet_uint8 p_channel, ENetPacket *p_packet) { ERR_FAIL_COND_MSG(!host, "The ENetConnection instance isn't currently active."); @@ -263,9 +264,9 @@ void ENetConnection::get_peers(List<Ref<ENetPacketPeer>> &r_peers) { } } -Array ENetConnection::_get_peers() { +TypedArray<ENetPacketPeer> ENetConnection::_get_peers() { ERR_FAIL_COND_V_MSG(!host, Array(), "The ENetConnection instance isn't currently active."); - Array out; + TypedArray<ENetPacketPeer> out; for (const Ref<ENetPacketPeer> &I : peers) { out.push_back(I); } diff --git a/modules/enet/enet_connection.h b/modules/enet/enet_connection.h index 0c873b6c55..5cd8f6be9a 100644 --- a/modules/enet/enet_connection.h +++ b/modules/enet/enet_connection.h @@ -38,6 +38,9 @@ #include <enet/enet.h> +template <typename T> +class TypedArray; + class ENetConnection : public RefCounted { GDCLASS(ENetConnection, RefCounted); @@ -83,7 +86,7 @@ private: Error _create(ENetAddress *p_address, int p_max_peers, int p_max_channels, int p_in_bandwidth, int p_out_bandwidth); Array _service(int p_timeout = 0); void _broadcast(int p_channel, PackedByteArray p_packet, int p_flags); - Array _get_peers(); + TypedArray<ENetPacketPeer> _get_peers(); class Compressor { private: |