mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 19:42:43 +00:00
Add method for getting packet flags from ENetPacketPeer
This commit is contained in:
parent
f4af8201ba
commit
21c5a732a4
@ -18,6 +18,12 @@
|
|||||||
Returns the number of channels allocated for communication with peer.
|
Returns the number of channels allocated for communication with peer.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="get_packet_flags" qualifiers="const">
|
||||||
|
<return type="int" />
|
||||||
|
<description>
|
||||||
|
Returns the ENet flags of the next packet in the received queue. See [code]FLAG_*[/code] constants for available packet flags. Note that not all flags are replicated from the sending peer to the receiving peer.
|
||||||
|
</description>
|
||||||
|
</method>
|
||||||
<method name="get_remote_address" qualifiers="const">
|
<method name="get_remote_address" qualifiers="const">
|
||||||
<return type="String" />
|
<return type="String" />
|
||||||
<description>
|
<description>
|
||||||
|
@ -175,6 +175,11 @@ int ENetPacketPeer::get_channels() const {
|
|||||||
return peer->channelCount;
|
return peer->channelCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ENetPacketPeer::get_packet_flags() const {
|
||||||
|
ERR_FAIL_COND_V(packet_queue.is_empty(), 0);
|
||||||
|
return packet_queue.front()->get()->flags;
|
||||||
|
}
|
||||||
|
|
||||||
void ENetPacketPeer::_on_disconnect() {
|
void ENetPacketPeer::_on_disconnect() {
|
||||||
if (peer) {
|
if (peer) {
|
||||||
peer->data = nullptr;
|
peer->data = nullptr;
|
||||||
@ -206,6 +211,7 @@ void ENetPacketPeer::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("send", "channel", "packet", "flags"), &ENetPacketPeer::_send);
|
ClassDB::bind_method(D_METHOD("send", "channel", "packet", "flags"), &ENetPacketPeer::_send);
|
||||||
ClassDB::bind_method(D_METHOD("throttle_configure", "interval", "acceleration", "deceleration"), &ENetPacketPeer::throttle_configure);
|
ClassDB::bind_method(D_METHOD("throttle_configure", "interval", "acceleration", "deceleration"), &ENetPacketPeer::throttle_configure);
|
||||||
ClassDB::bind_method(D_METHOD("set_timeout", "timeout", "timeout_min", "timeout_max"), &ENetPacketPeer::set_timeout);
|
ClassDB::bind_method(D_METHOD("set_timeout", "timeout", "timeout_min", "timeout_max"), &ENetPacketPeer::set_timeout);
|
||||||
|
ClassDB::bind_method(D_METHOD("get_packet_flags"), &ENetPacketPeer::get_packet_flags);
|
||||||
ClassDB::bind_method(D_METHOD("get_remote_address"), &ENetPacketPeer::get_remote_address);
|
ClassDB::bind_method(D_METHOD("get_remote_address"), &ENetPacketPeer::get_remote_address);
|
||||||
ClassDB::bind_method(D_METHOD("get_remote_port"), &ENetPacketPeer::get_remote_port);
|
ClassDB::bind_method(D_METHOD("get_remote_port"), &ENetPacketPeer::get_remote_port);
|
||||||
ClassDB::bind_method(D_METHOD("get_statistic", "statistic"), &ENetPacketPeer::get_statistic);
|
ClassDB::bind_method(D_METHOD("get_statistic", "statistic"), &ENetPacketPeer::get_statistic);
|
||||||
|
@ -113,6 +113,7 @@ public:
|
|||||||
double get_statistic(PeerStatistic p_stat);
|
double get_statistic(PeerStatistic p_stat);
|
||||||
PeerState get_state() const;
|
PeerState get_state() const;
|
||||||
int get_channels() const;
|
int get_channels() const;
|
||||||
|
int get_packet_flags() const;
|
||||||
|
|
||||||
// Extras
|
// Extras
|
||||||
IPAddress get_remote_address() const;
|
IPAddress get_remote_address() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user