mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 01:01:33 +00:00
Simplify convoluted code
This commit is contained in:
parent
62986da9da
commit
5a608120ff
1 changed files with 12 additions and 26 deletions
|
@ -1421,15 +1421,9 @@ static void PT_ClientQuit(SINT8 node, INT32 netconsole)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!netnodes[node].ingame)
|
|
||||||
{
|
|
||||||
Net_CloseConnection(node);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// nodeingame will be put false in the execution of kick command
|
// nodeingame will be put false in the execution of kick command
|
||||||
// this allow to send some packets to the quitting client to have their ack back
|
// this allow to send some packets to the quitting client to have their ack back
|
||||||
if (netconsole != -1 && playeringame[netconsole])
|
if (netnodes[node].ingame && netconsole != -1 && playeringame[netconsole])
|
||||||
{
|
{
|
||||||
UINT8 kickmsg;
|
UINT8 kickmsg;
|
||||||
|
|
||||||
|
@ -1440,17 +1434,18 @@ static void PT_ClientQuit(SINT8 node, INT32 netconsole)
|
||||||
kickmsg |= KICK_MSG_KEEP_BODY;
|
kickmsg |= KICK_MSG_KEEP_BODY;
|
||||||
|
|
||||||
SendKick(netconsole, kickmsg);
|
SendKick(netconsole, kickmsg);
|
||||||
netnodes[node].player = -1;
|
|
||||||
|
|
||||||
if (netnodes[node].player2 != -1 && netnodes[node].player2 >= 0
|
if (netnodes[node].player2 != -1 && netnodes[node].player2 >= 0
|
||||||
&& playeringame[(UINT8)netnodes[node].player2])
|
&& playeringame[(UINT8)netnodes[node].player2])
|
||||||
{
|
{
|
||||||
SendKick(netnodes[node].player2, kickmsg);
|
SendKick(netnodes[node].player2, kickmsg);
|
||||||
netnodes[node].player2 = -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Net_CloseConnection(node);
|
Net_CloseConnection(node);
|
||||||
netnodes[node].ingame = false;
|
netnodes[node].ingame = false;
|
||||||
|
netnodes[node].player = -1;
|
||||||
|
netnodes[node].player2 = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PT_AskLuaFile(SINT8 node)
|
static void PT_AskLuaFile(SINT8 node)
|
||||||
|
@ -1603,11 +1598,9 @@ static void HandlePacketFromPlayer(SINT8 node)
|
||||||
*/
|
*/
|
||||||
void GetPackets(void)
|
void GetPackets(void)
|
||||||
{
|
{
|
||||||
SINT8 node; // The packet sender
|
|
||||||
|
|
||||||
while (HGetPacket())
|
while (HGetPacket())
|
||||||
{
|
{
|
||||||
node = (SINT8)doomcom->remotenode;
|
SINT8 node = doomcom->remotenode;
|
||||||
|
|
||||||
// Packet received from someone already playing
|
// Packet received from someone already playing
|
||||||
if (netnodes[node].ingame)
|
if (netnodes[node].ingame)
|
||||||
|
@ -1740,8 +1733,6 @@ If they're not lagging, decrement the timer by 1. Of course, reset all of this i
|
||||||
|
|
||||||
boolean TryRunTics(tic_t realtics)
|
boolean TryRunTics(tic_t realtics)
|
||||||
{
|
{
|
||||||
boolean ticking;
|
|
||||||
|
|
||||||
// the machine has lagged but it is not so bad
|
// the machine has lagged but it is not so bad
|
||||||
if (realtics > TICRATE/7)
|
if (realtics > TICRATE/7)
|
||||||
{
|
{
|
||||||
|
@ -1783,16 +1774,11 @@ boolean TryRunTics(tic_t realtics)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ticking = neededtic > gametic;
|
if (neededtic > gametic)
|
||||||
|
|
||||||
if (ticking)
|
|
||||||
{
|
{
|
||||||
if (realtics)
|
if (realtics)
|
||||||
hu_stopped = false;
|
hu_stopped = false;
|
||||||
}
|
|
||||||
|
|
||||||
if (ticking)
|
|
||||||
{
|
|
||||||
if (advancedemo)
|
if (advancedemo)
|
||||||
{
|
{
|
||||||
if (timedemo_quit)
|
if (timedemo_quit)
|
||||||
|
@ -1826,16 +1812,19 @@ boolean TryRunTics(tic_t realtics)
|
||||||
if (client && gamestate == GS_LEVEL && leveltime > 3 && neededtic <= gametic + cv_netticbuffer.value)
|
if (client && gamestate == GS_LEVEL && leveltime > 3 && neededtic <= gametic + cv_netticbuffer.value)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (realtics)
|
if (realtics)
|
||||||
hu_stopped = true;
|
hu_stopped = true;
|
||||||
}
|
|
||||||
|
|
||||||
return ticking;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static INT32 pingtimeout[MAXPLAYERS];
|
static INT32 pingtimeout[MAXPLAYERS];
|
||||||
|
|
||||||
static inline void PingUpdate(void)
|
static inline void PingUpdate(void)
|
||||||
|
@ -1976,8 +1965,6 @@ void NetUpdate(void)
|
||||||
{
|
{
|
||||||
if (!demoplayback)
|
if (!demoplayback)
|
||||||
{
|
{
|
||||||
INT32 counts;
|
|
||||||
|
|
||||||
hu_redownloadinggamestate = false;
|
hu_redownloadinggamestate = false;
|
||||||
|
|
||||||
firstticstosend = gametic;
|
firstticstosend = gametic;
|
||||||
|
@ -1991,8 +1978,7 @@ void NetUpdate(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't erase tics not acknowledged
|
// Don't erase tics not acknowledged
|
||||||
counts = realtics;
|
INT32 counts = realtics;
|
||||||
|
|
||||||
if (maketic + counts >= firstticstosend + BACKUPTICS)
|
if (maketic + counts >= firstticstosend + BACKUPTICS)
|
||||||
counts = firstticstosend+BACKUPTICS-maketic-1;
|
counts = firstticstosend+BACKUPTICS-maketic-1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue