Reject banned players with refusereason

This commit is contained in:
James R 2021-05-10 18:10:53 -07:00
parent 8486a9386d
commit c13e1a74dd
2 changed files with 15 additions and 4 deletions

View file

@ -1205,6 +1205,8 @@ GetRefuseReason (INT32 node)
{ {
if (!node || FindRejoinerNum(node) != -1) if (!node || FindRejoinerNum(node) != -1)
return 0; return 0;
else if (bannednode && bannednode[node])
return REFUSE_BANNED;
else if (!cv_allownewplayer.value) else if (!cv_allownewplayer.value)
return REFUSE_JOINS_DISABLED; return REFUSE_JOINS_DISABLED;
else if (D_NumPlayers() >= cv_maxplayers.value) else if (D_NumPlayers() >= cv_maxplayers.value)
@ -1874,6 +1876,10 @@ static const char * InvalidServerReason (INT32 i)
switch (info->refusereason) switch (info->refusereason)
{ {
case REFUSE_BANNED:
return
"You have been banned\n"
"from the server.\n" EOT;
case REFUSE_JOINS_DISABLED: case REFUSE_JOINS_DISABLED:
return return
"The server is not accepting\n" "The server is not accepting\n"

View file

@ -22,11 +22,15 @@
#include "mserv.h" #include "mserv.h"
/* /*
The 'packet version' is used to distinguish packet formats. The 'packet version' is used to distinguish packet
This version is independent of VERSION and SUBVERSION. Different formats. This version is independent of VERSION and
applications may follow different packet versions. SUBVERSION. Different applications may follow different
packet versions.
If you change the struct or the meaning of a field
therein, increment this number.
*/ */
#define PACKETVERSION 3 #define PACKETVERSION 4
// Network play related stuff. // Network play related stuff.
// There is a data struct that stores network // There is a data struct that stores network
@ -197,6 +201,7 @@ typedef struct
enum { enum {
REFUSE_JOINS_DISABLED = 1, REFUSE_JOINS_DISABLED = 1,
REFUSE_SLOTS_FULL, REFUSE_SLOTS_FULL,
REFUSE_BANNED,
}; };
#define MAXSERVERNAME 32 #define MAXSERVERNAME 32