Format more engine code

This commit is contained in:
Wojtek Figat
2022-06-14 20:17:00 +02:00
parent 7c923198e0
commit b49e5e9984
219 changed files with 348 additions and 1236 deletions

View File

@@ -11,9 +11,8 @@
/// </summary>
API_INTERFACE(Namespace="FlaxEngine.Networking") class FLAXENGINE_API INetworkDriver
{
DECLARE_SCRIPTING_TYPE_MINIMAL(INetworkDriver);
DECLARE_SCRIPTING_TYPE_MINIMAL(INetworkDriver);
public:
/// <summary>
/// Finalizes an instance of the <see cref="INetworkDriver"/> class.
/// </summary>
@@ -26,7 +25,7 @@ public:
{
return String("Unknown");
}
/// <summary>
/// Initializes the instance of this network driver using given configuration.
/// </summary>
@@ -84,7 +83,7 @@ public:
/// Do not recycle the message after calling this.
/// This function automatically recycles the message.
/// </remarks>
API_FUNCTION() virtual void SendMessage(NetworkChannelType channelType, const NetworkMessage& message) = 0;
API_FUNCTION() virtual void SendMessage(NetworkChannelType channelType, const NetworkMessage& message) = 0;
/// <summary>
/// Sends given message over specified channel to the given client connection (target).

View File

@@ -28,7 +28,7 @@ API_ENUM(Namespace="FlaxEngine.Networking") enum class DEPRECATED NetworkDriverT
/// </summary>
API_STRUCT(Namespace="FlaxEngine.Networking") struct FLAXENGINE_API NetworkConfig
{
DECLARE_SCRIPTING_TYPE_MINIMAL(NetworkConfig);
DECLARE_SCRIPTING_TYPE_MINIMAL(NetworkConfig);
/// <summary>
/// The network driver that will be used to create the peer.

View File

@@ -9,7 +9,7 @@
/// </summary>
API_STRUCT(Namespace="FlaxEngine.Networking") struct FLAXENGINE_API NetworkConnection
{
DECLARE_SCRIPTING_TYPE_MINIMAL(NetworkConnection);
DECLARE_SCRIPTING_TYPE_MINIMAL(NetworkConnection);
public:
/// <summary>
/// The identifier of the connection.

View File

@@ -42,7 +42,7 @@ API_ENUM(Namespace="FlaxEngine.Networking") enum class NetworkEventType
/// </summary>
API_STRUCT(Namespace="FlaxEngine.Networking") struct FLAXENGINE_API NetworkEvent
{
DECLARE_SCRIPTING_TYPE_MINIMAL(NetworkEvent);
DECLARE_SCRIPTING_TYPE_MINIMAL(NetworkEvent);
public:
/// <summary>
/// The type of the received event.

View File

@@ -14,9 +14,8 @@
/// </summary>
API_STRUCT(Namespace="FlaxEngine.Networking") struct FLAXENGINE_API NetworkMessage
{
DECLARE_SCRIPTING_TYPE_MINIMAL(NetworkMessage);
DECLARE_SCRIPTING_TYPE_MINIMAL(NetworkMessage);
public:
/// <summary>
/// The raw message buffer.
/// </summary>
@@ -43,7 +42,6 @@ public:
API_FIELD() uint32 Position = 0;
public:
/// <summary>
/// Initializes default values of the <seealso cref="NetworkMessage"/> structure.
/// </summary>
@@ -53,13 +51,17 @@ public:
/// Initializes values of the <seealso cref="NetworkMessage"/> structure.
/// </summary>
NetworkMessage(uint8* buffer, uint32 messageId, uint32 bufferSize, uint32 length, uint32 position)
: Buffer(buffer), MessageId(messageId), BufferSize(bufferSize), Length(length), Position(position)
{ }
: Buffer(buffer)
, MessageId(messageId)
, BufferSize(bufferSize)
, Length(length)
, Position(position)
{
}
~NetworkMessage() = default;
public:
public:
/// <summary>
/// Writes raw bytes into the message.
/// </summary>
@@ -119,7 +121,7 @@ public:
{
return Vector2(ReadSingle(), ReadSingle());
}
/// <summary>
/// Writes data of type Vector3 into the message.
/// </summary>
@@ -156,7 +158,7 @@ public:
{
return Vector4(ReadSingle(), ReadSingle(), ReadSingle(), ReadSingle());
}
/// <summary>
/// Writes data of type Quaternion into the message.
/// </summary>
@@ -196,7 +198,7 @@ public:
ReadBytes((uint8*)value.Get(), length * sizeof(Char));
return value;
}
/// <summary>
/// Writes data of type Guid into the message.
/// </summary>
@@ -216,7 +218,6 @@ public:
}
public:
/// <summary>
/// Returns true if the message is valid for reading or writing.
/// </summary>

View File

@@ -13,10 +13,9 @@
/// </summary>
API_CLASS(sealed, NoSpawn, Namespace = "FlaxEngine.Networking") class FLAXENGINE_API NetworkPeer final : public ScriptingObject
{
DECLARE_SCRIPTING_TYPE_NO_SPAWN(NetworkPeer);
DECLARE_SCRIPTING_TYPE_NO_SPAWN(NetworkPeer);
friend class NetworkManager;
public:
int HostId = -1;
NetworkConfig Config;
INetworkDriver* NetworkDriver = nullptr;
@@ -25,7 +24,6 @@ public:
Array<uint32, HeapAllocation> MessagePool;
public:
/// <summary>
/// Initializes a new instance of the <see cref="NetworkPeer"/> class.
/// </summary>
@@ -35,7 +33,6 @@ public:
}
public:
/// <summary>
/// Starts listening for incoming connections.
/// Once this is called, this peer becomes a server.
@@ -163,7 +160,6 @@ public:
static void ShutdownPeer(NetworkPeer* peer);
public:
bool IsValid() const
{
return NetworkDriver != nullptr && HostId >= 0;
@@ -176,7 +172,6 @@ public:
}
public:
FORCE_INLINE bool operator==(const NetworkPeer& other) const
{
return HostId == other.HostId;
@@ -188,7 +183,6 @@ public:
}
private:
bool Initialize(const NetworkConfig& config);
void Shutdown();
void CreateMessageBuffers();