Skip to content

Commit

Permalink
Make structs readonly
Browse files Browse the repository at this point in the history
  • Loading branch information
sliekens committed Sep 16, 2023
1 parent e4eb11e commit 8116b2c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions GW2SDK/Features/Mumble/Context.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace GuildWars2.Mumble;

[PublicAPI]
[StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode)]
public record struct Context
public readonly record struct Context
{
[FieldOffset(0)]
internal readonly sockaddr_in serverAddress;
Expand Down Expand Up @@ -63,12 +63,12 @@ public record struct Context
internal readonly byte MountIndex;

[MemberNotNullWhen(true, nameof(Mount))]
public readonly bool IsMounted => MountIndex != 0;
public bool IsMounted => MountIndex != 0;

public readonly IPEndPoint ServerAddress =>
public IPEndPoint ServerAddress =>
new(serverAddress.sin_addr.s_un.s_addr, serverAddress.sin_port);

public readonly MountName? Mount =>
public MountName? Mount =>
MountIndex switch
{
0 => null,
Expand Down
2 changes: 1 addition & 1 deletion GW2SDK/Features/Mumble/GameTick.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace GuildWars2.Mumble;

[PublicAPI]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct GameTick
public readonly record struct GameTick
{
public readonly uint UiVersion;

Expand Down
4 changes: 3 additions & 1 deletion GW2SDK/Features/Mumble/Vector3D.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System.Runtime.InteropServices;
using JetBrains.Annotations;

namespace GuildWars2.Mumble;

[PublicAPI]
[StructLayout(LayoutKind.Sequential)]
public record struct Vector3D
public readonly record struct Vector3D
{
public readonly float X;

Expand Down

0 comments on commit 8116b2c

Please sign in to comment.