mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-17 23:21:22 +00:00
Implemented toaster's suggestion to make a macro here
This commit is contained in:
parent
9e3bdc5ee2
commit
ff1cc07a1d
1 changed files with 12 additions and 15 deletions
|
@ -3402,6 +3402,14 @@ static void HandlePacketFromAwayNode(SINT8 node)
|
||||||
if (node != servernode)
|
if (node != servernode)
|
||||||
DEBFILE(va("Received packet from unknown host %d\n", node));
|
DEBFILE(va("Received packet from unknown host %d\n", node));
|
||||||
|
|
||||||
|
// macro for packets that should only be sent by the server
|
||||||
|
// if it is NOT from the server, bail out and close the connection!
|
||||||
|
#define SERVERONLY \
|
||||||
|
if (node != servernode) \
|
||||||
|
{ \
|
||||||
|
Net_CloseConnection(node); \
|
||||||
|
break; \
|
||||||
|
}
|
||||||
switch (netbuffer->packettype)
|
switch (netbuffer->packettype)
|
||||||
{
|
{
|
||||||
case PT_ASKINFOVIAMS:
|
case PT_ASKINFOVIAMS:
|
||||||
|
@ -3443,11 +3451,7 @@ static void HandlePacketFromAwayNode(SINT8 node)
|
||||||
Net_CloseConnection(node);
|
Net_CloseConnection(node);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (node != servernode) // nope you're not the server
|
SERVERONLY
|
||||||
{
|
|
||||||
Net_CloseConnection(node);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (cl_mode == CL_WAITJOINRESPONSE)
|
if (cl_mode == CL_WAITJOINRESPONSE)
|
||||||
{
|
{
|
||||||
// Save the reason so it can be displayed after quitting the netgame
|
// Save the reason so it can be displayed after quitting the netgame
|
||||||
|
@ -3479,11 +3483,7 @@ static void HandlePacketFromAwayNode(SINT8 node)
|
||||||
Net_CloseConnection(node);
|
Net_CloseConnection(node);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (node != servernode) // nope you're not the server
|
SERVERONLY
|
||||||
{
|
|
||||||
Net_CloseConnection(node);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/// \note how would this happen? and is it doing the right thing if it does?
|
/// \note how would this happen? and is it doing the right thing if it does?
|
||||||
if (cl_mode != CL_WAITJOINRESPONSE)
|
if (cl_mode != CL_WAITJOINRESPONSE)
|
||||||
break;
|
break;
|
||||||
|
@ -3547,11 +3547,7 @@ static void HandlePacketFromAwayNode(SINT8 node)
|
||||||
Net_CloseConnection(node);
|
Net_CloseConnection(node);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (node != servernode) // nope you're not the server
|
SERVERONLY
|
||||||
{
|
|
||||||
Net_CloseConnection(node);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
Got_Filetxpak();
|
Got_Filetxpak();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -3580,6 +3576,7 @@ static void HandlePacketFromAwayNode(SINT8 node)
|
||||||
break; // Ignore it
|
break; // Ignore it
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#undef SERVERONLY
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Handles a packet received from a node that is in game
|
/** Handles a packet received from a node that is in game
|
||||||
|
|
Loading…
Reference in a new issue