mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-10 23:31:50 +00:00
Merge branch 'master' into next
This commit is contained in:
commit
6886a29e99
3 changed files with 94 additions and 11 deletions
|
@ -3137,6 +3137,58 @@ static boolean SV_AddWaitingPlayers(void)
|
||||||
{
|
{
|
||||||
newplayer = true;
|
newplayer = true;
|
||||||
|
|
||||||
|
if (netgame)
|
||||||
|
// !!!!!!!!! EXTREMELY SUPER MEGA GIGA ULTRA ULTIMATELY TERRIBLY IMPORTANT !!!!!!!!!
|
||||||
|
//
|
||||||
|
// The line just after that comment is an awful, horrible, terrible, TERRIBLE hack.
|
||||||
|
//
|
||||||
|
// Basically, the fix I did in order to fix the download freezes happens
|
||||||
|
// to cause situations in which a player number does not match
|
||||||
|
// the node number associated to that player.
|
||||||
|
// That is totally normal, there is absolutely *nothing* wrong with that.
|
||||||
|
// Really. Player 7 being tied to node 29, for instance, is totally fine.
|
||||||
|
//
|
||||||
|
// HOWEVER. A few (broken) parts of the netcode do the TERRIBLE mistake
|
||||||
|
// of mixing up the concepts of node and player, resulting in
|
||||||
|
// incorrect handling of cases where a player is tied to a node that has
|
||||||
|
// a different number (which is a totally normal case, or at least should be).
|
||||||
|
// This incorrect handling can go as far as literally
|
||||||
|
// anyone from joining your server at all, forever.
|
||||||
|
//
|
||||||
|
// Given those two facts, there are two options available
|
||||||
|
// in order to let this download freeze fix be:
|
||||||
|
// 1) Fix the broken parts that assume a node is a player or similar bullshit.
|
||||||
|
// 2) Change the part this comment is located at, so that any player who joins
|
||||||
|
// is given the same number as their associated node.
|
||||||
|
//
|
||||||
|
// No need to say, 1) is by far the obvious best, whereas 2) is a terrible hack.
|
||||||
|
// Unfortunately, after trying 1), I most likely didn't manage to find all
|
||||||
|
// of those broken parts, and thus 2) has become the only safe option that remains.
|
||||||
|
//
|
||||||
|
// So I did this hack.
|
||||||
|
//
|
||||||
|
// If it isn't clear enough, in order to get rid of this ugly hack,
|
||||||
|
// you will have to fix all parts of the netcode that
|
||||||
|
// make a confusion between nodes and players.
|
||||||
|
//
|
||||||
|
// And if it STILL isn't clear enough, a node and a player
|
||||||
|
// is NOT the same thing. Never. NEVER. *NEVER*.
|
||||||
|
//
|
||||||
|
// And if someday you make the terrible mistake of
|
||||||
|
// daring to have the unforgivable idea to try thinking
|
||||||
|
// that a node might possibly be the same as a player,
|
||||||
|
// or that a player should have the same number as its node,
|
||||||
|
// be sure that I will somehow know about it and
|
||||||
|
// hunt you down tirelessly and make you regret it,
|
||||||
|
// even if you live on the other side of the world.
|
||||||
|
//
|
||||||
|
// TODO: vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
||||||
|
// \todo >>>>>>>>>> Remove this horrible hack as soon as possible <<<<<<<<<<
|
||||||
|
// TODO: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
//
|
||||||
|
// !!!!!!!!! EXTREMELY SUPER MEGA GIGA ULTRA ULTIMATELY TERRIBLY IMPORTANT !!!!!!!!!
|
||||||
|
newplayernum = node; // OMFG SAY WELCOME TO TEH NEW HACK FOR FIX FIL DOWNLOAD!!1!
|
||||||
|
else // Don't use the hack if we don't have to
|
||||||
// search for a free playernum
|
// search for a free playernum
|
||||||
// we can't use playeringame since it is not updated here
|
// we can't use playeringame since it is not updated here
|
||||||
for (; newplayernum < MAXPLAYERS; newplayernum++)
|
for (; newplayernum < MAXPLAYERS; newplayernum++)
|
||||||
|
|
|
@ -3012,8 +3012,31 @@ static void Command_Addfile(void)
|
||||||
if (*p == '\\' || *p == '/' || *p == ':')
|
if (*p == '\\' || *p == '/' || *p == ':')
|
||||||
break;
|
break;
|
||||||
++p;
|
++p;
|
||||||
|
// check total packet size and no of files currently loaded
|
||||||
|
{
|
||||||
|
size_t packetsize = 0;
|
||||||
|
serverinfo_pak *dummycheck = NULL;
|
||||||
|
|
||||||
|
// Shut the compiler up.
|
||||||
|
(void)dummycheck;
|
||||||
|
|
||||||
|
// See W_LoadWadFile in w_wad.c
|
||||||
|
for (i = 0; i < numwadfiles; i++)
|
||||||
|
packetsize += nameonlylength(wadfiles[i]->filename) + 22;
|
||||||
|
|
||||||
|
packetsize += nameonlylength(fn) + 22;
|
||||||
|
|
||||||
|
if ((numwadfiles >= MAX_WADFILES)
|
||||||
|
|| (packetsize > sizeof(dummycheck->fileneeded)))
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_ERROR, M_GetText("Too many files loaded to add %s\n"), fn);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
WRITESTRINGN(buf_p,p,240);
|
WRITESTRINGN(buf_p,p,240);
|
||||||
|
|
||||||
|
// calculate and check md5
|
||||||
{
|
{
|
||||||
UINT8 md5sum[16];
|
UINT8 md5sum[16];
|
||||||
#ifdef NOMD5
|
#ifdef NOMD5
|
||||||
|
@ -3031,6 +3054,15 @@ static void Command_Addfile(void)
|
||||||
}
|
}
|
||||||
else // file not found
|
else // file not found
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
for (i = 0; i < numwadfiles; i++)
|
||||||
|
{
|
||||||
|
if (!memcmp(wadfiles[i]->md5sum, md5sum, 16))
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_ERROR, M_GetText("%s is already loaded\n"), fn);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
WRITEMEM(buf_p, md5sum, 16);
|
WRITEMEM(buf_p, md5sum, 16);
|
||||||
}
|
}
|
||||||
|
|
|
@ -498,8 +498,7 @@ static void cleanupnodes(void)
|
||||||
|
|
||||||
// Why can't I start at zero?
|
// Why can't I start at zero?
|
||||||
for (j = 1; j < MAXNETNODES; j++)
|
for (j = 1; j < MAXNETNODES; j++)
|
||||||
//if (!(nodeingame[j] || SV_SendingFile(j)))
|
if (!(nodeingame[j] || SV_SendingFile(j)))
|
||||||
if (!nodeingame[j])
|
|
||||||
nodeconnected[j] = false;
|
nodeconnected[j] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue