Skip to content

Commit

Permalink
Rename SendIfCondition to SendToMatching
Browse files Browse the repository at this point in the history
  • Loading branch information
Reousa committed Jan 5, 2024
1 parent 54483fa commit 85bbfd8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion NebulaAPI/GameState/INetworkProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public interface INetworkProvider : IDisposable
/// <param name="packet"></param>
/// <param name="condition"></param>
/// <typeparam name="T"></typeparam>
public void SendIfCondition<T>(T packet, Predicate<INebulaPlayer> condition) where T : class, new();
public void SendToMatching<T>(T packet, Predicate<INebulaPlayer> condition) where T : class, new();

/// <summary>
/// Broadcast packet to all Players within current star system
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected override void ProcessPacket(PlanetBroadcastPacket packet, NebulaConnec
{
//Forward packet to other users if we're the host
if (IsHost)
Multiplayer.Session.Server.SendIfCondition(packet, p =>
Multiplayer.Session.Server.SendToMatching(packet, p =>
p.Data.LocalPlanetId == packet.PlanetId &&
p.Connection.Equals(conn)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected override void ProcessPacket(StarBroadcastPacket packet, NebulaConnecti
{
//Forward packet to other users if we're the host
if (IsHost)
Multiplayer.Session.Server.SendIfCondition(packet, p =>
Multiplayer.Session.Server.SendToMatching(packet, p =>
p.Data.LocalStarId == packet.StarId &&
p.Connection.Equals(conn)
);
Expand Down
10 changes: 5 additions & 5 deletions NebulaNetwork/Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ public void Dispose()
/// <param name="packet"></param>
/// <param name="condition"></param>
/// <typeparam name="T"></typeparam>
public void SendIfCondition<T>(T packet, Predicate<INebulaPlayer> condition)
public void SendToMatching<T>(T packet, Predicate<INebulaPlayer> condition)
where T : class, new()
{
var players = Players
Expand All @@ -386,7 +386,7 @@ public void SendIfCondition<T>(T packet, Predicate<INebulaPlayer> condition)

public void SendPacketToStar<T>(T packet, int starId) where T : class, new()
{
SendIfCondition(packet, p => p.Data.LocalStarId == starId);
SendToMatching(packet, p => p.Data.LocalStarId == starId);
}

public void SendPacketToLocalStar<T>(T packet) where T : class, new()
Expand All @@ -397,7 +397,7 @@ public void SendIfCondition<T>(T packet, Predicate<INebulaPlayer> condition)

public void SendPacketToPlanet<T>(T packet, int planetId) where T : class, new()
{
SendIfCondition(packet, p => p.Data.LocalPlanetId == planetId);
SendToMatching(packet, p => p.Data.LocalPlanetId == planetId);
}

public void SendPacketToLocalPlanet<T>(T packet) where T : class, new()
Expand All @@ -409,12 +409,12 @@ public void SendIfCondition<T>(T packet, Predicate<INebulaPlayer> condition)

public void SendPacketExclude<T>(T packet, INebulaConnection exclude) where T : class, new()
{
SendIfCondition(packet, p => !p.Connection.Equals(exclude));
SendToMatching(packet, p => !p.Connection.Equals(exclude));
}

public void SendPacketToStarExclude<T>(T packet, int starId, INebulaConnection exclude) where T : class, new()
{
SendIfCondition(packet, p => p.Data.LocalStarId == starId && !p.Connection.Equals(exclude));
SendToMatching(packet, p => p.Data.LocalStarId == starId && !p.Connection.Equals(exclude));
}

public void Update()
Expand Down

0 comments on commit 85bbfd8

Please sign in to comment.