Fix all merge suggestions/issues

This commit is contained in:
Damian Korczowski
2021-07-01 19:47:04 +02:00
parent bfd50851f8
commit 2f9147c36c
6 changed files with 21 additions and 12 deletions

View File

@@ -57,7 +57,7 @@ void ENetDriver::Initialize(NetworkPeer* host, const NetworkConfig& config)
{
_networkHost = host;
_config = config;
_peerMap = Dictionary<uint32_t, void*>();
_peerMap = Dictionary<uint32, void*>();
if (enet_initialize () != 0) {
LOG(Error, "Failed to initialize ENet driver!");
@@ -173,7 +173,7 @@ bool ENetDriver::PopEvent(NetworkEvent* eventPtr)
if(result > 0)
{
// Copy sender data
const uint32_t connectionId = enet_peer_get_id(event.peer);
const uint32 connectionId = enet_peer_get_id(event.peer);
eventPtr->Sender = NetworkConnection();
eventPtr->Sender.ConnectionId = connectionId;
@@ -189,14 +189,14 @@ bool ENetDriver::PopEvent(NetworkEvent* eventPtr)
case ENET_EVENT_TYPE_DISCONNECT:
eventPtr->EventType = NetworkEventType::Disconnected;
if(IsServer() && _peerMap.ContainsKey(connectionId))
if(IsServer())
_peerMap.Remove(connectionId);
break;
case ENET_EVENT_TYPE_DISCONNECT_TIMEOUT:
eventPtr->EventType = NetworkEventType::Timeout;
if(IsServer() && _peerMap.ContainsKey(connectionId))
if(IsServer())
_peerMap.Remove(connectionId);
break;
@@ -235,7 +235,7 @@ void ENetDriver::SendMessage(NetworkChannelType channelType, const NetworkMessag
SendPacketToPeer(peer, channelType, message);
}
void ENetDriver::SendMessage(const NetworkChannelType channelType, const NetworkMessage& message, Array<NetworkConnection, HeapAllocation> targets)
void ENetDriver::SendMessage(const NetworkChannelType channelType, const NetworkMessage& message, Array<NetworkConnection, HeapAllocation>& targets)
{
ASSERT(IsServer());

View File

@@ -29,7 +29,7 @@ public:
void SendMessage(NetworkChannelType channelType, const NetworkMessage& message) override;
void SendMessage(NetworkChannelType channelType, const NetworkMessage& message, NetworkConnection target) override;
void SendMessage(NetworkChannelType channelType, const NetworkMessage& message, Array<NetworkConnection, HeapAllocation> targets) override;
void SendMessage(NetworkChannelType channelType, const NetworkMessage& message, Array<NetworkConnection, HeapAllocation>& targets) override;
private:
bool IsServer() const
@@ -43,6 +43,6 @@ private:
void* _host = nullptr;
void* _peer = nullptr;
Dictionary<uint32_t, void*> _peerMap;
Dictionary<uint32, void*> _peerMap;
};

View File

@@ -11,7 +11,16 @@
API_INTERFACE(Namespace="FlaxEngine.Networking") class FLAXENGINE_API INetworkDriver
{
DECLARE_SCRIPTING_TYPE_MINIMAL(INetworkDriver);
public:
/// <summary>
/// Finalizes an instance of the <see cref="INetworkDriver"/> class.
/// </summary>
virtual ~INetworkDriver() = default;
public:
/// <summary>
/// Initializes the instance of this network driver using given configuration.
/// </summary>
@@ -93,7 +102,7 @@ public:
/// Do not recycle the message after calling this.
/// This function automatically recycles the message.
/// </remarks>
virtual void SendMessage(NetworkChannelType channelType, const NetworkMessage& message, Array<NetworkConnection, HeapAllocation> targets) = 0;
virtual void SendMessage(NetworkChannelType channelType, const NetworkMessage& message, Array<NetworkConnection, HeapAllocation>& targets) = 0;
// TODO: Stats API
// TODO: Simulation API

View File

@@ -2,7 +2,7 @@
#pragma once
#include "Engine/Scripting/ScriptingType.h"
#include "Engine/Core/Config.h"
/// <summary>
/// The low-level network channel type for message sending.

View File

@@ -12,7 +12,7 @@
namespace
{
Array<NetworkPeer*, HeapAllocation> Peers;
uint32_t LastHostId = 0;
uint32 LastHostId = 0;
}
void NetworkPeer::Initialize(const NetworkConfig& config)
@@ -153,7 +153,7 @@ bool NetworkPeer::EndSendMessage(const NetworkChannelType channelType, const Net
return false;
}
bool NetworkPeer::EndSendMessage(const NetworkChannelType channelType, const NetworkMessage& message, Array<NetworkConnection> targets)
bool NetworkPeer::EndSendMessage(const NetworkChannelType channelType, const NetworkMessage& message, Array<NetworkConnection>& targets)
{
ASSERT(message.IsValid());

View File

@@ -149,7 +149,7 @@ public:
/// This function automatically recycles the message.
/// </remarks>
API_FUNCTION()
bool EndSendMessage(NetworkChannelType channelType, const NetworkMessage& message, Array<NetworkConnection, HeapAllocation> targets);
bool EndSendMessage(NetworkChannelType channelType, const NetworkMessage& message, Array<NetworkConnection, HeapAllocation>& targets);
public:
/// <summary>