mirror of
https://github.com/rehlds/rehlds.git
synced 2025-01-01 01:25:38 +03:00
Global reliable net buffer is deprecated now
This commit is contained in:
parent
f22a6ae9d0
commit
a8afbd7d2e
@ -525,7 +525,17 @@ void SV_DropClient_internal(client_t *cl, qboolean crash, const char *string)
|
||||
g_GameClients[cl - g_psvs.clients]->SetSpawnedOnce(false);
|
||||
#endif // REHLDS_FIXES
|
||||
|
||||
#ifdef REHLDS_FIXES
|
||||
for (int i = 0; i < g_psvs.maxclients; i++)
|
||||
{
|
||||
if (!g_psvs.clients[i].connected)
|
||||
continue;
|
||||
|
||||
SV_FullClientUpdate(cl, &g_psvs.clients[i].netchan.message);
|
||||
}
|
||||
#else // REHLDS_FIXES
|
||||
SV_FullClientUpdate(cl, &g_psv.reliable_datagram);
|
||||
#endif // REHLDS_FIXES
|
||||
|
||||
NotifyDedicatedServerUI("UpdatePlayers");
|
||||
}
|
||||
|
@ -2638,8 +2638,20 @@ void Host_TogglePause_f(void)
|
||||
else
|
||||
SV_BroadcastPrintf("%s unpaused the game\n", &pr_strings[sv_player->v.netname]);
|
||||
|
||||
// TODO: send svc_setpause to client on spawn command
|
||||
#ifdef REHLDS_FIXES
|
||||
for (int i = 0; i < g_psvs.maxclients; i++)
|
||||
{
|
||||
if (!g_psvs.clients[i].connected)
|
||||
continue;
|
||||
|
||||
MSG_WriteByte(&g_psvs.clients[i].netchan.message, svc_setpause);
|
||||
MSG_WriteByte(&g_psvs.clients[i].netchan.message, g_psv.paused);
|
||||
}
|
||||
#else // REHLDS_FIXES
|
||||
MSG_WriteByte(&g_psv.reliable_datagram, svc_setpause);
|
||||
MSG_WriteByte(&g_psv.reliable_datagram, g_psv.paused);
|
||||
#endif // REHLDS_FIXES
|
||||
}
|
||||
|
||||
void Host_Pause_f(void)
|
||||
@ -2656,8 +2668,19 @@ void Host_Pause_f(void)
|
||||
return;
|
||||
|
||||
g_psv.paused = TRUE;
|
||||
#ifdef REHLDS_FIXES
|
||||
for (int i = 0; i < g_psvs.maxclients; i++)
|
||||
{
|
||||
if (!g_psvs.clients[i].connected)
|
||||
continue;
|
||||
|
||||
MSG_WriteByte(&g_psvs.clients[i].netchan.message, svc_setpause);
|
||||
MSG_WriteByte(&g_psvs.clients[i].netchan.message, g_psv.paused);
|
||||
}
|
||||
#else // REHLDS_FIXES
|
||||
MSG_WriteByte(&g_psv.reliable_datagram, svc_setpause);
|
||||
MSG_WriteByte(&g_psv.reliable_datagram, g_psv.paused);
|
||||
#endif // REHLDS_FIXES
|
||||
}
|
||||
|
||||
void Host_Unpause_f(void)
|
||||
@ -2674,8 +2697,19 @@ void Host_Unpause_f(void)
|
||||
return;
|
||||
|
||||
g_psv.paused = FALSE;
|
||||
#ifdef REHLDS_FIXES
|
||||
for (int i = 0; i < g_psvs.maxclients; i++)
|
||||
{
|
||||
if (!g_psvs.clients[i].connected)
|
||||
continue;
|
||||
|
||||
MSG_WriteByte(&g_psvs.clients[i].netchan.message, svc_setpause);
|
||||
MSG_WriteByte(&g_psvs.clients[i].netchan.message, g_psv.paused);
|
||||
}
|
||||
#else // REHLDS_FIXES
|
||||
MSG_WriteByte(&g_psv.reliable_datagram, svc_setpause);
|
||||
MSG_WriteByte(&g_psv.reliable_datagram, g_psv.paused);
|
||||
#endif // REHLDS_FIXES
|
||||
}
|
||||
|
||||
void Host_Interp_f(void)
|
||||
|
@ -2171,26 +2171,47 @@ void EXT_FUNC PF_MessageEnd_I(void)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
sizebuf_t * pBuffer = WriteDest_Parm(gMsgDest);
|
||||
if ((!gMsgDest && gMsgBuffer.cursize + pBuffer->cursize > pBuffer->maxsize) || !pBuffer->data)
|
||||
return;
|
||||
|
||||
if (gMsgType > svc_startofusermessages && (gMsgDest == MSG_ONE || gMsgDest == MSG_ONE_UNRELIABLE))
|
||||
#ifdef REHLDS_FIXES
|
||||
auto writer = [MsgIsVarLength]
|
||||
#endif
|
||||
{
|
||||
int entnum = NUM_FOR_EDICT((const edict_t *)gMsgEntity);
|
||||
if (entnum < 1 || entnum > g_psvs.maxclients)
|
||||
Host_Error("WriteDest_Parm: not a client");
|
||||
|
||||
client_t* client = &g_psvs.clients[entnum - 1];
|
||||
if (client->fakeclient || !client->hasusrmsgs || (!client->active && !client->spawned))
|
||||
sizebuf_t * pBuffer = WriteDest_Parm(gMsgDest);
|
||||
if ((gMsgDest == MSG_BROADCAST && gMsgBuffer.cursize + pBuffer->cursize > pBuffer->maxsize) || !pBuffer->data)
|
||||
return;
|
||||
}
|
||||
|
||||
MSG_WriteByte(pBuffer, gMsgType);
|
||||
if (MsgIsVarLength)
|
||||
MSG_WriteByte(pBuffer, gMsgBuffer.cursize);
|
||||
MSG_WriteBuf(pBuffer, gMsgBuffer.cursize, gMsgBuffer.data);
|
||||
if (gMsgType > svc_startofusermessages && (gMsgDest == MSG_ONE || gMsgDest == MSG_ONE_UNRELIABLE))
|
||||
{
|
||||
int entnum = NUM_FOR_EDICT((const edict_t *)gMsgEntity);
|
||||
if (entnum < 1 || entnum > g_psvs.maxclients)
|
||||
Host_Error("WriteDest_Parm: not a client");
|
||||
|
||||
client_t* client = &g_psvs.clients[entnum - 1];
|
||||
if (client->fakeclient || !client->hasusrmsgs || (!client->active && !client->spawned))
|
||||
return;
|
||||
}
|
||||
|
||||
MSG_WriteByte(pBuffer, gMsgType);
|
||||
if (MsgIsVarLength)
|
||||
MSG_WriteByte(pBuffer, gMsgBuffer.cursize);
|
||||
MSG_WriteBuf(pBuffer, gMsgBuffer.cursize, gMsgBuffer.data);
|
||||
}
|
||||
#ifdef REHLDS_FIXES
|
||||
;
|
||||
|
||||
if (gMsgDest == MSG_ALL) {
|
||||
gMsgDest = MSG_ONE;
|
||||
for (int i = 0; i < g_psvs.maxclients; i++) {
|
||||
gMsgEntity = g_psvs.clients[i].edict;
|
||||
if (gMsgEntity == nullptr)
|
||||
continue;
|
||||
if (FBitSet(gMsgEntity->v.flags, FL_FAKECLIENT))
|
||||
continue;
|
||||
writer();
|
||||
}
|
||||
} else {
|
||||
writer();
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (gMsgDest)
|
||||
{
|
||||
|
@ -4607,7 +4607,17 @@ void SV_UpdateUserInfo(client_t *pClient)
|
||||
pClient->sendinfo = FALSE;
|
||||
pClient->sendinfo_time = realtime + 1.0;
|
||||
SV_ExtractFromUserinfo(pClient);
|
||||
#ifdef REHLDS_FIXES
|
||||
for (int i = 0; i < g_psvs.maxclients; i++)
|
||||
{
|
||||
if (!g_psvs.clients[i].connected)
|
||||
continue;
|
||||
|
||||
SV_FullClientUpdate(pClient, &g_psvs.clients[i].netchan.message);
|
||||
}
|
||||
#else // REHLDS_FIXES
|
||||
SV_FullClientUpdate(pClient, &g_psv.reliable_datagram);
|
||||
#endif // REHLDS_FIXES
|
||||
}
|
||||
|
||||
void SV_UpdateToReliableMessages(void)
|
||||
|
Loading…
Reference in New Issue
Block a user