Add more documentation about the Map issues and note in logs about map transfers (if exists / file size mismatch)
(r8548/r8549) git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@8555 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
db28b30d64
commit
25b9dc9ba6
|
@ -2718,6 +2718,10 @@ UBYTE NETsendFile(BOOL newFile, char *fileName, UDWORD player)
|
||||||
// even if they already have it? multiplay.c 1529 & 1550 are both
|
// even if they already have it? multiplay.c 1529 & 1550 are both
|
||||||
// NETsendFile(true,mapStr,0); & NETsendFile(false,game.map,0);
|
// NETsendFile(true,mapStr,0); & NETsendFile(false,game.map,0);
|
||||||
// so we ALWAYS send it, it seems?
|
// so we ALWAYS send it, it seems?
|
||||||
|
// NOTE: we send to everyone since there is no way to signal the host
|
||||||
|
// to stop sending the map. Which means that everytime a player joins
|
||||||
|
// that doesn't have the map, it will send to all players again.
|
||||||
|
// We also are limited by fps(!) to the amount of time the loop runs.
|
||||||
NETbeginEncode(FILEMSG, NET_ALL_PLAYERS); // send it.
|
NETbeginEncode(FILEMSG, NET_ALL_PLAYERS); // send it.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2744,7 +2748,7 @@ UBYTE NETsendFile(BOOL newFile, char *fileName, UDWORD player)
|
||||||
return (currPos * 100) / fileSize_64;
|
return (currPos * 100) / fileSize_64;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* @TODO Needs to be rewritten. See issue #215. */
|
||||||
// recv file. it returns % of the file so far recvd.
|
// recv file. it returns % of the file so far recvd.
|
||||||
UBYTE NETrecvFile(void)
|
UBYTE NETrecvFile(void)
|
||||||
{
|
{
|
||||||
|
@ -2768,6 +2772,30 @@ UBYTE NETrecvFile(void)
|
||||||
|
|
||||||
if (currPos == 0) // first packet!
|
if (currPos == 0) // first packet!
|
||||||
{
|
{
|
||||||
|
if (PHYSFS_exists(fileName))
|
||||||
|
{
|
||||||
|
PHYSFS_file *fin;
|
||||||
|
PHYSFS_sint64 fsize;
|
||||||
|
fin = PHYSFS_openRead(fileName);
|
||||||
|
fsize = PHYSFS_fileLength(fin);
|
||||||
|
if ((int32_t) fsize == fileSize)
|
||||||
|
{
|
||||||
|
// NOTE: we would send a abort message to host, but since we can't,
|
||||||
|
// we won't.
|
||||||
|
#ifdef DEBUG
|
||||||
|
debug(LOG_NET, "We already have the file %s.", fileName);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// NOTE: we can't abort out, since the host ALWAYS sends the data until done
|
||||||
|
// PHYSFS_close(fin);
|
||||||
|
// NETend();
|
||||||
|
// return 100;
|
||||||
|
}
|
||||||
|
PHYSFS_close(fin);
|
||||||
|
#ifdef DEBUG
|
||||||
|
debug(LOG_NET, "We have the same named file, but different size. Redownloading %s", fileName);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
pFileHandle = PHYSFS_openWrite(fileName); // create a new file.
|
pFileHandle = PHYSFS_openWrite(fileName); // create a new file.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue