NetworkEvent optimization (more frequent use of WriteRangedSingle)
This commit is contained in:
@@ -471,8 +471,8 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
public override bool FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetOutgoingMessage message, object data)
|
||||
{
|
||||
message.Write(volume);
|
||||
{
|
||||
message.WriteRangedSingle(MathHelper.Clamp(volume/FullVolume, 0.0f, 1.5f), 0.0f, 1.5f, 6);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -483,7 +483,7 @@ namespace Barotrauma
|
||||
|
||||
try
|
||||
{
|
||||
newVolume = message.ReadFloat();
|
||||
float newPercentage = message.ReadRangedSingle(0.0f, 1.5f, 6);
|
||||
}
|
||||
|
||||
catch
|
||||
|
||||
@@ -653,7 +653,7 @@ namespace Barotrauma
|
||||
|
||||
message.Write((float)NetTime.Now);
|
||||
message.Write(byteIndex);
|
||||
message.Write(sections[sectionIndex].damage);
|
||||
message.WriteRangedSingle(sections[sectionIndex].damage/Health, 0.0f, 1.0f, 8);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -668,7 +668,7 @@ namespace Barotrauma
|
||||
{
|
||||
updateTime = message.ReadFloat();
|
||||
sectionIndex = message.ReadByte();
|
||||
damage = message.ReadFloat();
|
||||
damage = message.ReadRangedSingle(0.0f, 1.0f, 8) * Health;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user