DownloadManager bug fixed

This commit is contained in:
EntenKoeniq
2022-04-11 16:52:06 +02:00
parent c3614abe5f
commit 53c2666943
2 changed files with 7 additions and 6 deletions

View File

@ -437,7 +437,7 @@ namespace CoopClient
return Game.IsControlPressed((Control)control);
}
public bool IsMapLoaded()
public bool AnyMapLoaded()
{
return MapLoader.AnyMapLoaded();
}

View File

@ -146,9 +146,10 @@ namespace CoopServer
return;
}
if (client.IsCurrentFile(id))
if (!client.DownloadComplete() && client.IsCurrentFile(id))
{
client.FilePosition++;
client.FileDataPosition = 0;
}
if (client.DownloadComplete())
@ -175,7 +176,7 @@ namespace CoopServer
public long NetHandle = 0;
private readonly List<DownloadFile> _files = null;
public int FilePosition = 0;
private int _fileDataPosition = 0;
public int FileDataPosition = 0;
public DownloadClient(long nethandle, List<DownloadFile> files)
{
@ -233,10 +234,10 @@ namespace CoopServer
Send(NetHandle, file);
if (_fileDataPosition >= file.FileChunks.Count)
if (FileDataPosition >= file.FileChunks.Count)
{
FilePosition++;
_fileDataPosition = 0;
FileDataPosition = 0;
}
return DownloadComplete();
@ -253,7 +254,7 @@ namespace CoopServer
NetOutgoingMessage outgoingMessage = Server.MainNetServer.CreateMessage();
new Packets.FileTransferTick() { ID = file.FileID, FileChunk = file.FileChunks[_fileDataPosition++] }.PacketToNetOutGoingMessage(outgoingMessage);
new Packets.FileTransferTick() { ID = file.FileID, FileChunk = file.FileChunks[FileDataPosition++] }.PacketToNetOutGoingMessage(outgoingMessage);
Server.MainNetServer.SendMessage(outgoingMessage, conn, NetDeliveryMethod.ReliableUnordered, (byte)ConnectionChannel.File);
}