Fixed propulsion applying force to _every limb except_ the ones it's supposed to, fixed pressure building up in enclosed rooms that are full of water, fixed netlobby displaying multiple votes for clients, progress on file transfer

This commit is contained in:
Regalis
2016-02-26 22:21:00 +02:00
parent 77d3d22810
commit 9f8f4e290e
19 changed files with 330 additions and 133 deletions
@@ -6,7 +6,7 @@ namespace Barotrauma.Networking
{
enum FileTransferStatus
{
NotStarted, Sending, Receiving, Finished, Error
NotStarted, Sending, Receiving, Finished, Error, Canceled
}
enum FileTransferType
@@ -22,6 +22,8 @@ namespace Barotrauma.Networking
private byte[] tempBuffer;
private NetConnection connection;
float waitTimer;
private FileTransferType fileType;
@@ -56,7 +58,7 @@ namespace Barotrauma.Networking
chunkLen = connection.Peer.Configuration.MaximumTransmissionUnit - 100;
tempBuffer = new byte[chunkLen];
sentOffset = 0;
FileName = fileName;
this.fileType = fileType;
@@ -64,10 +66,13 @@ namespace Barotrauma.Networking
Status = FileTransferStatus.NotStarted;
}
public void Update()
public void Update(float deltaTime)
{
if (inputStream == null) return;
waitTimer -= deltaTime;
if (waitTimer > 0.0f) return;
if (!connection.CanSendImmediately(NetDeliveryMethod.ReliableOrdered, 1)) return;
// send another part of the file!
@@ -98,6 +103,8 @@ namespace Barotrauma.Networking
connection.SendMessage(message, NetDeliveryMethod.ReliableOrdered, 1);
sentOffset += sendBytes;
waitTimer = connection.AverageRoundtripTime + 0.05f;
//Program.Output("Sent " + m_sentOffset + "/" + m_inputStream.Length + " bytes to " + m_connection);
if (remaining - sendBytes <= 0)