Fix MsgPlayerList being capped to 255

WHY WAS THIS A BYTE.

This prevented having more than 255 people on a server, beyond that the game might get stuck as people's player states wouldn't necessarily get sent.
This commit is contained in:
Pieter-Jan Briers
2024-06-16 21:31:42 +02:00
parent a3a8912f42
commit ceda39813d
3 changed files with 5 additions and 7 deletions

View File

@@ -47,7 +47,7 @@ END TEMPLATE-->
### Other
*None yet*
* Fix internal networking logic
### Internal

View File

@@ -143,7 +143,6 @@ namespace Robust.Server.Player
list.Add(info);
}
netMsg.Plyrs = list;
netMsg.PlyCount = (byte)list.Count;
channel.SendMessage(netMsg);
}

View File

@@ -12,14 +12,13 @@ namespace Robust.Shared.Network.Messages
{
public override MsgGroups MsgGroup => MsgGroups.Core;
public byte PlyCount { get; set; }
public List<SessionState> Plyrs { get; set; }
public override void ReadFromBuffer(NetIncomingMessage buffer, IRobustSerializer serializer)
{
Plyrs = new List<SessionState>();
PlyCount = buffer.ReadByte();
for (var i = 0; i < PlyCount; i++)
var playerCount = buffer.ReadInt32();
Plyrs = new List<SessionState>(playerCount);
for (var i = 0; i < playerCount; i++)
{
var plyNfo = new SessionState
{
@@ -34,7 +33,7 @@ namespace Robust.Shared.Network.Messages
public override void WriteToBuffer(NetOutgoingMessage buffer, IRobustSerializer serializer)
{
buffer.Write(PlyCount);
buffer.Write(Plyrs.Count);
foreach (var ply in Plyrs)
{