Update of /cvsroot/netrek/client/netrekxp/src
In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv7735

Modified Files:
	socket.c 
Log Message:
Add SP_RANK to packet log.

Index: socket.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/socket.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- socket.c	26 May 2009 02:18:17 -0000	1.62
+++ socket.c	27 May 2009 23:07:05 -0000	1.63
@@ -2812,18 +2812,18 @@
 void
 handleRank (struct rank_spacket *packet)
 {
-    int rankn;
+    int i = packet->rankn;
     int size;
 
 #ifdef CORRUPTED_PACKETS
-    if (packet->rankn > nranks)
+    if (i > nranks)
     {
         LineToConsole ("handleRanks: bad index\n");
         return;
     }
 #endif
     /* A new rank.  Reallocate memory as necessary. */
-    if (packet->rankn == nranks)
+    if (i == nranks)
     {
         size = sizeof(struct rank) * ( nranks + 1 );
         ranks = (struct rank *) realloc(ranks, size);
@@ -2832,12 +2832,13 @@
         nranks++;
         W_ResizeTextWindow(rankw, 80, nranks + 9);
     }
-    rankn = packet->rankn;
-    STRNCPY(ranks[rankn].name, packet->name, 11);
-    STRNCPY(ranks[rankn].cname, packet->cname, 5);
-    ranks[rankn].hours = (float) (ntohl (packet->hours) / 100.0);
-    ranks[rankn].ratings = (float) (ntohl (packet->ratings) / 100.0);
-    ranks[rankn].offense = (float) (ntohl (packet->offense) / 100.0);
+    packet->name[15] = 0;
+    packet->cname[7] = 0;
+    ranks[i].name = strdup(packet->name);
+    ranks[i].cname = strdup(packet->cname);
+    ranks[i].hours = (float) (ntohl (packet->hours) / 100.0);
+    ranks[i].ratings = (float) (ntohl (packet->ratings) / 100.0);
+    ranks[i].offense = (float) (ntohl (packet->offense) / 100.0);
 }
 
 void
@@ -5314,7 +5315,18 @@
 		   ntohl(((struct feature_cpacket *) packet)->value),
 		   ((struct feature_cpacket *) packet)->name );
 	 break;
-#endif       
+#endif
+       case SP_RANK :
+	 LineToConsole("\nS->C SP_RANK\t");
+	 if (log_packets > 1)
+	   LineToConsole(" rankn=%d, name=\"%s\", hours=%d, ratings=%d, offense=%d, cname=\"%s\"",
+		   ((struct rank_spacket *) packet)->rankn,
+		   ((struct rank_spacket *) packet)->name,
+		   ntohl(((struct rank_spacket *) packet)->hours),
+		   ntohl(((struct rank_spacket *) packet)->ratings),
+		   ntohl(((struct rank_spacket *) packet)->offense),
+		   ((struct rank_spacket *) packet)->cname );
+	 break;
 #ifdef SHORT_PACKETS
        case SP_S_TORP       :                  /* variable length torp * *
 						* packet */