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 Lidgren.Network;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Barotrauma.Networking;
|
using Barotrauma.Networking;
|
||||||
|
using System.Linq;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
{
|
{
|
||||||
@@ -128,30 +130,13 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public static void DumpIds(int count)
|
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;
|
DebugConsole.ThrowError(entities[i].id + ": " + entities[i].ToString());
|
||||||
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++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ namespace Barotrauma.Networking
|
|||||||
private ReliableChannel reliableChannel;
|
private ReliableChannel reliableChannel;
|
||||||
|
|
||||||
private FileStreamReceiver fileStreamReceiver;
|
private FileStreamReceiver fileStreamReceiver;
|
||||||
|
private Queue<Pair<string, FileTransferMessageType>> requestFileQueue;
|
||||||
|
|
||||||
private GUITickBox endRoundButton;
|
private GUITickBox endRoundButton;
|
||||||
|
|
||||||
@@ -63,6 +64,8 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
name = newName;
|
name = newName;
|
||||||
|
|
||||||
|
requestFileQueue = new Queue<Pair<string, FileTransferMessageType>>();
|
||||||
|
|
||||||
characterInfo = new CharacterInfo(Character.HumanConfigFile, name);
|
characterInfo = new CharacterInfo(Character.HumanConfigFile, name);
|
||||||
characterInfo.Job = null;
|
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.");
|
"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();
|
GameMain.NetLobbyScreen.Select();
|
||||||
|
|
||||||
@@ -277,17 +280,19 @@ namespace Barotrauma.Networking
|
|||||||
string subName = inc.ReadString();
|
string subName = inc.ReadString();
|
||||||
string subHash = inc.ReadString();
|
string subHash = inc.ReadString();
|
||||||
|
|
||||||
string mySubPath = Path.Combine(Submarine.SavePath, subName);
|
|
||||||
var matchingSub = Submarine.SavedSubmarines.Find(s => s.Name == subName);
|
var matchingSub = Submarine.SavedSubmarines.Find(s => s.Name == subName);
|
||||||
if (matchingSub != null)
|
if (matchingSub != null)
|
||||||
{
|
{
|
||||||
mySubPath = matchingSub.FilePath;
|
submarines.Add(matchingSub);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
submarines.Add(new Submarine(Path.Combine(Submarine.SavePath, subName), subHash, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
submarines.Add(new Submarine(mySubPath, subHash, false));
|
|
||||||
}
|
}
|
||||||
GameMain.NetLobbyScreen.UpdateSubList(GameMain.NetLobbyScreen.SubList, Submarine.SavedSubmarines);
|
GameMain.NetLobbyScreen.UpdateSubList(GameMain.NetLobbyScreen.SubList, submarines);
|
||||||
GameMain.NetLobbyScreen.UpdateSubList(GameMain.NetLobbyScreen.ShuttleList.ListBox, Submarine.SavedSubmarines);
|
GameMain.NetLobbyScreen.UpdateSubList(GameMain.NetLobbyScreen.ShuttleList.ListBox, submarines);
|
||||||
|
|
||||||
//add the name of own client to the lobby screen
|
//add the name of own client to the lobby screen
|
||||||
GameMain.NetLobbyScreen.AddPlayer(name);
|
GameMain.NetLobbyScreen.AddPlayer(name);
|
||||||
@@ -471,6 +476,12 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
if (startGameCoroutine != null && CoroutineManager.IsCoroutineRunning(startGameCoroutine)) return;
|
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)
|
while ((inc = client.ReadMessage()) != null)
|
||||||
{
|
{
|
||||||
if (inc.MessageType != NetIncomingMessageType.Data) continue;
|
if (inc.MessageType != NetIncomingMessageType.Data) continue;
|
||||||
@@ -913,7 +924,14 @@ namespace Barotrauma.Networking
|
|||||||
{
|
{
|
||||||
if (fileStreamReceiver!=null)
|
if (fileStreamReceiver!=null)
|
||||||
{
|
{
|
||||||
CancelFileTransfer();
|
var request = new Pair<string, FileTransferMessageType>()
|
||||||
|
{
|
||||||
|
First = file,
|
||||||
|
Second = fileType
|
||||||
|
};
|
||||||
|
|
||||||
|
requestFileQueue.Enqueue(request);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetOutgoingMessage msg = client.CreateMessage();
|
NetOutgoingMessage msg = client.CreateMessage();
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ namespace Barotrauma.Networking
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
log.LogFrame = null;
|
log.LogFrame = null;
|
||||||
|
GUIComponent.KeyboardDispatcher.Subscriber = null;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@@ -464,7 +465,7 @@ namespace Barotrauma.Networking
|
|||||||
outmsg.Write((byte)PacketTypes.LoggedIn);
|
outmsg.Write((byte)PacketTypes.LoggedIn);
|
||||||
outmsg.Write(sender.ID);
|
outmsg.Write(sender.ID);
|
||||||
outmsg.Write(gameStarted);
|
outmsg.Write(gameStarted);
|
||||||
outmsg.Write(gameStarted && sender.Character != null);
|
outmsg.Write(gameStarted && sender.Character != null && !sender.Character.IsDead);
|
||||||
outmsg.Write(AllowSpectating);
|
outmsg.Write(AllowSpectating);
|
||||||
|
|
||||||
//notify the client about other clients already logged in
|
//notify the client about other clients already logged in
|
||||||
|
|||||||
@@ -84,7 +84,10 @@ namespace Barotrauma.Networking
|
|||||||
if (door != null) shuttleDoors.Add(door);
|
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;
|
var server = networkMember as GameServer;
|
||||||
if (server != null)
|
if (server != null)
|
||||||
|
|||||||
@@ -96,11 +96,17 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
private void AddLine(ColoredText line)
|
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));
|
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.TextColor = line.Color;
|
||||||
textBlock.CanBeFocused = false;
|
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)
|
private bool FilterMessages(GUITextBox textBox, string text)
|
||||||
|
|||||||
Reference in New Issue
Block a user