Skip to content

Commit

Permalink
Fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
Lacyway committed Jun 5, 2024
1 parent cf91143 commit e1e1cfa
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 14 deletions.
8 changes: 0 additions & 8 deletions Fika.Core/Networking/FikaClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -575,14 +575,6 @@ private void OnInformationPacketReceived(InformationPacket packet)
ConnectedClients = packet.NumberOfPlayers;
ReadyClients = packet.ReadyPlayers;
}
if (packet.ForceStart)
{
CoopGame coopGame = (CoopGame)Singleton<IFikaGame>.Instance;
if (coopGame != null)
{
coopGame.forceStart = true;
}
}
}

private void OnAllCharacterRequestPacketReceived(AllCharacterRequestPacket packet)
Expand Down
3 changes: 0 additions & 3 deletions Fika.Core/Networking/FikaServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -431,13 +431,10 @@ private void OnInformationPacketReceived(InformationPacket packet, NetPeer peer)
{
ReadyClients += packet.ReadyPlayers;

CoopGame coopGame = (CoopGame)Singleton<IFikaGame>.Instance;

InformationPacket respondPackage = new(false)
{
NumberOfPlayers = _netServer.ConnectedPeersCount,
ReadyPlayers = ReadyClients,
ForceStart = coopGame.forceStart
};

_dataWriter.Reset();
Expand Down
2 changes: 2 additions & 0 deletions Fika.Core/Networking/Open.Nat/Utils/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ public static async Task<TResult> TimeoutAfter<TResult>(this Task<TResult> task,
#if DEBUG
return await task;
#endif
#pragma warning disable CS0162 // Unreachable code detected
var timeoutCancellationTokenSource = new CancellationTokenSource();
#pragma warning restore CS0162 // Unreachable code detected

Task completedTask = await Task.WhenAny(task, Task.Delay(timeout, timeoutCancellationTokenSource.Token));
if (completedTask == task)
Expand Down
3 changes: 0 additions & 3 deletions Fika.Core/Networking/Packets/Backend/InformationPacket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,20 @@ public struct InformationPacket(bool isRequest) : INetSerializable
public bool IsRequest = isRequest;
public int NumberOfPlayers = 0;
public int ReadyPlayers = 0;
public bool ForceStart = false;


public void Deserialize(NetDataReader reader)
{
IsRequest = reader.GetBool();
NumberOfPlayers = reader.GetInt();
ReadyPlayers = reader.GetInt();
ForceStart = reader.GetBool();
}

public void Serialize(NetDataWriter writer)
{
writer.Put(IsRequest);
writer.Put(NumberOfPlayers);
writer.Put(ReadyPlayers);
writer.Put(ForceStart);
}
}
}

0 comments on commit e1e1cfa

Please sign in to comment.