Subversion Repositories svn1

Rev

Rev 48 | Rev 50 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 48 Rev 49
Line 1103... Line 1103...
1103
        **      - Place within the class
1103
        **      - Place within the class
1104
        **      - Team number - with HTML reference to team file
1104
        **      - Team number - with HTML reference to team file
1105
        **      - Class
1105
        **      - Class
1106
        */
1106
        */
1107
 
1107
 
1108
        print( "%4.4s ", pr_place( team_buf.leg[0].lc_place, ptr->flags.bad_times ) );
1108
        print( "%4.4s ", pr_place_ne( team_buf.leg[0].lc_place, ptr->flags.bad_times, ptr->flags.non_equestrian ) );
1109
        if ( report_html ) print( "<A HREF=\"%s#Team_%04d\">", p_filename(filebase, "name" ,"html"), team_buf.numb );
1109
        if ( report_html ) print( "<A HREF=\"%s#Team_%04d\">", p_filename(filebase, "name" ,"html"), team_buf.numb );
1110
        print( "%4d",  team_buf.numb );
1110
        print( "%4d",  team_buf.numb );
1111
        if ( report_html ) print( "</A>" );
1111
        if ( report_html ) print( "</A>" );
1112
        print( " %-*s", 3, team_buf.class == 0 ? "" : config.team_class[team_buf.class - 1].abr );
1112
        print( " %-*s", 3, team_buf.class == 0 ? "" : config.team_class[team_buf.class - 1].abr );
1113
 
1113
 
1114
        for( j = 1; j <= config.num_legs; j++ )
1114
        for( j = 1; j <= config.num_legs; j++ )
1115
        {
1115
        {
1116
            /*
1116
            /*
1117
            **  Ensure that non-equestrian leg data is not displayed
1117
            **  Ensure that non-equestrian leg data is not displayed
1118
            */
1118
            */
1119
            if ( j == config.equestrian_leg && ptr->class == config.nonequestrian_class)
1119
            if ( j == config.equestrian_leg && (ptr->class == config.nonequestrian_class || ptr->flags.non_equestrian) )
1120
            {
1120
            {
1121
                print( "  %-8s %4.4s %4.4s", "-- NE --", "-","-");
1121
                print( "  %-8s %4.4s %4.4s", "-- NE --", "-","-");
1122
            }
1122
            }
1123
            else
1123
            else
1124
            {
1124
            {
1125
                print( "  %-8s %4.4s %4.4s", time_a( team_buf.leg[j].elapsed ),
1125
                print( "  %-8s %4.4s %4.4s", time_a( team_buf.leg[j].elapsed ),
1126
                       pr_place( team_buf.leg[j].lc_place, ptr->flags.bad_times ),
1126
                       pr_place_ne( team_buf.leg[j].lc_place,  ptr->flags.bad_times, ptr->flags.non_equestrian ),
1127
                       pr_place( team_buf.leg[j].lec_place, ptr->flags.bad_times ) );
1127
                       pr_place_ne( team_buf.leg[j].lec_place, ptr->flags.bad_times, ptr->flags.non_equestrian ) );
1128
            }
1128
            }
1129
        }
1129
        }
1130
 
1130
 
1131
        /*
1131
        /*
1132
        **  Print the trailer
1132
        **  Print the trailer
Line 1135... Line 1135...
1135
        */
1135
        */
1136
        /* print( "  %-8s ", time_a( team_buf.leg[0].elapsed ) ); */
1136
        /* print( "  %-8s ", time_a( team_buf.leg[0].elapsed ) ); */
1137
        print( "  %-8s ", time_a( ptr->lege[0] ) );
1137
        print( "  %-8s ", time_a( ptr->lege[0] ) );
1138
 
1138
 
1139
        if ( report_html ) print( "<A HREF=\"%s#Team_%04d\">", p_filename(filebase, "finish" ,"html"), team_buf.numb );
1139
        if ( report_html ) print( "<A HREF=\"%s#Team_%04d\">", p_filename(filebase, "finish" ,"html"), team_buf.numb );
1140
        print( "%4.4s", pr_place( team_buf.leg[0].l_place, ptr->flags.bad_times | (ptr->class == config.nonequestrian_class) ) );
1140
        print( "%4.4s", pr_place_ne( team_buf.leg[0].l_place, ptr->flags.bad_times | (ptr->class == config.nonequestrian_class), ptr->flags.non_equestrian ) );
1141
        if ( report_html ) print( "</A>" );
1141
        if ( report_html ) print( "</A>" );
1142
 
1142
 
1143
        print( "\n" );
1143
        print( "\n" );
1144
    }
1144
    }
1145
 
1145
 
Line 2539... Line 2539...
2539
 
2539
 
2540
    for( i = 0; i <= config.num_legs; i++ )
2540
    for( i = 0; i <= config.num_legs; i++ )
2541
    {
2541
    {
2542
        /*
2542
        /*
2543
        **  Sort on leg elapsed time
2543
        **  Sort on leg elapsed time
2544
        **  The save the teams elapsed place in each leg
2544
        **  Then save the teams elapsed place in each leg
2545
        */
2545
        */
2546
        sort_team_data( i, S_L );
2546
        sort_team_data( i, S_L );
2547
        for( j = 1, ptr = sort_data; j <= sort_num; j++, ptr++ )
2547
        for( j = 1, k = 1, ptr = sort_data; j <= sort_num; ptr++, j++ )
2548
        {
2548
        {
-
 
2549
            if ( ptr->class == config.nonequestrian_class )
-
 
2550
                continue;
-
 
2551
            
2549
            sort_aux[ptr->team].l_place[i] = j;
2552
            sort_aux[ptr->team].l_place[i] = k++;
2550
            sort_aux[ptr->team].team = ptr->team;
2553
            sort_aux[ptr->team].team = ptr->team;
2551
        }
2554
        }
2552
 
2555
 
2553
        /*
2556
        /*
2554
        **  Sort on leg end time
2557
        **  Sort on leg end time
2555
        **  Then save the teams place at the end of each leg
2558
        **  Then save the teams place at the end of each leg
2556
        */
2559
        */
2557
        sort_team_data( i, S_LE );
2560
        sort_team_data( i, S_LE );
2558
        for( j = 1, ptr = sort_data; j <= sort_num; j++, ptr++ )
2561
        for( j = 1, k = 1, ptr = sort_data; j <= sort_num; ptr++, j++ )
-
 
2562
        {
-
 
2563
            if ( ptr->class == config.nonequestrian_class )
-
 
2564
                continue;
-
 
2565
            
2559
            sort_aux[ptr->team].le_place[i] = j;
2566
            sort_aux[ptr->team].le_place[i] = k++;
-
 
2567
        }
2560
 
2568
 
2561
        /*
2569
        /*
2562
        **  Sort on elapsed time per class
2570
        **  Sort on elapsed time per class
2563
        **  The save the teams elapsed place in each leg per class
2571
        **  The save the teams elapsed place in each leg per class
2564
        */
2572
        */
Line 2701... Line 2709...
2701
    */
2709
    */
2702
    if( sort_mode == S_LEC || sort_mode == S_LC )   /* Sort within a class */
2710
    if( sort_mode == S_LEC || sort_mode == S_LC )   /* Sort within a class */
2703
        if( a->class != b->class )
2711
        if( a->class != b->class )
2704
            return ( a->class - b->class );
2712
            return ( a->class - b->class );
2705
 
2713
 
-
 
2714
#if 1
-
 
2715
    /*
-
 
2716
    **  Always put the nonequestrian_class at the end
-
 
2717
    **  Simplifies the creation of ordered lists as these
-
 
2718
    **  Entries are not present in the main body
-
 
2719
    */
-
 
2720
    if ( a->class == config.nonequestrian_class ||  b->class == config.nonequestrian_class )
-
 
2721
    {
-
 
2722
        if ( a->class == config.nonequestrian_class &&  b->class == config.nonequestrian_class )
-
 
2723
        {
-
 
2724
        }
-
 
2725
        else
-
 
2726
        {
-
 
2727
            return ( a->class == config.nonequestrian_class ? 1 : -1 );
-
 
2728
        }
-
 
2729
 
-
 
2730
    }
-
 
2731
#endif
-
 
2732
 
2706
    /*
2733
    /*
2707
    **  Now we need to examine the times as we have sorted
2734
    **  Now we need to examine the times as we have sorted
2708
    **  on every thing else.
2735
    **  on every thing else.
2709
    **
2736
    **
2710
    **  If one of the teams has bad_times, then that team is placed
2737
    **  If one of the teams has bad_times, then that team is placed
Line 2716... Line 2743...
2716
    **  is better than a bad time. Places NE before disqualified
2743
    **  is better than a bad time. Places NE before disqualified
2717
    **
2744
    **
2718
    **
2745
    **
2719
    **  Note: NE also have bad_times set
2746
    **  Note: NE also have bad_times set
2720
    */
2747
    */
2721
 
2748
#if 1
2722
    if( a->flags.bad_times || b->flags.bad_times )  /* Valid data has precedence */
2749
    if( a->flags.bad_times || b->flags.bad_times )  /* Valid data has precedence */
2723
    {
2750
    {
2724
        if( a->flags.bad_times && b->flags.bad_times )
2751
        if( a->flags.bad_times && b->flags.bad_times )
2725
        {
2752
        {
2726
            if( sort_mode == S_LE || sort_mode == S_L ) /* Sort NOT within a class */
2753
            if( sort_mode == S_LE || sort_mode == S_L || 1 ) /* Sort NOT within a class */
2727
            {
2754
            {
2728
                if( a->flags.non_equestrian || b->flags.non_equestrian )
2755
                if( a->flags.non_equestrian || b->flags.non_equestrian )
2729
                {
2756
                {
2730
                    if( a->flags.non_equestrian && b->flags.non_equestrian )
2757
                    if( a->flags.non_equestrian && b->flags.non_equestrian )
2731
                    {
2758
                    {
2732
                        /*
2759
                        /*
2733
                        **  Both are non equestrian
2760
                        **  Both are non equestrian
2734
                        **  Let the time sort operate ...
2761
                        **  Let the time sort operate ...
2735
                        */
2762
                        */
2736
    //                    return ( a->team - b->team );
2763
                        //return ( a->team - b->team );
2737
                    }
2764
                    }
2738
                    else
2765
                    else
2739
                    {
2766
                    {
2740
                        /* Good times better than NE */
2767
                        /* Good times better than NE */
2741
                        return ( a->flags.non_equestrian ? -1 : 1 );
2768
                        return ( a->flags.non_equestrian ? -1 : 1 );
Line 2746... Line 2773...
2746
               return ( a->team - b->team );
2773
               return ( a->team - b->team );
2747
        }
2774
        }
2748
        else
2775
        else
2749
            return ( a->flags.bad_times ? 1 : -1 );
2776
            return ( a->flags.bad_times ? 1 : -1 );
2750
    }
2777
    }
-
 
2778
#else
-
 
2779
    if( a->flags.bad_times || b->flags.bad_times )  /* Valid data has precedence */
-
 
2780
    {
-
 
2781
        if( a->flags.bad_times && b->flags.bad_times )
-
 
2782
            return ( a->team - b->team );
-
 
2783
        else
-
 
2784
            return ( a->flags.bad_times ? 1 : -1 );
-
 
2785
    }
2751
 
2786
 
-
 
2787
    /*
-
 
2788
    **  Not sorting within a class ie: Overall
-
 
2789
    **  Non-Equestrian is at the end, so that it doesn't get counted in the
-
 
2790
    **  finishing order
-
 
2791
    */
-
 
2792
    if( sort_mode == S_LE || sort_mode == S_L )     /* Sort NOT within a class */
-
 
2793
    {
-
 
2794
        if( a->flags.non_equestrian || b->flags.non_equestrian )
-
 
2795
        {
-
 
2796
            if( a->flags.non_equestrian && b->flags.non_equestrian )
-
 
2797
                return ( a->team - b->team );
-
 
2798
            else
-
 
2799
                return ( a->flags.non_equestrian ? 1 : -1 );
-
 
2800
        }
-
 
2801
    }
-
 
2802
#endif
2752
 
2803
 
2753
    /*
2804
    /*
2754
    **  Before we sort on times we must determine which time to
2805
    **  Before we sort on times we must determine which time to
2755
    **  use. Finish time, Leg end times, Leg Elapsed times.
2806
    **  use. Finish time, Leg end times, Leg Elapsed times.
2756
    */
2807
    */
Line 2975... Line 3026...
2975
                **  If non-equestrian support is enabled then
3026
                **  If non-equestrian support is enabled then
2976
                **  duplicate and modify data for the non-equestrian teams
3027
                **  duplicate and modify data for the non-equestrian teams
2977
                **      - Change the class
3028
                **      - Change the class
2978
                **      - Modify the leg time
3029
                **      - Modify the leg time
2979
                */
3030
                */
-
 
3031
#if 1
2980
                if ( config.nonequestrian_class && team_buf.flags.non_equestrian )
3032
                if ( config.nonequestrian_class && team_buf.flags.non_equestrian )
2981
                {
3033
                {
2982
                    ptr->team = team;
3034
                    ptr->team = team;
2983
                    ptr->lege[0] = 0;
3035
                    ptr->lege[0] = 0;
2984
 
3036
 
Line 3007... Line 3059...
3007
 
3059
 
3008
 
3060
 
3009
                    ptr++;
3061
                    ptr++;
3010
                    sort_num++;
3062
                    sort_num++;
3011
                }
3063
                }
-
 
3064
#endif
3012
            }
3065
            }
3013
        }
3066
        }
3014
    }
3067
    }
3015
    return ( TRUE );
3068
    return ( TRUE );
3016
}
3069
}