Update of /cvsroot/netrek/client/netrekxp/src In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv7387/src Modified Files: dashboard.c local.c warning.c Log Message: Fixed bug with lock icon and orbiting Fixed short packet phaser stats for phaser hits > 1024 damage (only noticeable with ATTs, server sends phaser hit packet as long packet instead) Index: dashboard.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/dashboard.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- dashboard.c 2 Jun 2006 21:06:55 -0000 1.10 +++ dashboard.c 3 Jun 2006 21:52:11 -0000 1.11 @@ -860,6 +860,7 @@ int hulltime = 0; int shieldneeded, hullneeded; float shieldrate = 0.0, hullrate = 0.0; + short planet; struct player *plr; if ((me->p_flags & (PFPLOCK | PFOBSERV)) == (PFPLOCK | PFOBSERV)) @@ -882,9 +883,9 @@ /* And since observers don't get war flags, assume that if ship is orbiting a repair planet in repair mode, the planet is friendly - best we can do until server sends us more info */ - me->p_planet = get_closest_planet(me->p_x, me->p_y); - if ((planets[me->p_planet].pl_flags & PLREPAIR) - &&(obs || !(planets[me->p_planet].pl_owner & (plr->p_swar | plr->p_hostile)))) + planet = get_closest_planet(me->p_x, me->p_y); + if ((planets[planet].pl_flags & PLREPAIR) + &&(obs || !(planets[planet].pl_owner & (plr->p_swar | plr->p_hostile)))) me->p_subshield += me->p_ship.s_repair * 4; } if (me->p_flags & PFDOCK) @@ -904,9 +905,9 @@ /* And since observers don't get war flags, assume that if ship is orbiting a repair planet in repair mode, the planet is friendly - best we can do until server sends us more info */ - me->p_planet = get_closest_planet(me->p_x, me->p_y); - if ((planets[me->p_planet].pl_flags & PLREPAIR) - && (obs || !(planets[me->p_planet].pl_owner & (plr->p_swar | plr->p_hostile)))) + planet = get_closest_planet(me->p_x, me->p_y); + if ((planets[planet].pl_flags & PLREPAIR) + && (obs || !(planets[planet].pl_owner & (plr->p_swar | plr->p_hostile)))) me->p_subdamage += me->p_ship.s_repair * 2; } if (me->p_flags & PFDOCK) Index: local.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/local.c,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- local.c 3 Jun 2006 07:03:42 -0000 1.38 +++ local.c 3 Jun 2006 21:52:11 -0000 1.39 @@ -528,7 +528,7 @@ } if (showArmy && (me->p_flags & PFORBIT) - && (me->p_planet = get_closest_planet(me->p_x, me->p_y)) == l->pl_no) + && (get_closest_planet(me->p_x, me->p_y) == l->pl_no)) { char armbuf[4]; int armbuflen; Index: warning.c =================================================================== RCS file: /cvsroot/netrek/client/netrekxp/src/warning.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- warning.c 20 May 2006 03:55:23 -0000 1.7 +++ warning.c 3 Jun 2006 21:52:11 -0000 1.8 @@ -27,7 +27,7 @@ void warning (char *text) { - int doPhaser, doRefit, doDeclare; + int doPhaser, doRefit, doDeclare, damage = 0; time_t curtime; struct tm *tm; char newtext[128]; @@ -50,16 +50,30 @@ delay = time (0) + DECLARETIME; #ifdef PHASER_STATS - if (!recv_short) /* Gotta parse phaser info for long packets here */ + if (doPhaser) /* Parse out damage */ { - if (strncmp(text, "You destroyed the plasma", 24) == 0) /* Plasma hit */ + char *d; + d = &text[warncount]; + /* find the last number in the string, should be damage */ + while (!isdigit(*d) && d > text) + d--; + while (d > text && isdigit(*d)) + d--; + if (d > text) + damage = atoi(d); + } + /* Gotta parse phaser info for long packets here, or for phaser hits with + damage > 1024, which are sent as a long packet by server */ + if (!recv_short || damage > 1024) + { + if (!recv_short && strncmp(text, "You destroyed the plasma", 24) == 0) /* Plasma hit */ { phaserStatTry++; phaserStatHit++; /* Record as an average damage hit so as not to skew overall average */ phaserStatDamage += phaserStatDamage / phaserStatTry; } - if (strncmp(text, "Phaser missed", 13) == 0) /* Miss */ + if (!recv_short && strncmp(text, "Phaser missed", 13) == 0) /* Miss */ { phaserStatTry++; if (phaserStats) @@ -77,16 +91,6 @@ } if (doPhaser) /* Parse out damage and record to average */ { - char *d; - register int damage; - d = &text[warncount]; - /* find the last number in the string, should be damage */ - while (!isdigit(*d) && d > text) - d--; - while (d > text && isdigit(*d)) - d--; - if (d > text) - damage = atoi(d); phaserStatTry++; phaserStatHit++; phaserStatDamage += damage; @@ -97,7 +101,7 @@ sprintf (newtext, "%s [%3d%%] [%2u]", text, phaserStatTry ? (phaserStatHit * 100) / phaserStatTry : 0, phaserStatTry ? phaserStatDamage / phaserStatTry : 0); - warncount += 13; + warncount += 14; W_WriteText (warnw, 5, 5, textColor, newtext, warncount, W_RegularFont); }