Date: Saturday November 4, 2000 @ 17:49 Author: ahn Update of /home/netrek/cvsroot/Vanilla/robots In directory swashbuckler.fortress.real-time.com:/var/tmp/cvs-serv5131 Modified Files: inl.c inlcomm.c Log Message: * robots/inl*.c: Fix INL robot core dump. Fix bugs in continuous scoring. **************************************** Index: Vanilla/robots/inl.c diff -u Vanilla/robots/inl.c:1.33 Vanilla/robots/inl.c:1.34 --- Vanilla/robots/inl.c:1.33 Tue Oct 31 23:51:43 2000 +++ Vanilla/robots/inl.c Sat Nov 4 17:49:40 2000 @@ -1,7 +1,7 @@ -/* $Id: inl.c,v 1.33 2000/11/01 05:51:43 ahn Exp $ */ +/* $Id: inl.c,v 1.34 2000/11/04 23:49:40 ahn Exp $ */ #ifndef lint -static char vcid[] = "$Id: inl.c,v 1.33 2000/11/01 05:51:43 ahn Exp $"; +static char vcid[] = "$Id: inl.c,v 1.34 2000/11/04 23:49:40 ahn Exp $"; #endif /* lint */ /* @@ -743,6 +743,8 @@ double divisor = inl_stat.weighted_divisor; double delta; + countplanets(); + /* NORMAL scoring mode; OR, continuous scoring and in OT. Use absolute planet count. */ if ((inl_stat.score_mode == 0) || (inl_stat.flags & S_OVERTIME)) { @@ -790,18 +792,17 @@ int game_over = 0; int win_cond; - countplanets(); if ((win_cond = check_winner()) != 0) { pmessage(0, MALL, inl_from, "---------- Game Over ----------"); - pmessage(0, MALL, inl_from, "Result: %i - %i - %i", + pmessage(0, MALL, inl_from, "Planet count: %i - %i - %i", inl_teams[HOME].planets, inl_teams[AWAY].planets, (20 - inl_teams[HOME].planets - inl_teams[AWAY].planets)); /* need to write this to the inl_log because the pmessages don't get flushed out to the log before the close */ - fprintf(inl_log, "----------- Game Over ------------\n"); - fprintf(inl_log, "Result: %i - %i - %i\n", + fprintf(inl_log, "---------- Game Over ---------\n"); + fprintf(inl_log, "SCORE: Planet count: %i - %i - %i\n", inl_teams[HOME].planets, inl_teams[AWAY].planets, (20 - inl_teams[HOME].planets - inl_teams[AWAY].planets)); @@ -809,20 +810,20 @@ switch(win_cond) { case 1: - pmessage(0, MALL, inl_from, "Winning condition: planet count"); - fprintf(inl_log, "Winning condition: planet count\n"); + pmessage(0, MALL, inl_from, "Victory by: planet count (normal scoring)"); + fprintf(inl_log, "SCORE: Victory by planet count (normal scoring)\n"); break; case 2: - pmessage(0, MALL, inl_from, "Winning condition: continuous score >= 2.0"); - fprintf(inl_log, "Winning condition: continuous score >= 2.0\n"); + pmessage(0, MALL, inl_from, "Victory by: continuous score >= 2.0"); + fprintf(inl_log, "SCORE: Victory by: continuous score >= 2.0\n"); break; case 3: - pmessage(0, MALL, inl_from, "Winning condition: score < 2.0, planet count"); - fprintf(inl_log, "Winning condition: score < 2.0, planet count\n"); + pmessage(0, MALL, inl_from, "Victory by: planet count (continuous score < 2.0)"); + fprintf(inl_log, "SCORE: Victory by: planet count (continuous score < 2.0)\n"); break; default: - pmessage(0, MALL, inl_from, "Winning condition: UNKNOWN"); - fprintf(inl_log, "Winning condition: UNKNOWN\n"); + pmessage(0, MALL, inl_from, "Victory by: UNKNOWN"); + fprintf(inl_log, "SCORE: Victory by: UNKNOWN\n"); break; } @@ -834,6 +835,7 @@ inl_stat.flags &= ~(S_TOURNEY | S_COUNTDOWN); inl_stat.flags |= S_OVERTIME; pmessage(0, MALL, inl_from, "---------- Overtime ----------"); + fprintf(inl_log, "---------- Overtime ---------\n"); obliterate(0,KPROVIDENCE); inl_game.idx = 0; @@ -841,11 +843,23 @@ /* inl_game.counts[0] = inl_stat.overtime / (PERMIN*2); */ inl_game.message = "%i %s left in overtime"; + fprintf(inl_log, "SCORE: Planet count: %i - %i - %i\n", + inl_teams[HOME].planets, inl_teams[AWAY].planets, + (20 - inl_teams[HOME].planets - inl_teams[AWAY].planets)); + + announce_scores(0, MALL, inl_log); } else if (inl_game.end <= inl_stat.game_ticks) { pmessage(0, MALL, inl_from, "------ Game ran out of time without a winner ------"); + + fprintf(inl_log, "---------- Game Over (TIED) ---------\n"); + fprintf(inl_log, "SCORE: Planet count: %i - %i - %i\n", + inl_teams[HOME].planets, inl_teams[AWAY].planets, + (20 - inl_teams[HOME].planets - inl_teams[AWAY].planets)); + + announce_scores(0, MALL, inl_log); game_over = 1; } Index: Vanilla/robots/inlcomm.c diff -u Vanilla/robots/inlcomm.c:1.18 Vanilla/robots/inlcomm.c:1.19 --- Vanilla/robots/inlcomm.c:1.18 Tue Oct 31 23:51:43 2000 +++ Vanilla/robots/inlcomm.c Sat Nov 4 17:49:40 2000 @@ -1033,6 +1033,7 @@ void announce_scores(int who, int flag, FILE *fp) { int win_cond; + char *side; float divisor = (float) (inl_stat.game_ticks * 4); @@ -1042,15 +1043,20 @@ if (inl_stat.weighted_divisor < 1.0) return; + if (inl_stat.score_mode == 0) + pmessage(who, flag, addr_mess(who, flag), "Scoring mode: planet count"); + else + pmessage(who, flag, addr_mess(who, flag), "Scoring mode: continuous score"); + pmessage(who, flag, addr_mess(who, flag), - "Score: %s vs %s %.2f - %.2f (weighted)", + "Continuous score: %s vs %s %.2f - %.2f (weighted)", sides[inl_teams[0].side_index].name, sides[inl_teams[1].side_index].name, (float) inl_teams[0].weighted_score / inl_stat.weighted_divisor, (float) inl_teams[1].weighted_score / inl_stat.weighted_divisor); if (fp) - fprintf("Score: %s vs %s %.2f - %.2f (weighted)\n", + fprintf(fp, "SCORE: Continuous score: %s vs %s %.2f - %.2f (weighted)\n", sides[inl_teams[0].side_index].name, sides[inl_teams[1].side_index].name, (float) inl_teams[0].weighted_score / inl_stat.weighted_divisor, @@ -1081,38 +1087,38 @@ (float) inl_teams[1].semi_score / divisor); ******/ - - - if ((win_cond = check_winner()) != 0) { - char *side; + win_cond = check_winner(); - side = (inl_teams[0].weighted_score > inl_teams[1].weighted_score)? - sides[inl_teams[0].side_index].name: - sides[inl_teams[1].side_index].name; - - switch(win_cond) { - case 1: - /* ignore NORMAL scoring mode */ - break; - case 2: - pmessage(who, flag, addr_mess(who, flag), - "%s is winning by score >= 2.0", side); - if (fp) - fprintf(fp, "%s is winning by score >= 2.0\n", side); - break; - case 3: - pmessage(who, flag, addr_mess(who, flag), - "%s is winning by score < 2.0 but planet > 11-8-1", side); - if (fp) - fprintf(fp, "%s is winning by score < 2.0 but planet > 11-8-1\n", side); - break; - } - } - else { - pmessage(who, flag, addr_mess(who, flag), "Game is tied."); - if (fp) - fprintf(fp, "Game is tied\n"); + side = (inl_teams[0].weighted_score > inl_teams[1].weighted_score)? + sides[inl_teams[0].side_index].name: + sides[inl_teams[1].side_index].name; + + switch(win_cond) { + case 0: + if (inl_stat.score_mode) { + pmessage(who, flag, addr_mess(who, flag), "Game TIED."); + + if (fp) fprintf(fp, "SCORE: Game TIED.\n"); + } + break; + case 1: + pmessage(who, flag, addr_mess(who, flag), + "%s winning by planet count", side); + /* ignore NORMAL scoring mode */ + break; + case 2: + pmessage(who, flag, addr_mess(who, flag), + "%s winning by score >= 2.0", side); + if (fp) + fprintf(fp, "SCORE: %s winning by score >= 2.0\n", side); + break; + case 3: + pmessage(who, flag, addr_mess(who, flag), + "%s winning by score < 2.0 but planet > 11-8-1", side); + if (fp) + fprintf(fp, "SCORE: %s winning by score < 2.0 but planet > 11-8-1\n", side); + break; } }