mirror of
https://github.com/rehlds/rehlds.git
synced 2025-01-06 03:55:32 +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);
|
g_GameClients[cl - g_psvs.clients]->SetSpawnedOnce(false);
|
||||||
#endif // REHLDS_FIXES
|
#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);
|
SV_FullClientUpdate(cl, &g_psv.reliable_datagram);
|
||||||
|
#endif // REHLDS_FIXES
|
||||||
|
|
||||||
NotifyDedicatedServerUI("UpdatePlayers");
|
NotifyDedicatedServerUI("UpdatePlayers");
|
||||||
}
|
}
|
||||||
|
@ -2638,8 +2638,20 @@ void Host_TogglePause_f(void)
|
|||||||
else
|
else
|
||||||
SV_BroadcastPrintf("%s unpaused the game\n", &pr_strings[sv_player->v.netname]);
|
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, svc_setpause);
|
||||||
MSG_WriteByte(&g_psv.reliable_datagram, g_psv.paused);
|
MSG_WriteByte(&g_psv.reliable_datagram, g_psv.paused);
|
||||||
|
#endif // REHLDS_FIXES
|
||||||
}
|
}
|
||||||
|
|
||||||
void Host_Pause_f(void)
|
void Host_Pause_f(void)
|
||||||
@ -2656,8 +2668,19 @@ void Host_Pause_f(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
g_psv.paused = TRUE;
|
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, svc_setpause);
|
||||||
MSG_WriteByte(&g_psv.reliable_datagram, g_psv.paused);
|
MSG_WriteByte(&g_psv.reliable_datagram, g_psv.paused);
|
||||||
|
#endif // REHLDS_FIXES
|
||||||
}
|
}
|
||||||
|
|
||||||
void Host_Unpause_f(void)
|
void Host_Unpause_f(void)
|
||||||
@ -2674,8 +2697,19 @@ void Host_Unpause_f(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
g_psv.paused = FALSE;
|
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, svc_setpause);
|
||||||
MSG_WriteByte(&g_psv.reliable_datagram, g_psv.paused);
|
MSG_WriteByte(&g_psv.reliable_datagram, g_psv.paused);
|
||||||
|
#endif // REHLDS_FIXES
|
||||||
}
|
}
|
||||||
|
|
||||||
void Host_Interp_f(void)
|
void Host_Interp_f(void)
|
||||||
|
@ -2171,26 +2171,47 @@ void EXT_FUNC PF_MessageEnd_I(void)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef REHLDS_FIXES
|
||||||
sizebuf_t * pBuffer = WriteDest_Parm(gMsgDest);
|
auto writer = [MsgIsVarLength]
|
||||||
if ((!gMsgDest && gMsgBuffer.cursize + pBuffer->cursize > pBuffer->maxsize) || !pBuffer->data)
|
#endif
|
||||||
return;
|
|
||||||
|
|
||||||
if (gMsgType > svc_startofusermessages && (gMsgDest == MSG_ONE || gMsgDest == MSG_ONE_UNRELIABLE))
|
|
||||||
{
|
{
|
||||||
int entnum = NUM_FOR_EDICT((const edict_t *)gMsgEntity);
|
sizebuf_t * pBuffer = WriteDest_Parm(gMsgDest);
|
||||||
if (entnum < 1 || entnum > g_psvs.maxclients)
|
if ((gMsgDest == MSG_BROADCAST && gMsgBuffer.cursize + pBuffer->cursize > pBuffer->maxsize) || !pBuffer->data)
|
||||||
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;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
MSG_WriteByte(pBuffer, gMsgType);
|
if (gMsgType > svc_startofusermessages && (gMsgDest == MSG_ONE || gMsgDest == MSG_ONE_UNRELIABLE))
|
||||||
if (MsgIsVarLength)
|
{
|
||||||
MSG_WriteByte(pBuffer, gMsgBuffer.cursize);
|
int entnum = NUM_FOR_EDICT((const edict_t *)gMsgEntity);
|
||||||
MSG_WriteBuf(pBuffer, gMsgBuffer.cursize, gMsgBuffer.data);
|
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)
|
switch (gMsgDest)
|
||||||
{
|
{
|
||||||
|
@ -4607,7 +4607,17 @@ void SV_UpdateUserInfo(client_t *pClient)
|
|||||||
pClient->sendinfo = FALSE;
|
pClient->sendinfo = FALSE;
|
||||||
pClient->sendinfo_time = realtime + 1.0;
|
pClient->sendinfo_time = realtime + 1.0;
|
||||||
SV_ExtractFromUserinfo(pClient);
|
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);
|
SV_FullClientUpdate(pClient, &g_psv.reliable_datagram);
|
||||||
|
#endif // REHLDS_FIXES
|
||||||
}
|
}
|
||||||
|
|
||||||
void SV_UpdateToReliableMessages(void)
|
void SV_UpdateToReliableMessages(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user