map changes now work through a proxy

This commit is contained in:
Bill Currie 2010-01-13 06:52:15 +00:00 committed by Jeff Teunissen
parent 3a3b55f15b
commit 37e52bad71
5 changed files with 32 additions and 10 deletions

View file

@ -73,7 +73,7 @@ typedef struct challenge_s {
void Client_Init (void);
void Client_NewConnection (void);
void Client_SendMessages (client_t *cl);
void Client_New (client_t *cl);
void Client_Frame (void);

View file

@ -110,7 +110,9 @@ void Server_Frame (void);
void Server_List (void);
void Server_Connect (const char *name, struct client_s *client);
void Server_Disconnect (struct client_s *client);
void Server_Broadcast (server_t *sv, int reliable, byte *msg, int len);
void Server_Broadcast (server_t *sv, int reliable, int all, const byte *msg,
int len);
void Server_BroadcastCommand (server_t *sv, const char *cmd);
struct qmsg_s;
void sv_parse (server_t *sv, struct msg_s *msg, int reliable);

View file

@ -86,8 +86,12 @@ client_drop (client_t *cl)
static void
cl_new_f (client_t *cl, void *unused)
{
qtv_printf ("\"cmd list\" for a list of servers\n");
qtv_printf ("\"cmd connect <servername>\" to connect to a server\n");
if (!cl->server) {
qtv_printf ("\"cmd list\" for a list of servers\n");
qtv_printf ("\"cmd connect <servername>\" to connect to a server\n");
} else {
Client_New (cl);
}
}
static void
@ -1051,8 +1055,8 @@ write_players (client_t *client, sizebuf_t *msg)
}
}
static void
cl_send_messages (client_t *cl)
void
Client_SendMessages (client_t *cl)
{
byte buf[MAX_DATAGRAM];
sizebuf_t msg;
@ -1266,7 +1270,7 @@ Client_Frame (void)
continue;
}
if (cl->send_message) {
cl_send_messages (cl);
Client_SendMessages (cl);
cl->send_message = false;
}
c = &(*c)->clnext;

View file

@ -601,7 +601,8 @@ Server_Disconnect (struct client_s *client)
}
void
Server_Broadcast (server_t *sv, int reliable, byte *msg, int len)
Server_Broadcast (server_t *sv, int reliable, int all, const byte *msg,
int len)
{
client_t *cl;
byte svc;
@ -611,7 +612,8 @@ Server_Broadcast (server_t *sv, int reliable, byte *msg, int len)
svc = *msg++;
len--;
for (cl = sv->clients; cl; cl = cl->next) {
if ((sv->player_mask != ~0u) && !(sv->player_mask & cl->spec_track))
if (!all && (sv->player_mask != ~0u)
&& !(sv->player_mask & cl->spec_track))
continue;
if (reliable) {
MSG_ReliableWrite_Begin (&cl->backbuf, svc, len + 1);
@ -621,3 +623,11 @@ Server_Broadcast (server_t *sv, int reliable, byte *msg, int len)
}
}
}
void
Server_BroadcastCommand (server_t *sv, const char *cmd)
{
const char *msg = va ("%c%s", svc_stufftext, cmd);
int len = strlen (msg) + 1;
Server_Broadcast (sv, 1, 1, (const byte *) msg, len);
}

View file

@ -211,16 +211,22 @@ sv_skins_f (server_t *sv)
sv->frames[i].entities.entities = sv->entity_states[i];
sv->frames[i].players.players = sv->player_states[i];
}
Server_BroadcastCommand (sv, "reconnect\n");
}
static void
sv_changing_f (server_t *sv)
{
client_t *cl;
sv->connected = 1;
sv->num_signon_buffers = 0;
qtv_printf ("Changing map...\n");
MSG_WriteByte (&sv->netchan.message, qtv_nop);
sv->next_run = realtime;
Server_BroadcastCommand (sv, "changing\n");
for (cl = sv->clients; cl; cl = cl->next)
Client_SendMessages (cl);
}
static void
@ -1062,7 +1068,7 @@ sv_parse (server_t *sv, qmsg_t *msg, int reliable)
}
if (send) {
bc_len = msg->readcount - bc_len;
Server_Broadcast (sv, reliable, bc_data, bc_len);
Server_Broadcast (sv, reliable, 0, bc_data, bc_len);
}
}
}