mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-25 13:21:36 +00:00
Rework where connection_started is set to make sure its always set. Fixes https://github.com/fte-team/fteqw/issues/164
This commit is contained in:
parent
990066dea1
commit
f8962b6c47
5 changed files with 16 additions and 16 deletions
|
@ -4180,6 +4180,7 @@ static void QCBUILTIN PF_spawnclient (pubprogfuncs_t *prinst, struct globalvars_
|
|||
svs.clients[i].userid = ++nextuserid;
|
||||
svs.clients[i].protocol = SCP_BAD; //marker for bots
|
||||
svs.clients[i].state = cs_spawned;
|
||||
svs.clients[i].connection_started = realtime;
|
||||
svs.clients[i].spawned = true;
|
||||
sv.spawned_client_slots++;
|
||||
svs.clients[i].netchan.message.allowoverflow = true;
|
||||
|
|
|
@ -1668,6 +1668,7 @@ static qintptr_t QVM_Add_Bot (void *offset, quintptr_t mask, const qintptr_t *ar
|
|||
cl->userid = ++nextuserid;
|
||||
cl->protocol = SCP_BAD; //marker for bots
|
||||
cl->state = cs_spawned;
|
||||
cl->connection_started = realtime;
|
||||
cl->spawned = true;
|
||||
sv.spawned_client_slots++;
|
||||
cl->netchan.message.allowoverflow = true;
|
||||
|
|
|
@ -1018,6 +1018,7 @@ void SV_FullClientUpdate (client_t *client, client_t *to)
|
|||
|
||||
if (ISQWCLIENT(to))
|
||||
{
|
||||
float onservertime;
|
||||
unsigned int pext = to->fteprotocolextensions;
|
||||
int ping = SV_CalcPing (client, false);
|
||||
if (ping > 0xffff)
|
||||
|
@ -1041,10 +1042,13 @@ void SV_FullClientUpdate (client_t *client, client_t *to)
|
|||
MSG_WriteByte(buf, client->lossage);
|
||||
ClientReliable_FinishWrite(to);
|
||||
|
||||
onservertime = realtime - client->connection_started;
|
||||
if (onservertime > sv.time)
|
||||
onservertime = sv.time;
|
||||
buf = ClientReliable_StartWrite(to, 6);
|
||||
MSG_WriteByte(buf, svc_updateentertime);
|
||||
MSG_WriteByte(buf, i);
|
||||
MSG_WriteFloat(buf, realtime - client->connection_started);
|
||||
MSG_WriteFloat(buf, onservertime);
|
||||
ClientReliable_FinishWrite(to);
|
||||
|
||||
InfoBuf_ToString(&client->userinfo, info, (pext&PEXT_BIGUSERINFOS)?BASIC_INFO_STRING:sizeof(info), basicuserinfos, privateuserinfos, (pext&PEXT_BIGUSERINFOS)?NULL:basicuserinfos, &to->infosync, &client->userinfo);
|
||||
|
@ -2546,6 +2550,7 @@ client_t *SV_AddSplit(client_t *controller, char *info, int id)
|
|||
if (cl->spectator)
|
||||
InfoBuf_SetValueForStarKey (&cl->userinfo, "*spectator", va("%i", cl->spectator));
|
||||
cl->state = controller->state;
|
||||
cl->connection_started = realtime;
|
||||
|
||||
// host_client = NULL;
|
||||
// sv_player = NULL;
|
||||
|
@ -3076,6 +3081,7 @@ void SV_DoDirectConnect(svconnectinfo_t *fte_restrict info)
|
|||
#endif
|
||||
|
||||
newcl->state = cs_connected;
|
||||
newcl->connection_started = realtime;
|
||||
|
||||
#ifdef Q3SERVER
|
||||
newcl->gamestatesequence = -1;
|
||||
|
@ -5273,6 +5279,7 @@ void SV_Impulse_f (void)
|
|||
pr_global_struct->time = sv.world.physicstime;
|
||||
|
||||
svs.clients[i].state = cs_connected;
|
||||
svs.clients[i].connection_started = realtime;
|
||||
|
||||
SV_SetUpClientEdict(&svs.clients[i], svs.clients[i].edict);
|
||||
|
||||
|
|
|
@ -375,7 +375,6 @@ void SV_New_f (void)
|
|||
ClientReliableWrite_Byte (host_client, playernum);
|
||||
|
||||
split->state = cs_connected;
|
||||
split->connection_started = realtime;
|
||||
#ifdef SVRANKING
|
||||
split->stats_started = realtime;
|
||||
#endif
|
||||
|
@ -412,7 +411,6 @@ void SV_New_f (void)
|
|||
playernum |= 128;
|
||||
|
||||
split->state = cs_connected;
|
||||
split->connection_started = realtime;
|
||||
#ifdef SVRANKING
|
||||
split->stats_started = realtime;
|
||||
#endif
|
||||
|
@ -5459,7 +5457,6 @@ void SV_SetUpClientEdict (client_t *cl, edict_t *ent)
|
|||
ent->v->movetype = MOVETYPE_NOCLIP;
|
||||
|
||||
ent->v->frags = 0;
|
||||
cl->connection_started = realtime;
|
||||
}
|
||||
|
||||
//dynamically add/remove a splitscreen client
|
||||
|
@ -5949,18 +5946,7 @@ static void SVNQ_Spawn_f (void)
|
|||
host_client->maxspeed = ent->xv->maxspeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
ED_Clear(svprogfuncs, ent);
|
||||
ED_Spawned(ent, false);
|
||||
|
||||
ent->v->colormap = NUM_FOR_EDICT(svprogfuncs, ent);
|
||||
ent->v->team = 0; // FIXME
|
||||
svprogfuncs->SetStringField(svprogfuncs, ent, &ent->v->netname, host_client->name, true);
|
||||
|
||||
host_client->entgravity = ent->xv->gravity = 1.0;
|
||||
host_client->entgravity*=sv_gravity.value;
|
||||
host_client->maxspeed = ent->xv->maxspeed = sv_maxspeed.value;
|
||||
}
|
||||
SV_SetUpClientEdict(host_client, ent);
|
||||
|
||||
//
|
||||
// force stats to be updated
|
||||
|
@ -6221,6 +6207,8 @@ static void SVNQ_Status_f(void)
|
|||
int hours, mins, secs;
|
||||
if (!cl->state)
|
||||
continue;
|
||||
if (i >= host_client->max_net_clients)
|
||||
break; //don't send more than it expects. the ping parsers will give up and get spammy (sucks).
|
||||
secs = realtime - cl->connection_started;
|
||||
mins = secs/60;
|
||||
secs -= mins*60;
|
||||
|
@ -6418,6 +6406,7 @@ ucmd_t ucmds[] =
|
|||
{"sayone", SV_SayOne_f},
|
||||
{"say", SV_Say_f},
|
||||
{"say_team", SV_Say_Team_f},
|
||||
{"status", SVNQ_Status_f},
|
||||
#ifdef SVRANKING
|
||||
{"topten", Rank_ListTop10_f},
|
||||
#endif
|
||||
|
|
|
@ -3409,6 +3409,7 @@ void SVQ3_DirectConnect(netadr_t *from, sizebuf_t *msg) //Actually connect the c
|
|||
|
||||
cl->protocol = SCP_QUAKE3;
|
||||
cl->state = cs_connected;
|
||||
cl->connection_started = realtime;
|
||||
cl->name = cl->namebuf;
|
||||
cl->team = cl->teambuf;
|
||||
worldfuncs->ExtractFromUserinfo(cl, true);
|
||||
|
@ -3434,6 +3435,7 @@ static int SVQ3_AddBot(void)
|
|||
return -1; //failure, no slots
|
||||
|
||||
cl->protocol = SCP_BAD;
|
||||
cl->connection_started = realtime;
|
||||
cl->state = cs_connected;
|
||||
cl->name = cl->namebuf;
|
||||
cl->team = cl->teambuf;
|
||||
|
|
Loading…
Reference in a new issue