*/
void SV_DropClient(qboolean crash)
{
+ int i;
Con_Printf("Client \"%s\" dropped\n", host_client->name);
// send any final messages (don't check for errors)
host_client->colors = 0;
host_client->frags = 0;
// send notification to all clients
+ // get number of client manually just to make sure we get it right...
+ i = host_client - svs.clients;
MSG_WriteByte (&sv.reliable_datagram, svc_updatename);
- MSG_WriteByte (&sv.reliable_datagram, host_client->number);
+ MSG_WriteByte (&sv.reliable_datagram, i);
MSG_WriteString (&sv.reliable_datagram, host_client->name);
MSG_WriteByte (&sv.reliable_datagram, svc_updatecolors);
- MSG_WriteByte (&sv.reliable_datagram, host_client->number);
+ MSG_WriteByte (&sv.reliable_datagram, i);
MSG_WriteByte (&sv.reliable_datagram, host_client->colors);
MSG_WriteByte (&sv.reliable_datagram, svc_updatefrags);
- MSG_WriteByte (&sv.reliable_datagram, host_client->number);
+ MSG_WriteByte (&sv.reliable_datagram, i);
MSG_WriteShort (&sv.reliable_datagram, host_client->frags);
// free the client now
strcpy(host_client->old_name, host_client->name);
// send notification to all clients
MSG_WriteByte (&sv.reliable_datagram, svc_updatename);
- MSG_WriteByte (&sv.reliable_datagram, host_client->number);
+ MSG_WriteByte (&sv.reliable_datagram, host_client - svs.clients);
MSG_WriteString (&sv.reliable_datagram, host_client->name);
}
}
host_client->old_colors = host_client->colors;
// send notification to all clients
MSG_WriteByte (&sv.reliable_datagram, svc_updatecolors);
- MSG_WriteByte (&sv.reliable_datagram, host_client->number);
+ MSG_WriteByte (&sv.reliable_datagram, host_client - svs.clients);
MSG_WriteByte (&sv.reliable_datagram, host_client->colors);
}
}
client->old_colors = client->colors;
// send notification to all clients
MSG_WriteByte (&sv.reliable_datagram, svc_updatecolors);
- MSG_WriteByte (&sv.reliable_datagram, client->number);
+ MSG_WriteByte (&sv.reliable_datagram, client - svs.clients);
MSG_WriteByte (&sv.reliable_datagram, client->colors);
}
}
qboolean sendsignon;
// remove this client immediately
qboolean deadsocket;
- // index of this client in the svs.clients array
- int number;
// reliable messages must be sent periodically
double last_message;
char message[128];
// edicts get reallocated on level changes, so we need to update it here
- client->edict = EDICT_NUM(client->number + 1);
+ client->edict = EDICT_NUM((client - svs.clients) + 1);
// LordHavoc: clear entityframe tracking
strcpy(client->name, "unconnected");
strcpy(client->old_name, "unconnected");
- client->number = clientnum;
client->spawned = false;
client->edict = EDICT_NUM(clientnum+1);
client->message.data = client->msgbuf;
strcpy(host_client->old_name, host_client->name);
// send notification to all clients
MSG_WriteByte (&sv.reliable_datagram, svc_updatename);
- MSG_WriteByte (&sv.reliable_datagram, host_client->number);
+ MSG_WriteByte (&sv.reliable_datagram, i);
MSG_WriteString (&sv.reliable_datagram, host_client->name);
}
host_client->old_colors = host_client->colors;
// send notification to all clients
MSG_WriteByte (&sv.reliable_datagram, svc_updatecolors);
- MSG_WriteByte (&sv.reliable_datagram, host_client->number);
+ MSG_WriteByte (&sv.reliable_datagram, i);
MSG_WriteByte (&sv.reliable_datagram, host_client->colors);
}
host_client->old_frags = host_client->frags;
// send notification to all clients
MSG_WriteByte (&sv.reliable_datagram, svc_updatefrags);
- MSG_WriteByte (&sv.reliable_datagram, host_client->number);
+ MSG_WriteByte (&sv.reliable_datagram, i);
MSG_WriteShort (&sv.reliable_datagram, host_client->frags);
}
}