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:
Regalis
2016-08-10 19:18:50 +03:00
parent 69933188d6
commit 7716b5e9d4
5 changed files with 46 additions and 33 deletions

View File

@@ -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();