From modemhero at users.sourceforge.net Wed Feb 20 22:32:27 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Thu, 21 Feb 2008 04:32:27 +0000 Subject: [netrek-cvs] client/netrekxp clientr.suo,1.140,1.141 Message-ID: <20080221045910.E8F8DB3EB@smtpgrey-2.real-time.com> Update of /cvsroot/netrek/client/netrekxp In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv1252 Modified Files: clientr.suo Log Message: Added support for paradise server listings for the paradise version of the client. Index: clientr.suo =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/clientr.suo,v retrieving revision 1.140 retrieving revision 1.141 diff -u -d -r1.140 -r1.141 Binary files /tmp/cvs6mBd8i and /tmp/cvsSRgVoq differ From modemhero at users.sourceforge.net Wed Feb 20 22:32:28 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Thu, 21 Feb 2008 04:32:28 +0000 Subject: [netrek-cvs] client/netrekxp/src parsemeta.c,1.39,1.40 Message-ID: <20080221045918.848E63B4075@smtpgrey-1.real-time.com> Update of /cvsroot/netrek/client/netrekxp/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv1252/src Modified Files: parsemeta.c Log Message: Added support for paradise server listings for the paradise version of the client. Index: parsemeta.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/parsemeta.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- parsemeta.c 16 May 2007 00:05:16 -0000 1.39 +++ parsemeta.c 21 Feb 2008 04:32:25 -0000 1.40 @@ -565,8 +565,13 @@ if (tempstatus > statusLevel) throwaway++; +#ifdef PARADISE + /* only show paradise servers */ + if (type != 'P') throwaway++; +#else /* ignore paradise servers */ if (type == 'P') throwaway++; +#endif /* if it's to be thrown away, do not add this server, skip to next */ if (throwaway) continue; From modemhero at users.sourceforge.net Sat Feb 23 18:33:57 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sun, 24 Feb 2008 00:33:57 +0000 Subject: [netrek-cvs] client/netrekxp NetrekXP to do list.C, 1.156, 1.157 clientr.suo, 1.141, 1.142 Message-ID: <20080224003406.63046B3EA@smtpgrey-2.real-time.com> Update of /cvsroot/netrek/client/netrekxp In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv29109 Modified Files: NetrekXP to do list.C clientr.suo Log Message: A bunch of paradise fixes and enhancements. 1) Fixed bug with paradise ALL messages going to the wrong windows. 2) Hopefully fixed bug with royals and ranks not being properly initialized. 3) Added paradise packet types to cambot. Cambot now seems to work for recording and playback. 4) Added paradise info window, for both players and planets, so that players can see stuff like planet atmosphere, and the different paradise ratings, using the info keys 'i' and 'I'. Index: NetrekXP to do list.C =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/NetrekXP to do list.C,v retrieving revision 1.156 retrieving revision 1.157 diff -u -d -r1.156 -r1.157 --- NetrekXP to do list.C 29 Nov 2007 05:29:04 -0000 1.156 +++ NetrekXP to do list.C 24 Feb 2008 00:33:54 -0000 1.157 @@ -12,6 +12,7 @@ 9) on daemon exit in newbie/pret, kill any hosed bot slots 10) end game bots are stupid, and on timericide don't act right 11) feature packet for rank names and requirements +12) feature packet for KSHIP2 and KTORP2 p_whydead messages Things that are sorta fixed, but could use improvement: 1) Border issue - quite complex problem, how to know the borders to obey after the bitmap @@ -36,23 +37,23 @@ Maybe with enforced state? Paradise issues: -Motd paging system gutted for sake of simplicity -Autologin with name and password seems to break any motd pics -A bunch of gridline/zoom options should be made into netrekrc options. -The galactic zoom doesn't work -Some of the paradise packet types may need some work -Many many places in code where things are based on MAXSOMETHING whether it be players +1) Motd paging system gutted for sake of simplicity +2) Autologin with name and password seems to break any motd pics - race condition +during login sequence. +3) A bunch of gridline/zoom options should be made into netrekrc options. +4) The galactic zoom doesn't work +5) Some of the paradise packet types may need some work +6) Many many places in code where things are based on MAXSOMETHING whether it be players torps planets plasmas. Whereas paradise wants to use dynamic variables. It's a mess. And paradise has nphasers, the entire concept of multiple phasers per ship is not compliant with current code. -Still missing asteroids and (flashing) warpbeacons. -Info window not working right with paradise. -Need popup box that works, when connecting to wrong server type -CV army capacity is wrong -Login messages are being sent to review window (mapped for kills and phasers), not all! -Seems a commodore char doesn't have the proper rank info..player info is all blank. -Kill messages are being sent to all, not review, why? -Cambot playback is broken. Packet handler needs updating. +7) Still missing asteroids and (flashing) warpbeacons. +8) Show ratings on full/wide playerlist. +9) CV army capacity is wrong - waiting on word from server experts to the right value +10) Seems a commodore char doesn't have the proper rank info..player info is all blank. + this may be fixed....needs testing +11) Playing back recordings made by linux pclient is probably impossible. +12) Mysterious crash bug, not reproducible by me. Wish list: 1) Rewrite graphics engine using SDL Index: clientr.suo =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/clientr.suo,v retrieving revision 1.141 retrieving revision 1.142 diff -u -d -r1.141 -r1.142 Binary files /tmp/cvsb8PRI7 and /tmp/cvsLH4lMz differ From modemhero at users.sourceforge.net Sat Feb 23 18:33:57 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sun, 24 Feb 2008 00:33:57 +0000 Subject: [netrek-cvs] client/netrekxp/include proto.h, 1.58, 1.59 struct.h, 1.23, 1.24 Message-ID: <20080224003406.4F3AE3B4075@smtpgrey-1.real-time.com> Update of /cvsroot/netrek/client/netrekxp/include In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv29109/include Modified Files: proto.h struct.h Log Message: A bunch of paradise fixes and enhancements. 1) Fixed bug with paradise ALL messages going to the wrong windows. 2) Hopefully fixed bug with royals and ranks not being properly initialized. 3) Added paradise packet types to cambot. Cambot now seems to work for recording and playback. 4) Added paradise info window, for both players and planets, so that players can see stuff like planet atmosphere, and the different paradise ratings, using the info keys 'i' and 'I'. Index: struct.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/struct.h,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- struct.h 7 Jun 2007 04:43:37 -0000 1.23 +++ struct.h 24 Feb 2008 00:33:55 -0000 1.24 @@ -761,6 +761,36 @@ }; #ifdef PARADISE +/* ratings struct */ +struct ratings { + float r_offrat; /* offense rating */ + float r_planetrat; /* planets rating */ + float r_bombrat; /* bombing rating */ + float r_defrat; /* defense rating */ + float r_resrat; /* resource rating */ + float r_dooshrat; /* doosh rating */ + float r_stratrat; /* strategy rating */ + float r_batrat; /* battle rating */ + float r_sbrat; /* sb rating */ + float r_wbrat; /* wb rating */ + float r_jsrat; /* js rating */ + int r_jsplanets; /* js planets */ + int r_resources; /* total resources bombed */ + int r_armies; /* total armies bombed */ + int r_planets; /* total planets taken */ + int r_dooshes; /* total armies dooshed */ + float r_specrat; /* special ship rating */ + float r_di; /* damage inflicted */ + float r_ratio; /* ratio, kills/losses */ + int r_kills; /* kills */ + int r_losses; /* losses */ + float r_ratings; /* total ratings */ + float r_killsPerHour; /* kills/hour */ + float r_lossesPerHour; /* losses/hour */ + float r_maxkills; /* max kills */ + int r_genocides; /* number of genocides */ +}; + struct rank2 { /* Paradise ranks */ int genocides; /* minimum number of genocides */ float di; /* minimum destruction inflicted */ Index: proto.h =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/include/proto.h,v retrieving revision 1.58 retrieving revision 1.59 diff -u -d -r1.58 -r1.59 --- proto.h 25 May 2007 03:36:44 -0000 1.58 +++ proto.h 24 Feb 2008 00:33:55 -0000 1.59 @@ -1155,6 +1155,7 @@ struct rsa_key_spacket; void handleRSAKey (struct rsa_key_spacket *packet); #ifdef PARADISE +void build_default_configuration (void); void handleScan (struct scan_spacket *packet); void handleMotdPic (struct motd_pic_spacket * packet); void handleStats2 (struct stats_spacket2 * packet); From modemhero at users.sourceforge.net Sat Feb 23 18:33:58 2008 From: modemhero at users.sourceforge.net (Bill Balcerski) Date: Sun, 24 Feb 2008 00:33:58 +0000 Subject: [netrek-cvs] client/netrekxp/src cowmain.c, 1.35, 1.36 dmessage.c, 1.9, 1.10 enter.c, 1.13, 1.14 inform.c, 1.6, 1.7 playback.c, 1.22, 1.23 socket.c, 1.36, 1.37 Message-ID: <20080224003407.457D83B4075@smtpgrey-1.real-time.com> Update of /cvsroot/netrek/client/netrekxp/src In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv29109/src Modified Files: cowmain.c dmessage.c enter.c inform.c playback.c socket.c Log Message: A bunch of paradise fixes and enhancements. 1) Fixed bug with paradise ALL messages going to the wrong windows. 2) Hopefully fixed bug with royals and ranks not being properly initialized. 3) Added paradise packet types to cambot. Cambot now seems to work for recording and playback. 4) Added paradise info window, for both players and planets, so that players can see stuff like planet atmosphere, and the different paradise ratings, using the info keys 'i' and 'I'. Index: dmessage.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/dmessage.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- dmessage.c 11 Apr 2007 23:06:33 -0000 1.9 +++ dmessage.c 24 Feb 2008 00:33:55 -0000 1.10 @@ -165,7 +165,12 @@ } + +#ifdef PARADISE + if (0) /* Paradise doesn't support the message flags */ +#else if (niftyNewMessages) +#endif { if (logging) { Index: inform.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/inform.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- inform.c 18 May 2007 19:54:38 -0000 1.6 +++ inform.c 24 Feb 2008 00:33:56 -0000 1.7 @@ -42,6 +42,10 @@ }; #endif +#ifdef PARADISE +static void Info_list_paradise (struct player * j); +#endif + /******************************************************************************/ /*** inform() ***/ /******************************************************************************/ @@ -56,17 +60,12 @@ register struct player *j; register struct planet *k; int mx, my; - double dist; struct obtype *gettarget (W_Window ww, int x, int y, int targtype), *target; int windowWidth, windowHeight; - float KillsPerHour, LossesPerHour; /* SB info window changed to - * use these instead of - * Offense and Defense. - * 12/27/93 ATH */ mx = x; my = y; @@ -97,6 +96,53 @@ { if (key == 'i') { +#ifdef PARADISE + double dist; + /* Too close to the edge? */ + if (mx + 23 * W_Textwidth + 2 > windowWidth) + mx = windowWidth - 23 * W_Textwidth - 2; + if (my + 6 * W_Textheight + 2 > windowHeight) + my = windowHeight - 6 * W_Textheight - 2; + + infow = + W_MakeWindow ("info", mx, my, 23 * W_Textwidth, + 7 * W_Textheight, ww, 2, foreColor); + W_MapWindow (infow); + j = &players[target->o_num]; + (void) sprintf (buf, "%s (%c%c)", j->p_name, teamlet[j->p_team], + shipnos[j->p_no]); + W_WriteText (infow, W_Textwidth, W_Textheight * line++, + playerColor (j), buf, strlen (buf), shipFont (j)); + (void) sprintf (buf, "Speed: %-d", j->p_speed); + W_WriteText (infow, W_Textwidth, W_Textheight * line++, + playerColor (j), buf, strlen (buf), W_RegularFont); + + (void) sprintf (buf, "kills: %-4.2f", j->p_kills); + W_WriteText (infow, W_Textwidth, W_Textheight * line++, + playerColor (j), buf, strlen (buf), W_RegularFont); + dist = hypot((double) (me->p_x - j->p_x), + (double) (me->p_y - j->p_y)) / (double) GRIDSIZE; + (void) sprintf(buf, "dist: %-1.2f sectors", dist); + W_WriteText (infow, W_Textwidth, W_Textheight * line++, + playerColor (j), buf, strlen (buf), W_RegularFont); + (void) sprintf (buf, "Ship Type: %-s", + my_classes[j->p_ship.s_type]); + W_WriteText (infow, W_Textwidth, W_Textheight * line++, + playerColor (j), buf, strlen (buf), W_RegularFont); + + if (j->p_swar & me->p_team) + W_WriteText (infow, W_Textwidth, W_Textheight * line++, + playerColor (j), "WAR", 3, W_RegularFont); + else if (j->p_hostile & me->p_team) + W_WriteText (infow, W_Textwidth, W_Textheight * line++, + playerColor (j), "HOSTILE", 7, W_RegularFont); + else + W_WriteText (infow, W_Textwidth, W_Textheight * line++, + playerColor (j), "PEACEFUL", 8, W_RegularFont); + (void) sprintf (buf, "%s@%s", j->p_login, j->p_monitor); + W_WriteText (infow, W_Textwidth, W_Textheight * line++, + playerColor (j), buf, strlen (buf), W_RegularFont); +#else /* Too close to the edge? */ if (mx + 23 * W_Textwidth + 2 > windowWidth) mx = windowWidth - 23 * W_Textwidth - 2; @@ -136,9 +182,30 @@ (void) sprintf (buf, "%s@%s", j->p_login, j->p_monitor); W_WriteText (infow, W_Textwidth, W_Textheight * line++, playerColor (j), buf, strlen (buf), W_RegularFont); +#endif } else { /* New information window! */ +#ifdef PARADISE + if (mx + 50 * W_Textwidth + 2 > windowWidth) + mx = windowWidth - 50 * W_Textwidth - 2; + if (my + 25 * W_Textheight + 2 > windowHeight) + my = windowHeight - 22 * W_Textheight - 2; + + infow = + W_MakeWindow ("info", mx, my, 50 * W_Textwidth, + 25 * W_Textheight, ww, 2, foreColor); + W_MapWindow (infow); + j = &players[target->o_num]; + (void) sprintf (buf, "%s (%c%c):", j->p_name, teamlet[j->p_team], + shipnos[j->p_no]); + W_WriteText (infow, W_Textwidth, W_Textheight * line++, + playerColor (j), buf, strlen (buf), shipFont (j)); + Info_list_paradise(j); +#else + float KillsPerHour, LossesPerHour; /* SB info window changed to + * use these instead of + * Offense and Defense. */ if (mx + 24 * W_Textwidth + 2 > windowWidth) mx = windowWidth - 24 * W_Textwidth - 2; if (my + 10 * W_Textheight + 2 > windowHeight) @@ -226,10 +293,105 @@ } W_WriteText (infow, W_Textwidth, W_Textheight * line++, playerColor (j), buf, strlen (buf), W_RegularFont); +#endif } } else { /* Planet */ +#ifdef PARADISE + /* Too close to the edge? */ + if (mx + 23 * W_Textwidth + 2 > windowWidth) + mx = windowWidth - 28 * W_Textwidth - 2; + if (my + 5 * W_Textheight + 2 > windowHeight) + my = windowHeight - 5 * W_Textheight - 2; + + infow = + W_MakeWindow ("info", mx, my, W_Textwidth * 28, W_Textheight * 5, + ww, 2, foreColor); + W_MapWindow (infow); + k = &planets[target->o_num]; + if ((k->pl_info & me->p_team) +#ifdef RECORDGAME + || playback +#endif + ) + { + if (k->pl_flags & PLSTAR) /* test if planet is a star */ + { + (void) sprintf(buf, "%s", k->pl_name); + W_WriteText(infow, W_Textwidth, W_Textheight * line++, textColor, + buf, strlen(buf), W_RegularFont); + (void) sprintf(buf, "STAR "); + W_WriteText(infow, W_Textwidth, W_Textheight * line++, + textColor, buf, strlen(buf), W_RegularFont); + } + else /* not a star */ + { + (void) sprintf(buf, "%s (%c)", k->pl_name, teamlet[k->pl_owner]); + W_WriteText(infow, W_Textwidth, W_Textheight * line++, planetColor (k), + buf, strlen(buf), planetFont (k)); + (void) sprintf(buf, "Armies %d", k->pl_armies); + W_WriteText(infow, W_Textwidth, W_Textheight * line++, planetColor (k), + buf, strlen(buf), W_RegularFont); + (void) sprintf(buf, "%s %s %s %s", + (k->pl_flags & PLREPAIR ? "RPR" : " "), + (k->pl_flags & PLFUEL ? "FUEL" : " "), + (k->pl_flags & PLAGRI ? "AGRI" : " "), + (k->pl_flags & PLSHIPYARD ? "SHPYD" : " ")); + W_WriteText(infow, W_Textwidth, W_Textheight * line++, planetColor (k), + buf, strlen(buf), W_RegularFont); + (void) sprintf(buf, "atmos: "); + switch (k->pl_flags & PLATMASK) { + case PLPOISON: + strcat(buf, "TOXC surfc: "); + break; + case PLATYPE3: + strcat(buf, "TNTD surfc: "); + break; + case PLATYPE2: + strcat(buf, "THIN surfc: "); + break; + case PLATYPE1: + strcat(buf, "STND surfc: "); + break; + default: + strcat(buf, " surfc: "); + break; + }; + if (k->pl_flags & PLDILYTH) + strcat(buf, "D"); + else + strcat(buf, " "); + if (k->pl_flags & PLMETAL) + strcat(buf, "M"); + else + strcat(buf, " "); + if (k->pl_flags & PLARABLE) + strcat(buf, "A"); + else + strcat(buf, " "); + W_WriteText(infow, W_Textwidth, W_Textheight * line++, planetColor (k), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "Time: %-5d Visit: %c%c%c%c", + ((me->p_team == k->pl_owner) ? 0 : (int) (status2->clock - k->pl_timestamp)), + (k->pl_info & FED ? 'F' : ' '), + (k->pl_info & ROM ? 'R' : ' '), + (k->pl_info & KLI ? 'K' : ' '), + (k->pl_info & ORI ? 'O' : ' ')); + W_WriteText(infow, W_Textwidth, W_Textheight * line++, planetColor (k), + buf, strlen(buf), W_RegularFont); + } + } + else + { + (void) sprintf (buf, "%s", k->pl_name); + W_WriteText (infow, W_Textwidth, W_Textheight * line++, + planetColor (k), buf, strlen (buf), W_RegularFont); + (void) sprintf (buf, "No other info"); + W_WriteText (infow, W_Textwidth, W_Textheight * line++, + planetColor (k), buf, strlen (buf), W_RegularFont); + } +#else /* Too close to the edge? */ if (mx + 23 * W_Textwidth + 2 > windowWidth) mx = windowWidth - 28 * W_Textwidth - 2; @@ -241,8 +403,6 @@ ww, 2, foreColor); W_MapWindow (infow); k = &planets[target->o_num]; - dist = hypot ((double) (me->p_x - k->pl_x), - (double) (me->p_y - k->pl_y)); if ((k->pl_info & me->p_team) #ifdef RECORDGAME || playback @@ -276,9 +436,257 @@ W_WriteText (infow, W_Textwidth, W_Textheight * line++, planetColor (k), buf, strlen (buf), W_RegularFont); } +#endif } } +#ifdef PARADISE +/* + fills the ratings struct pointed to by r with the stats for the player + pointed to by j [BDyess] +*/ +struct ratings * +get_ratings(struct player *j, struct ratings *r) +{ + struct stats2 *s; /* point to player's paradise stats */ + float t, t2; /* temps */ + + s = &(j->p_stats2); + /* fill in kills, losses, and maxkills based on ship type */ + if (j->p_ship.s_type == STARBASE) { + r->r_kills = s->st_sbkills; + r->r_losses = s->st_sblosses; + r->r_maxkills = s->st_sbmaxkills; + } else if (j->p_ship.s_type == WARBASE) { + r->r_kills = s->st_wbkills; + r->r_losses = s->st_wblosses; + r->r_maxkills = s->st_wbmaxkills; + } else { + r->r_kills = s->st_tkills; + r->r_losses = s->st_tlosses; + r->r_maxkills = s->st_tmaxkills; + } + /* calculate ratio */ + r->r_ratio = (r->r_losses != 0) ? r->r_kills / (float) r->r_losses + : r->r_kills; + /* + r->r_ratio = (s->st_tlosses != 0) ? (float) s->st_tkills / (float) + s->st_tlosses : s->st_tkills; + */ + status2->timeprod = status2->timeprod ? status2->timeprod : 1; + t = (float) s->st_tticks / (float) status2->timeprod; /* hour ratio */ + if (t == 0.0) + t = 1.0; + t2 = t * (float) status2->losses; /* get expected losses */ + if(t2 == 0) t2=1; + r->r_defrat = s->st_tlosses / t2; /* calc defense rating */ + + t2 = t * (float) status2->kills; /* get expected kills */ + if(t2 == 0) t2=1; + r->r_offrat = s->st_tkills / t2; /* calc offense rating */ + + t2 = t * (float) status2->armsbomb; /* expected armies bombed */ + if(t2 == 0) t2=1; + r->r_bombrat = (float) s->st_tarmsbomb / t2; /* bomb rating */ + + t2 = t * (float) status2->resbomb; /* expected resources bmbd */ + if(t2 == 0) t2=1; + r->r_resrat = (float) s->st_tresbomb / t2; /* resrce bmbd rating */ + + t2 = t * (float) status2->dooshes; /* expected armies dooshed */ + if(t2 == 0) t2=1; + r->r_dooshrat = (float) s->st_tdooshes / t2; /* doosh rating */ + + r->r_batrat = r->r_dooshrat + r->r_offrat; /* get battle rating */ + + t2 = t * (float) status2->planets; /* expected planets */ + if(t2 == 0) t2=1; + r->r_planetrat = (float) s->st_tplanets / t2; /* get planet rating */ + /* strategy rating */ + r->r_stratrat = r->r_bombrat + r->r_resrat + r->r_planetrat; + /* calculate sb rating */ + t2 = (float) status2->sbkills / (float)( (status2->sblosses > 0) ? status2->sblosses : 1); + if (s->st_sblosses == 0) + r->r_sbrat = 0.0; + else if (t2 == 0) + r->r_sbrat = 99.0; + else + r->r_sbrat = ((float) s->st_sbkills / (float) s->st_sblosses) / t2; + /* calculate wb rating */ + t2 = (float) status2->wbkills / (float)( (status2->wblosses > 0) ? status2->wblosses : 1); + if (s->st_wblosses == 0) + r->r_wbrat = 0.0; + else if (t2 == 0) + r->r_wbrat = 99.0; + else + r->r_wbrat = ((float) s->st_wbkills / (float) s->st_wblosses) / t2; + /* calculate js rating */ + t = (float) s->st_jsticks / (float)( (status2->jstime > 0) ? status2->jstime : 1); + t2 = t * (float) status2->jsplanets; /* get expected js planets */ + if (t2 == 0.0) + r->r_jsrat = 0.0; + else if (t2 == 0) + r->r_jsrat = 99.0; + else + r->r_jsrat = (float) s->st_jsplanets / t2; /* js rating */ + r->r_jsplanets = s->st_jsplanets; /* store js planets */ + + r->r_specrat = r->r_sbrat + r->r_wbrat + r->r_jsrat; /* get special ship + rating */ + /* put the sum of the three major ratings in the 'ratings' slot */ + r->r_ratings = r->r_specrat + r->r_batrat + r->r_stratrat; + r->r_genocides = s->st_genocides; /* get # genocides */ + r->r_di = s->st_di; /* get player's DI */ + t = (s->st_tticks) ? s->st_tticks : (float) 1.0; + r->r_killsPerHour = r->r_kills * (float) 36000.0 / t; + r->r_lossesPerHour = r->r_losses * (float) 36000.0 / t; + r->r_planets = s->st_tplanets; + r->r_armies = s->st_tarmsbomb; + r->r_resources = s->st_tresbomb; + r->r_dooshes = s->st_tdooshes; + /* r->r_jsplanets = s->st_jsplanets; */ + return r; +} + +static void +Info_list_paradise(struct player *j) +{ + char buf[80]; + int line = 0; + struct ratings r; + + get_ratings(j, &r); + + sprintf(buf, "Name: %s", j->p_name); + W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "Rank: %s", ranks2[j->p_stats2.st_rank].name); + W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "Royalty: %s", royal[j->p_stats2.st_royal].name); + W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "Genocides: %4d", r.r_genocides); + W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "DI: %7.2f", r.r_di); + W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "Maxkills:%6.2f", j->p_stats2.st_tmaxkills); + W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "Kills: %4d", j->p_stats2.st_tkills); + W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "Losses: %4d", j->p_stats2.st_tlosses); + W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "T-hours: %6.2f", (float) j->p_stats2.st_tticks / 36000.0); + W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, " "); + W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + strcpy(buf, " Rating Total"); + W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "Bombing: %5.2f %6d", r.r_bombrat, r.r_armies); + W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "Planets: %5.2f %6d", r.r_planetrat, r.r_planets); + W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "Resources: %5.2f %6d", r.r_resrat, r.r_resources); + W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "Dooshes: %5.2f %6d", r.r_dooshrat, r.r_dooshes); + W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "Ratio: %5.2f", j->p_stats2.st_tkills / + ((j->p_stats2.st_tlosses) ? j->p_stats2.st_tlosses : 1.0)); + W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "Offense: %5.2f", r.r_offrat); + W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, " "); + W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "RATINGS"); + W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "Special ships: %7.2f", r.r_specrat); + W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "Battle: %7.2f", r.r_batrat); + W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "Strategy: %7.2f", r.r_stratrat); + W_WriteText(infow, W_Textwidth, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + + line = 1; + sprintf(buf, " "); + W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "JUMPSHIP STATS"); + W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "Planets: %7d", j->p_stats2.st_jsplanets); + W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "Hours: %7.2f", (float) j->p_stats2.st_jsticks / 36000.0); + W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "JS rating: %7.2f", r.r_jsrat); + W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + + sprintf(buf, " "); + W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "STARBASE STATS"); + W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "Kills: %4d", j->p_stats2.st_sbkills); + W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "Losses: %4d", j->p_stats2.st_sblosses); + W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "Hours: %7.2f", (float) j->p_stats2.st_sbticks / 36000.0); + W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "Maxkills: %7.2f", j->p_stats2.st_sbmaxkills); + W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "SB rating: %7.2f", r.r_sbrat); + W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + + sprintf(buf, " "); + W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "WARBASE STATS"); + W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "Kills: %4d", j->p_stats2.st_wbkills); + W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "Losses: %4d", j->p_stats2.st_wblosses); + W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "Hours: %7.2f", (float) j->p_stats2.st_wbticks / 36000.0); + W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "Maxkills: %7.2f", j->p_stats2.st_wbmaxkills); + W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); + sprintf(buf, "WB rating: %7.2f", r.r_wbrat); + W_WriteText(infow, W_Textwidth * 28, W_Textheight * line++, playerColor(j), + buf, strlen(buf), W_RegularFont); +} +#endif /******************************************************************************/ /*** destroyInfo() ***/ Index: enter.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/enter.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- enter.c 7 Jun 2007 04:43:38 -0000 1.13 +++ enter.c 24 Feb 2008 00:33:55 -0000 1.14 @@ -55,14 +55,8 @@ plasmatorps = (struct plasmatorp *) malloc(sizeof(*plasmatorps) * MAXPLAYER * MAXPLASMA); #ifdef PARADISE thingies = (struct thingy *) malloc(sizeof(*thingies) * (MAXPLAYER * npthingies + ngthingies)); - ranks2 = (struct rank2 *) malloc(sizeof(*ranks2) * nranks2); - for (i = 0; i < nranks2; i++) - ranks2[i].name = strdup("blank"); /* independent is teaminfo[-1] */ teaminfo = 1 + (struct teaminfo_s *) malloc(sizeof(*teaminfo) * (number_of_teams + 2)); - royal = (struct royalty *) malloc(sizeof(*royal) * nroyals); - for (i = 0; i < nroyals; i++) - royal[i].name = strdup("blank"); status2 = (struct status2 *) malloc(sizeof(*status2)); #endif status = (struct status *) malloc(sizeof(*status)); @@ -77,6 +71,8 @@ players[i].p_no = i; players[i].p_ntorp = 0; #ifdef PARADISE + players[i].p_stats2.st_rank = 0; + players[i].p_stats2.st_royal = 0; players[i].p_ndrone = 0; #endif players[i].p_explode = 1; Index: playback.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/playback.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- playback.c 16 May 2007 00:05:16 -0000 1.22 +++ playback.c 24 Feb 2008 00:33:56 -0000 1.23 @@ -199,6 +199,9 @@ resetdefaults (); +#ifdef PARADISE + build_default_configuration(); +#endif newwin (display_host, name); savebitmaps (); @@ -518,6 +521,18 @@ case SP_S_KILLS: case SP_S_STATS: case SP_FEATURE: +#ifdef PARADISE + case SP_SCAN: + case SP_STATS2: + case SP_STATUS2: + case SP_PLANET2: + case SP_THINGY: + case SP_THINGY_INFO: + case SP_GPARAM: + case SP_PARADISE_EXT1: + case SP_TERRAIN2: + case SP_TERRAIN_INFO2: +#endif return 1; } Index: cowmain.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/cowmain.c,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- cowmain.c 29 Jul 2007 01:38:41 -0000 1.35 +++ cowmain.c 24 Feb 2008 00:33:55 -0000 1.36 @@ -779,6 +779,9 @@ ind_ship_bmp_HR = stringDefault ("indshipHRbmpfile"); resetdefaults (); +#ifdef PARADISE + build_default_configuration(); +#endif newwin (display_host, name); if (hideConsole) Index: socket.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/socket.c,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- socket.c 7 Jun 2007 04:43:39 -0000 1.36 +++ socket.c 24 Feb 2008 00:33:56 -0000 1.37 @@ -2368,11 +2368,13 @@ LineToConsole ("handlePlyrLogin: bad index %d\n", packet->pnum); return; } +#ifndef PARADISE if (packet->rank >= NUMRANKS) { LineToConsole ("handlePlyrLogin: bad rank %d\n", packet->rank); return; } +#endif packet->name[sizeof (packet->name) - 1] = '\0'; packet->monitor[sizeof (packet->monitor) - 1] = '\0'; packet->login[sizeof (packet->login) - 1] = '\0'; @@ -3201,6 +3203,149 @@ void initialize_ranks(void) { + ranks2 = (struct rank2 *) malloc(sizeof(*ranks2) * nranks2); + ranks2[0].genocides = 0; + ranks2[0].di = 0; + ranks2[0].battle = 0.0; + ranks2[0].strategy = 0.0; + ranks2[0].specship = 0.0; + ranks2[0].name = strdup("Recruit"); + + ranks2[1].genocides = 1; + ranks2[1].di = 10; + ranks2[1].battle = (float) 0.30; + ranks2[1].strategy = (float) 0.3; + ranks2[1].specship = 0.0; + ranks2[1].name = strdup("Specialist"); + + ranks2[2].genocides = 2; + ranks2[2].di = 25; + ranks2[2].battle = (float) 0.40; + ranks2[2].strategy = (float) 0.6; + ranks2[2].specship = 0.0; + ranks2[2].name = strdup("Cadet"); + + ranks2[3].genocides = 3; + ranks2[3].di = 45; + ranks2[3].battle = (float) 0.50; + ranks2[3].strategy = (float) 0.9; + ranks2[3].specship = 0.0; + ranks2[3].name = strdup("Midshipman"); + + ranks2[4].genocides = 4; + ranks2[4].di = 70; + ranks2[4].battle = (float) 0.70; + ranks2[4].strategy = (float) 1.2; + ranks2[4].specship = 0.0; + ranks2[4].name = strdup("Ensn. J.G."); + + ranks2[5].genocides = 5; + ranks2[5].di = 100; + ranks2[5].battle = (float) 0.90; + ranks2[5].strategy = (float) 1.5; + ranks2[5].specship = 0.0; + ranks2[5].name = strdup("Ensign"); + + ranks2[6].genocides = 6; + ranks2[6].di = 140; + ranks2[6].battle = (float) 1.10; + ranks2[6].strategy = (float) 2.0; + ranks2[6].specship = 0.0; + ranks2[6].name = strdup("Lt. J.G."); + + ranks2[7].genocides = 8; + ranks2[7].di = 190; + ranks2[7].battle = (float) 1.30; + ranks2[7].strategy = (float) 2.5; + ranks2[7].specship = 0.0; + ranks2[7].name = strdup("Lieutenant"); + + ranks2[8].genocides = 10; + ranks2[8].di = 250; + ranks2[8].battle = (float) 1.50; + ranks2[8].strategy = (float) 3.0; + ranks2[8].specship = (float) 0.5; + ranks2[8].name = strdup("Lt. Cmdr."); + + ranks2[9].genocides = 15; + ranks2[9].di = 300; + ranks2[9].battle = (float) 1.80; + ranks2[9].strategy = (float) 3.5; + ranks2[9].specship = (float) 0.7; + ranks2[9].name = strdup("Commander"); + + ranks2[10].genocides = 18; + ranks2[10].di = 350; + ranks2[10].battle = (float) 2.00; + ranks2[10].strategy = (float) 4.0; + ranks2[10].specship = (float) 1.0; + ranks2[10].name = strdup("Captain"); + + ranks2[11].genocides = 25; + ranks2[11].di = 400; + ranks2[11].battle = (float) 2.10; + ranks2[11].strategy = (float) 4.3; + ranks2[11].specship = (float) 2.5; + ranks2[11].name = strdup("Fleet Capt."); + + ranks2[12].genocides = 50; + ranks2[12].di = 500; + ranks2[12].battle = (float) 2.15; + ranks2[12].strategy = (float) 4.8; + ranks2[12].specship = (float) 3.0; + ranks2[12].name = strdup("Commodore"); + + ranks2[13].genocides = 75; + ranks2[13].di = 700; + ranks2[13].battle = (float) 2.20; + ranks2[13].strategy = (float) 5.3; + ranks2[13].specship = (float) 3.3; + ranks2[13].name = strdup("Moff"); + + ranks2[14].genocides = 100; + ranks2[14].di = 900; + ranks2[14].battle = (float) 2.25; + ranks2[14].strategy = (float) 5.7; + ranks2[14].specship = (float) 3.6; + ranks2[14].name = strdup("Grand Moff"); + + ranks2[15].genocides = 300; + ranks2[15].di = 1200; + ranks2[15].battle = (float) 2.30; + ranks2[15].strategy = (float) 6.0; + ranks2[15].specship = (float) 3.8; + ranks2[15].name = strdup("Rear Adml."); + + ranks2[16].genocides = 700; + ranks2[16].di = 1700; + ranks2[16].battle = (float) 2.35; + ranks2[16].strategy = (float) 6.1; + ranks2[16].specship = (float) 4.0; + ranks2[16].name = strdup("Admiral"); + + ranks2[17].genocides = 1000; + ranks2[17].di = 2500; + ranks2[17].battle = (float) 2.40; + ranks2[17].strategy = (float) 6.2; + ranks2[17].specship = (float) 4.2; + ranks2[17].name = strdup("Grand Adml."); +} + +void +initialize_royal(void) +{ + royal = (struct royalty *) malloc(sizeof(*royal) * nroyals); + + royal[0].name = strdup("none"); + royal[1].name = strdup("Wesley"); + royal[2].name = strdup("Centurion"); + royal[3].name = strdup("Praetor"); + royal[4].name = strdup("Emperor"); +} + +void +reinitialize_ranks(void) +{ int i; ranks2 = (struct rank2 *) malloc(sizeof(*ranks2) * nranks2); @@ -3210,7 +3355,7 @@ } void -initialize_royal(void) +reinitialize_royal(void) { int i; royal = (struct royalty *) malloc(sizeof(*royal) * nroyals); @@ -3220,6 +3365,12 @@ } } +void +build_default_configuration(void) +{ + initialize_ranks(); + initialize_royal(); +} void resize_players(void) @@ -3358,8 +3509,8 @@ load_generic_teams(); - initialize_ranks(); - initialize_royal(); + reinitialize_ranks(); + reinitialize_royal(); resize_players(); initialize_torps();