Skip to content

Commit

Permalink
Fixed Rpc packets, these do not do a conversion to ulong but rather s…
Browse files Browse the repository at this point in the history
…end the data as long
  • Loading branch information
michael-r-elp committed Dec 20, 2023
1 parent ab08e83 commit 1a032a1
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace BeatTogether.DedicatedServer.Messaging.Abstractions
{
// WARNING do not cast to ulong for any packets that inherit this class
public abstract class BaseRpcWithValuesPacket : BaseRpcPacket
{
public byte HasValues { get; set; } = (1 | 2 | 4 | 8);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ public override void ReadFrom(ref SpanBuffer reader)
{
base.ReadFrom(ref reader);
if (HasValue0)
StartTime = (long)reader.ReadVarULong();
StartTime = reader.ReadVarLong();
}

public override void WriteTo(ref SpanBuffer writer)
{
base.WriteTo(ref writer);
writer.WriteVarULong((ulong)StartTime);
writer.WriteVarLong(StartTime);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ public override void ReadFrom(ref SpanBuffer reader)
{
base.ReadFrom(ref reader);
if (HasValue0)
CountdownTime = (long)reader.ReadVarULong();
CountdownTime = reader.ReadVarLong();
}

public override void WriteTo(ref SpanBuffer writer)
{
base.WriteTo(ref writer);
writer.WriteVarULong((ulong)CountdownTime);
writer.WriteVarLong(CountdownTime);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ public override void ReadFrom(ref SpanBuffer reader)
{
base.ReadFrom(ref reader);
if (HasValue0)
StartTime = (long)reader.ReadVarULong();
StartTime = reader.ReadVarLong();
}

public override void WriteTo(ref SpanBuffer writer)
{
base.WriteTo(ref writer);
writer.WriteVarULong((ulong)StartTime);
writer.WriteVarLong(StartTime);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ public override void ReadFrom(ref SpanBuffer reader)
if (HasValue1)
Modifiers.ReadFrom(ref reader);
if (HasValue2)
StartTime = (long)reader.ReadVarULong();
StartTime = reader.ReadVarLong();
}

public override void WriteTo(ref SpanBuffer writer)
{
base.WriteTo(ref writer);
Beatmap.WriteTo(ref writer);
Modifiers.WriteTo(ref writer);
writer.WriteVarULong((ulong)StartTime);
writer.WriteVarLong(StartTime);
}
}
}

0 comments on commit 1a032a1

Please sign in to comment.