ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/socket/metaserver.c
(Generate patch)

Comparing deliantra/server/socket/metaserver.c (file contents):
Revision 1.7 by root, Sun Jul 16 17:53:58 2006 UTC vs.
Revision 1.8 by root, Sun Jul 16 18:01:32 2006 UTC

1/* 1/*
2 * static char *rcsid_metaserver_c = 2 * static char *rcsid_metaserver_c =
3 * "$Id: metaserver.c,v 1.7 2006/07/16 17:53:58 root Exp $"; 3 * "$Id: metaserver.c,v 1.8 2006/07/16 18:01:32 root Exp $";
4 */ 4 */
5 5
6/* 6/*
7 CrossFire, A Multiplayer game for X-windows 7 CrossFire, A Multiplayer game for X-windows
8 8
124 124
125 if (metafd == -1) return; /* No valid connection */ 125 if (metafd == -1) return; /* No valid connection */
126 126
127 /* We could use socket_info.nconns, but that is not quite as accurate, 127 /* We could use socket_info.nconns, but that is not quite as accurate,
128 * as connections in the progress of being established, are listening 128 * as connections in the progress of being established, are listening
129 * but don't have a player, etc. This operation below should not be that 129 * but don't have a player, etc. The checks below are basically the
130 * costly. 130 * same as for the who commands with the addition that WIZ, AFK, and BOT
131 * players are not counted.
131 */ 132 */
132 for (pl=first_player; pl!=NULL; pl=pl->next) 133 for (pl=first_player; pl!=NULL; pl=pl->next) {
133 if (!pl->hidden && pl->ob->map) num_players++; 134 if (pl->ob->map == NULL) continue;
135 if (pl->hidden) continue;
136 if (QUERY_FLAG(pl->ob, FLAG_WIZ)) continue;
137 if (QUERY_FLAG(pl->ob, FLAG_AFK)) continue;
138 if (pl->state != ST_PLAYING && pl->state != ST_GET_PARTY_PASSWORD) continue;
139 if (pl->socket.is_bot) continue;
140 num_players++;
141 }
134 142
135 sprintf(data,"%s|%d|%s|%s|%d|%d|%ld", settings.meta_host, num_players, VERSION "+", 143 sprintf(data,"%s|%d|%s|%s|%d|%d|%ld", settings.meta_host, num_players, VERSION "+",
136 settings.meta_comment, cst_tot.ibytes, cst_tot.obytes, 144 settings.meta_comment, cst_tot.ibytes, cst_tot.obytes,
137 (long)time(NULL) - cst_tot.time_start); 145 (long)time(NULL) - cst_tot.time_start);
138 if (sendto(metafd, data, strlen(data), 0, (struct sockaddr *)&sock, sizeof(sock))<0) { 146 if (sendto(metafd, data, strlen(data), 0, (struct sockaddr *)&sock, sizeof(sock))<0) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines