Date: Tuesday May 21, 2002 @ 1:17
Author: cameron
Update of /home/netrek/cvsroot/Vanilla/ntserv
In directory swashbuckler.real-time.com:/var/tmp/cvs-serv8509/ntserv
Modified Files:
ntscmds.c util.c
Log Message:
add more data to queue hosts
****************************************
Index: Vanilla/ntserv/ntscmds.c
diff -u Vanilla/ntserv/ntscmds.c:1.20 Vanilla/ntserv/ntscmds.c:1.21
--- Vanilla/ntserv/ntscmds.c:1.20 Sun Feb 24 12:43:52 2002
+++ Vanilla/ntserv/ntscmds.c Tue May 21 01:17:28 2002
@@ -1,4 +1,4 @@
-/* $Id: ntscmds.c,v 1.20 2002/02/24 18:43:52 karthik Exp $
+/* $Id: ntscmds.c,v 1.21 2002/05/21 06:17:28 cameron Exp $
*/
/*
@@ -613,11 +613,15 @@
int who;
char *addr;
int i;
- char *full = strstr(comm, "hosts");
+ int full;
who = mess->m_from;
addr = addr_mess(who,MINDIV);
+ full = 0;
+ if (strstr(comm, "hosts")) full++;
+ if (strstr(comm, "HOSTS")) full++;
+
for (i=0; i < MAXQUEUE; i++) {
int count;
@@ -631,13 +635,20 @@
queues[i].q_name, count);
/* if player typed "queue hosts", dump out the host names */
- if (full != NULL) {
+ if (full) {
int k = queues[i].first;
int j;
for (j=0; j < count; j++) {
- pmessage(who, MINDIV, addr, "Q%d: %s",
- j, waiting[k].host);
+ int m = find_slot_by_host(waiting[k].host, 0);
+ if (m != -1) {
+ struct player *p = &players[m];
+ pmessage(who, MINDIV, addr, "Q%d: (aka %s %s) %s",
+ j, p->p_mapchars, p->p_name, waiting[k].host);
+ } else {
+ pmessage(who, MINDIV, addr, "Q%d: %s",
+ j, waiting[k].host);
+ }
k = waiting[k].next;
}
}
Index: Vanilla/ntserv/util.c
diff -u Vanilla/ntserv/util.c:1.4 Vanilla/ntserv/util.c:1.5
--- Vanilla/ntserv/util.c:1.4 Tue May 1 21:00:19 2001
+++ Vanilla/ntserv/util.c Tue May 21 01:17:28 2002
@@ -119,3 +119,22 @@
}
#endif /* LTD_STATS */
+
+/* given a host name, return first matching player */
+int find_slot_by_host(char *host, int j)
+{
+ struct player *p;
+ int i;
+
+#ifdef FULL_HOSTNAMES
+ p = &players[0];
+ for(i=j;i<MAXPLAYER;i++) {
+ if ( (p->p_status != PFREE) && (!(p->p_flags & PFROBOT))) {
+ if (!strcmp(host, p->p_full_hostname)) return i;
+ }
+ p++;
+ }
+#endif
+ return -1;
+}
+