Update of /cvsroot/netrek/client/netrekxp/src In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv24529 Modified Files: defaults.c mswindow.c newwin.c playerlist.c socket.c Log Message: Fix bug where font size was not saving properly. Fix typos in some netrekrc option descriptions. Fix bug where p_stats.st_rank was not initialized. Design flaw fix - playerlist is displayed before player log in. Client does not know whether server is paradise or bronco. Client receives other player login packets including rank. Packets were being discarded due to sanity check on rank. Sanity check moved to places where rank is displayed, rather than discarding packets. Index: newwin.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/newwin.c,v retrieving revision 1.76 retrieving revision 1.77 diff -u -d -r1.76 -r1.77 --- newwin.c 16 Jun 2008 23:48:54 -0000 1.76 +++ newwin.c 28 Mar 2009 02:50:24 -0000 1.77 @@ -1931,7 +1931,12 @@ sprintf (buf, "Welcome aboard %s!", (me->p_stats2.st_royal == 0 ? ranks2[me->p_stats2.st_rank].name : royal[me->p_stats2.st_royal].name)); else - sprintf (buf, "Welcome aboard %s!", ranks[me->p_stats.st_rank].name); + { + if (me->p_stats.st_rank >= NUMRANKS) + sprintf (buf, "Welcome aboard!"); + else + sprintf (buf, "Welcome aboard %s!", ranks[me->p_stats.st_rank].name); + } warning (buf); } Index: playerlist.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/playerlist.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- playerlist.c 16 Apr 2008 02:57:09 -0000 1.17 +++ playerlist.c 28 Mar 2009 02:50:24 -0000 1.18 @@ -1129,7 +1129,12 @@ //format (buffPoint, (j->p_stats2.st_royal == 0 ? ranks2[j->p_stats2.st_rank].name : royal[j->p_stats2.st_royal].name), 10, 0); format (buffPoint, "UNKN", 4, 0); else - format (buffPoint, ranks[j->p_stats.st_rank].cname, 4, 0); + { + if (j->p_stats.st_rank >= NUMRANKS) + format (buffPoint, "UNKN", 4, 0); + else + format (buffPoint, ranks[j->p_stats.st_rank].cname, 4, 0); + } buffPoint += 4; break; @@ -1137,7 +1142,12 @@ if (paradise) format (buffPoint, (j->p_stats2.st_royal == 0 ? ranks2[j->p_stats2.st_rank].name : royal[j->p_stats2.st_royal].name), 10, 0); else - format (buffPoint, ranks[j->p_stats.st_rank].name, 10, 0); + { + if (j->p_stats.st_rank >= NUMRANKS) + format (buffPoint, "Unknown! ", 10, 0); + else + format (buffPoint, ranks[j->p_stats.st_rank].name, 10, 0); + } buffPoint += 10; break; Index: mswindow.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/mswindow.c,v retrieving revision 1.92 retrieving revision 1.93 diff -u -d -r1.92 -r1.93 --- mswindow.c 12 Feb 2009 03:48:25 -0000 1.92 +++ mswindow.c 28 Mar 2009 02:50:24 -0000 1.93 @@ -811,7 +811,8 @@ lf.lfPitchAndFamily = FF_MODERN | FIXED_PITCH; strcpy (lf.lfFaceName, "Netrek"); - lf.lfHeight = -intDefault ("fontSize", fontSize); + fontSize = intDefault ("fontSize", fontSize); + lf.lfHeight = -fontSize; lf.lfWeight = FW_REGULAR; W_RegularFont = (W_Font) CreateFontIndirect (&lf); Index: defaults.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/defaults.c,v retrieving revision 1.93 retrieving revision 1.94 diff -u -d -r1.93 -r1.94 --- defaults.c 16 Jul 2008 00:16:10 -0000 1.93 +++ defaults.c 28 Mar 2009 02:50:24 -0000 1.94 @@ -882,7 +882,7 @@ "0 - TCP", "1 - simple UDP (default)", "2 - enforced UDP (state)", - "3 - enfotrced UDP (state & weapons)", + "3 - enforced UDP (state & weapons)", NULL } }, @@ -939,7 +939,8 @@ { "Receive SP_GENERIC_32 packets, which are used to convey things", "like repair time and planet being orbitted. Increases bandwidth", - "usage by 320 bytes/second for a server running at 10 UPS.", + "usage anywhere from 0 to 320 bytes/second for a server running", + "at 10 UPS.", NULL } }, Index: socket.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/socket.c,v retrieving revision 1.56 retrieving revision 1.57 diff -u -d -r1.56 -r1.57 --- socket.c 20 Mar 2009 03:37:09 -0000 1.56 +++ socket.c 28 Mar 2009 02:50:24 -0000 1.57 @@ -2455,11 +2455,16 @@ LineToConsole ("handlePlyrLogin: received player num larger than nplayers\n"); return; } + /* So apparently the server sends this packet before it tells us if it is a paradise + server or not, which makes this check throw out valid player login packets on paradise + servers. Sanity check on pl->p_stats.st_rank moved to playerlist.c and newwin.c + as needed. BB*/ + /* if (!paradise && packet->rank >= NUMRANKS) { LineToConsole ("handlePlyrLogin: bad rank %d\n", packet->rank); return; - } + }*/ packet->name[sizeof (packet->name) - 1] = '\0'; packet->monitor[sizeof (packet->monitor) - 1] = '\0'; packet->login[sizeof (packet->login) - 1] = '\0'; @@ -2932,6 +2937,7 @@ players[i].p_no = i; players[i].p_ntorp = 0; players[i].p_nplasmatorp = 0; + players[i].p_stats.st_rank = 0; players[i].p_stats2.st_rank = 0; players[i].p_stats2.st_royal = 0; players[i].p_ndrone = 0;