+ if (value[A] <= strat->value[A] &&
+ value[P] <= strat->value[P])
+ return value[A];
+
+ debugf(" SOMEHOW BEST\n");
+
+ fildebugf("final %d:%3d mid %d ",finarch,finisle,midarch);
+
+ for (ap=0; ap<AP; ap++) {
+ fildebugf("ap=%d %15f", ap, value[ap]);
+ if (value[ap] < strat->value[ap]) {
+ debugf(" ");
+ } else {
+ int pos;
+ ctr_newbests_strat[ap]++;
+ strat->value[ap]= value[ap];
+ memcpy(strat->ports[ap], ports, sizeof(*ports) * nports);
+ if (nports < MAX_ROUTELEN-1) strat->ports[ap][nports]= -1;
+ fildebugf("** ");
+ for (pos=0; pos < nhighscores[ap]; pos++)
+ if (highscores[ap][pos].pr == strat) goto found;
+ /* not found */
+ pos= -1;
+ found:
+ for (;;) {
+ pos++;
+ if (pos >= nhighscores[ap]-1) break; /* new top */
+ if (highscores[ap][pos].value >= value[ap]) break; /* found spot */
+ if (pos>0)
+ highscores[ap][pos-1]= highscores[ap][pos];
+ }
+ pos--;
+ if (pos>0) {
+ highscores[ap][pos].value= value[ap];
+ highscores[ap][pos].pr= strat;
+ }
+ fildebugf("@%2d", pos);
+ }
+ }