mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-27 12:50:44 +00:00
Attach initial join discord info to servercfg, so that we don't have a pause from needing to also send XD_DISCORD
XD_DISCORD is now reserved for when the options are changed mid-game
This commit is contained in:
parent
c165b0761c
commit
51dce9707f
2 changed files with 20 additions and 4 deletions
|
@ -1606,6 +1606,15 @@ static boolean SV_SendServerConfig(INT32 node)
|
|||
netbuffer->u.servercfg.playercolor[i] = (UINT8)players[i].skincolor;
|
||||
}
|
||||
|
||||
netbuffer->u.servercfg.maxplayer = (UINT8)(min((dedicated ? MAXPLAYERS-1 : MAXPLAYERS), cv_maxplayers.value));
|
||||
netbuffer->u.servercfg.allownewplayer = cv_allownewplayer.value;
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
netbuffer->u.servercfg.discordinvites = (boolean)cv_discordinvites.value;
|
||||
#else
|
||||
netbuffer->u.servercfg.discordinvites = false;
|
||||
#endif
|
||||
|
||||
memcpy(netbuffer->u.servercfg.server_context, server_context, 8);
|
||||
op = p = netbuffer->u.servercfg.varlengthinputs;
|
||||
|
||||
|
@ -3888,10 +3897,6 @@ static boolean SV_AddWaitingPlayers(void)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
DRPC_SendDiscordInfo();
|
||||
#endif
|
||||
|
||||
return newplayer;
|
||||
}
|
||||
|
||||
|
@ -4316,6 +4321,12 @@ static void HandlePacketFromAwayNode(SINT8 node)
|
|||
for (j = 0; j < MAXPLAYERS; j++)
|
||||
adminplayers[j] = netbuffer->u.servercfg.adminplayers[j];
|
||||
memcpy(server_context, netbuffer->u.servercfg.server_context, 8);
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
discordInfo.maxPlayers = netbuffer->u.servercfg.maxplayer;
|
||||
discordInfo.joinsAllowed = netbuffer->u.servercfg.allownewplayer;
|
||||
discordInfo.everyoneCanInvite = netbuffer->u.servercfg.discordinvites;
|
||||
#endif
|
||||
}
|
||||
|
||||
nodeingame[(UINT8)servernode] = true;
|
||||
|
|
|
@ -334,6 +334,11 @@ typedef struct
|
|||
|
||||
char server_context[8]; // Unique context id, generated at server startup.
|
||||
|
||||
// Discord info (always defined for net compatibility)
|
||||
UINT8 maxplayer;
|
||||
boolean allownewplayer;
|
||||
boolean discordinvites;
|
||||
|
||||
UINT8 varlengthinputs[0]; // Playernames and netvars
|
||||
} ATTRPACK serverconfig_pak;
|
||||
|
||||
|
|
Loading…
Reference in a new issue