Fixed respawn shuttles with no nav terminal throwing an exception, removing focus from server log searchbar when the log window is closed, clients wait for ongoing file transfers to finish before starting a new one (instead of cancelling)
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
using Lidgren.Network;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Barotrauma.Networking;
|
||||
using System.Linq;
|
||||
using System;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -128,30 +130,13 @@ namespace Barotrauma
|
||||
|
||||
public static void DumpIds(int count)
|
||||
{
|
||||
List<Entity> e = new List<Entity>();
|
||||
List<Entity> entities = dictionary.Values.OrderByDescending(e => e.id).ToList();
|
||||
|
||||
foreach (Entity ent in dictionary.Values)
|
||||
count = Math.Min(entities.Count, count);
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
int index = 0;
|
||||
for (int i = 0; i < e.Count; i++)
|
||||
{
|
||||
if (e[i].id < ent.id)
|
||||
{
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
e.Insert(index, ent);
|
||||
}
|
||||
|
||||
int c = 0;
|
||||
foreach (Entity ent in e)
|
||||
{
|
||||
if (c>count) break;
|
||||
|
||||
DebugConsole.ThrowError(ent.id+": "+ent.ToString());
|
||||
c++;
|
||||
DebugConsole.ThrowError(entities[i].id + ": " + entities[i].ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace Barotrauma.Networking
|
||||
private ReliableChannel reliableChannel;
|
||||
|
||||
private FileStreamReceiver fileStreamReceiver;
|
||||
private Queue<Pair<string, FileTransferMessageType>> requestFileQueue;
|
||||
|
||||
private GUITickBox endRoundButton;
|
||||
|
||||
@@ -63,6 +64,8 @@ namespace Barotrauma.Networking
|
||||
|
||||
name = newName;
|
||||
|
||||
requestFileQueue = new Queue<Pair<string, FileTransferMessageType>>();
|
||||
|
||||
characterInfo = new CharacterInfo(Character.HumanConfigFile, name);
|
||||
characterInfo.Job = null;
|
||||
|
||||
@@ -251,7 +254,7 @@ namespace Barotrauma.Networking
|
||||
"A round is already running and the admin has disabled spectating. You will have to wait for a new round to start.");
|
||||
}
|
||||
|
||||
if (gameStarted && !hasCharacter && myCharacter!=null)
|
||||
if (gameStarted && !hasCharacter && myCharacter != null)
|
||||
{
|
||||
GameMain.NetLobbyScreen.Select();
|
||||
|
||||
@@ -277,17 +280,19 @@ namespace Barotrauma.Networking
|
||||
string subName = inc.ReadString();
|
||||
string subHash = inc.ReadString();
|
||||
|
||||
string mySubPath = Path.Combine(Submarine.SavePath, subName);
|
||||
var matchingSub = Submarine.SavedSubmarines.Find(s => s.Name == subName);
|
||||
if (matchingSub != null)
|
||||
{
|
||||
mySubPath = matchingSub.FilePath;
|
||||
submarines.Add(matchingSub);
|
||||
}
|
||||
|
||||
submarines.Add(new Submarine(mySubPath, subHash, false));
|
||||
else
|
||||
{
|
||||
submarines.Add(new Submarine(Path.Combine(Submarine.SavePath, subName), subHash, false));
|
||||
}
|
||||
|
||||
}
|
||||
GameMain.NetLobbyScreen.UpdateSubList(GameMain.NetLobbyScreen.SubList, Submarine.SavedSubmarines);
|
||||
GameMain.NetLobbyScreen.UpdateSubList(GameMain.NetLobbyScreen.ShuttleList.ListBox, Submarine.SavedSubmarines);
|
||||
GameMain.NetLobbyScreen.UpdateSubList(GameMain.NetLobbyScreen.SubList, submarines);
|
||||
GameMain.NetLobbyScreen.UpdateSubList(GameMain.NetLobbyScreen.ShuttleList.ListBox, submarines);
|
||||
|
||||
//add the name of own client to the lobby screen
|
||||
GameMain.NetLobbyScreen.AddPlayer(name);
|
||||
@@ -470,6 +475,12 @@ namespace Barotrauma.Networking
|
||||
NetIncomingMessage inc;
|
||||
|
||||
if (startGameCoroutine != null && CoroutineManager.IsCoroutineRunning(startGameCoroutine)) return;
|
||||
|
||||
if (fileStreamReceiver == null && requestFileQueue.Count > 0)
|
||||
{
|
||||
var newRequest = requestFileQueue.Dequeue();
|
||||
RequestFile(newRequest.First, newRequest.Second);
|
||||
}
|
||||
|
||||
while ((inc = client.ReadMessage()) != null)
|
||||
{
|
||||
@@ -913,7 +924,14 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
if (fileStreamReceiver!=null)
|
||||
{
|
||||
CancelFileTransfer();
|
||||
var request = new Pair<string, FileTransferMessageType>()
|
||||
{
|
||||
First = file,
|
||||
Second = fileType
|
||||
};
|
||||
|
||||
requestFileQueue.Enqueue(request);
|
||||
return;
|
||||
}
|
||||
|
||||
NetOutgoingMessage msg = client.CreateMessage();
|
||||
|
||||
@@ -100,6 +100,7 @@ namespace Barotrauma.Networking
|
||||
else
|
||||
{
|
||||
log.LogFrame = null;
|
||||
GUIComponent.KeyboardDispatcher.Subscriber = null;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
@@ -464,7 +465,7 @@ namespace Barotrauma.Networking
|
||||
outmsg.Write((byte)PacketTypes.LoggedIn);
|
||||
outmsg.Write(sender.ID);
|
||||
outmsg.Write(gameStarted);
|
||||
outmsg.Write(gameStarted && sender.Character != null);
|
||||
outmsg.Write(gameStarted && sender.Character != null && !sender.Character.IsDead);
|
||||
outmsg.Write(AllowSpectating);
|
||||
|
||||
//notify the client about other clients already logged in
|
||||
|
||||
@@ -84,7 +84,10 @@ namespace Barotrauma.Networking
|
||||
if (door != null) shuttleDoors.Add(door);
|
||||
}
|
||||
|
||||
shuttleSteering.TargetPosition = ConvertUnits.ToSimUnits(Level.Loaded.StartPosition);
|
||||
if (shuttleSteering != null)
|
||||
{
|
||||
shuttleSteering.TargetPosition = ConvertUnits.ToSimUnits(Level.Loaded.StartPosition);
|
||||
}
|
||||
|
||||
var server = networkMember as GameServer;
|
||||
if (server != null)
|
||||
|
||||
@@ -96,11 +96,17 @@ namespace Barotrauma.Networking
|
||||
|
||||
private void AddLine(ColoredText line)
|
||||
{
|
||||
var textBlock = new GUITextBlock(new Rectangle(0, 0, 0, 0), line.Text, GUI.Style, Alignment.TopLeft, Alignment.TopLeft, listBox, true, GUI.SmallFont);
|
||||
float prevSize = listBox.BarSize;
|
||||
|
||||
var textBlock = new GUITextBlock(new Rectangle(0, 0, 0, 0), line.Text, GUI.Style, Alignment.TopLeft, Alignment.TopLeft, null, true, GUI.SmallFont);
|
||||
textBlock.Rect = new Rectangle(textBlock.Rect.X, textBlock.Rect.Y, textBlock.Rect.Width, Math.Max(13, textBlock.Rect.Height));
|
||||
|
||||
listBox.AddChild(textBlock);
|
||||
|
||||
textBlock.TextColor = line.Color;
|
||||
textBlock.CanBeFocused = false;
|
||||
|
||||
if ((prevSize == 1.0f && listBox.BarScroll == 0.0f) || (prevSize < 1.0f && listBox.BarScroll == 1.0f)) listBox.BarScroll = 1.0f;
|
||||
}
|
||||
|
||||
private bool FilterMessages(GUITextBox textBox, string text)
|
||||
|
||||
Reference in New Issue
Block a user