add "allowsaturnjoin" cvar to let toggle allowjoin for saturn clients seperately

This commit is contained in:
Alug committed 2024-07-23 17:45:25 +02:00
1 parent 1f41cb9a3f
commit 4b71d9a48d
4 files changed
+22 -14

No files matched your search

+5 -1
View File
@@ -146,6 +146,7 @@ static UINT8 mynode; // my address pointofview server
static boolean cl_redownloadinggamestate = false;
boolean is_client_saturn[MAXNETNODES];
#define ISSATURN 69
static UINT8 localtextcmd[MAXTEXTCMD];
static UINT8 localtextcmd2[MAXTEXTCMD]; // splitscreen
@@ -1441,6 +1442,7 @@ static boolean CL_SendJoin(void)
netbuffer->u.clientcfg.subversion = SUBVERSION;
strncpy(netbuffer->u.clientcfg.application, SRB2APPLICATION,
sizeof netbuffer->u.clientcfg.application);
netbuffer->u.clientcfg.issaturn = ISSATURN;
return HSendPacket(servernode, false, 0, sizeof (clientconfig_pak));
}
@@ -4057,6 +4059,8 @@ consvar_t cv_joinrefusemessage = {"joinrefusemessage", "The server is not accept
consvar_t cv_allownewplayer = {"allowjoin", "On", CV_SAVE|CV_CALL, CV_OnOff, Joinable_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_allownewsaturnplayer = {"allowsaturnjoin", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
#ifdef VANILLAJOINNEXTROUND
consvar_t cv_joinnextround = {"joinnextround", "Off", CV_SAVE|CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; /// \todo not done
#endif
@@ -4704,7 +4708,7 @@ static void HandleConnect(SINT8 node)
{
SV_SendRefuse(node, va(M_GetText("Different SRB2Kart versions cannot\nplay a netgame!\n(server version %d.%d)"), VERSION, SUBVERSION));
}
else if (!cv_allownewplayer.value && node)
else if ((!cv_allownewplayer.value && node && netbuffer->u.clientcfg.issaturn != ISSATURN) || (!cv_allownewsaturnplayer.value && node && netbuffer->u.clientcfg.issaturn == ISSATURN))
{
SV_SendRefuse(node, M_GetText(cv_joinrefusemessage.string));
}
+2 -1
View File
@@ -369,6 +369,7 @@ typedef struct
UINT8 subversion; // Contains build version
UINT8 localplayers; // number of splitscreen players
UINT8 mode;
UINT8 issaturn;
} ATTRPACK clientconfig_pak;
#define SV_SPEEDMASK 0x03 // used to send kartspeed
@@ -573,7 +574,7 @@ extern consvar_t
#ifdef VANILLAJOINNEXTROUND
cv_joinnextround,
#endif
cv_netticbuffer, cv_allownewplayer, cv_joinrefusemessage, cv_maxplayers, cv_resynchattempts, cv_resynchcooldown, cv_gamestateattempts, cv_blamecfail, cv_maxsend, cv_noticedownload, cv_downloadspeed;
cv_netticbuffer, cv_allownewplayer, cv_allownewsaturnplayer, cv_joinrefusemessage, cv_maxplayers, cv_resynchattempts, cv_resynchcooldown, cv_gamestateattempts, cv_blamecfail, cv_maxsend, cv_noticedownload, cv_downloadspeed;
extern consvar_t cv_connectawaittime;
+1
View File
@@ -788,6 +788,7 @@ void D_RegisterServerCommands(void)
CV_RegisterVar(&cv_httpsource);
#ifndef NONET
CV_RegisterVar(&cv_allownewplayer);
CV_RegisterVar(&cv_allownewsaturnplayer);
CV_RegisterVar(&cv_joinrefusemessage);
CV_RegisterVar(&cv_chatlogsize);
#ifdef VANILLAJOINNEXTROUND
+14 -12
View File
@@ -1861,22 +1861,23 @@ static menuitem_t OP_ServerOptionsMenu[] =
{
#ifndef NONET
{IT_STRING | IT_CVAR | IT_CV_STRING,
NULL, "Server Name", &cv_servername, 10},
NULL, "Server Name", &cv_servername, 10},
#endif
{IT_STRING | IT_CVAR, NULL, "Intermission Timer", &cv_inttime, 40},
{IT_STRING | IT_CVAR, NULL, "Map Progression", &cv_advancemap, 50},
{IT_STRING | IT_CVAR, NULL, "Voting Timer", &cv_votetime, 60},
{IT_STRING | IT_CVAR, NULL, "Voting Rule Changes", &cv_kartvoterulechanges, 70},
{IT_STRING | IT_CVAR, NULL, "Intermission Timer", &cv_inttime, 40},
{IT_STRING | IT_CVAR, NULL, "Map Progression", &cv_advancemap, 50},
{IT_STRING | IT_CVAR, NULL, "Voting Timer", &cv_votetime, 60},
{IT_STRING | IT_CVAR, NULL, "Voting Rule Changes", &cv_kartvoterulechanges, 70},
#ifndef NONET
{IT_STRING | IT_CVAR, NULL, "Max. Player Count", &cv_maxplayers, 90},
{IT_STRING | IT_CVAR, NULL, "Allow Players to Join", &cv_allownewplayer, 100},
{IT_STRING | IT_CVAR, NULL, "Allow Addon Downloading", &cv_downloading, 110},
{IT_STRING | IT_CVAR, NULL, "Pause Permission", &cv_pause, 120},
{IT_STRING | IT_CVAR, NULL, "Mute All Chat", &cv_mute, 130},
{IT_STRING | IT_CVAR, NULL, "Max. Player Count", &cv_maxplayers, 90},
{IT_STRING | IT_CVAR, NULL, "Allow Vanilla Players to Join", &cv_allownewplayer, 100},
{IT_STRING | IT_CVAR, NULL, "Allow Saturn Players to Join", &cv_allownewsaturnplayer,110},
{IT_STRING | IT_CVAR, NULL, "Allow Addon Downloading", &cv_downloading, 120},
{IT_STRING | IT_CVAR, NULL, "Pause Permission", &cv_pause, 130},
{IT_STRING | IT_CVAR, NULL, "Mute All Chat", &cv_mute, 140},
{IT_SUBMENU|IT_STRING, NULL, "Advanced Options...", &OP_AdvServerOptionsDef,150},
{IT_SUBMENU|IT_STRING, NULL, "Advanced Options...", &OP_AdvServerOptionsDef, 160},
#endif
};
@@ -1891,7 +1892,8 @@ static const char* OP_ServerOptionsTooltips[] =
"How often should other gamemodes appear.",
#ifndef NONET
"Max amount of players allowed in this server.",
"Allow players to join this server.",
"Allow Vanilla players to join this server.",
"Allow Saturn players to join this server.",
"Allow players to download addons.",
"Who has permission to pause the server?",
"Completely mute in game chat.",