Subversion Repositories svn1-original

Rev

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

Rev 337 Rev 338
Line 769... Line 769...
769
    unsigned    i;
769
    unsigned    i;
770
    int         j, last_class;
770
    int         j, last_class;
771
    char        *report_title;
771
    char        *report_title;
772
    bool        class_done[MAX_CLASS+1];
772
    bool        class_done[MAX_CLASS+1];
773
    int         lcount;
773
    int         lcount;
-
 
774
    bool        isNeClass = false;
-
 
775
 
774
 
776
 
775
    if( ck_data( -1, C_ELAPSED ) )
777
    if( ck_data( -1, C_ELAPSED ) )
776
        return;
778
        return;
777
    /*
779
    /*
778
    **  Sort on every thing
780
    **  Sort on every thing
Line 801... Line 803...
801
            continue;
803
            continue;
802
 
804
 
803
        g_record( ptr->team, &team_buf );
805
        g_record( ptr->team, &team_buf );
804
 
806
 
805
        /*
807
        /*
-
 
808
        ** If this is a NE team then dummy up some of the data that hasn't been stored in team_buf
-
 
809
        */
-
 
810
        if (ptr->flags.non_equestrian)
-
 
811
        {
-
 
812
            team_buf.leg[0].l_place = sort_aux[ptr->team].lq_place[0];
-
 
813
            team_buf.leg[0].lc_place = sort_aux[ptr->team].leq_place[0];;
-
 
814
        }
-
 
815
 
-
 
816
        /*
806
        **  If printing an HTML report then we need to mark
817
        **  If printing an HTML report then we need to mark
807
        **  the entry with a reference so that we can link to it
818
        **  the entry with a reference so that we can link to it
808
        */
819
        */
809
        if ( report_html == html )
820
        if ( report_html == html )
810
        {
821
        {
Line 859... Line 870...
859
        */
870
        */
860
//        print( "  %-8s ",  time_a( team_buf.leg[0].elapsed ) );
871
//        print( "  %-8s ",  time_a( team_buf.leg[0].elapsed ) );
861
        print( "  %-8s ", time_a( ptr->lege[0] ) );
872
        print( "  %-8s ", time_a( ptr->lege[0] ) );
862
        
873
        
863
        if ( report_html == html ) print( "<A HREF=\"%s#Team_%04d\">",url_encode(p_filename(filebase, config.team_class[team_buf.teamclass - 1].abr ,"html")), team_buf.numb );
874
        if ( report_html == html ) print( "<A HREF=\"%s#Team_%04d\">",url_encode(p_filename(filebase, config.team_class[team_buf.teamclass - 1].abr ,"html")), team_buf.numb );
864
        print( "%-4.4s", pr_place( team_buf.leg[0].lc_place, ptr->flags.bad_times ) );
875
        print( "%-4.4s", pn_place( team_buf.leg[0].lc_place, ptr->flags.bad_times, ptr->flags.non_equestrian ) );
865
        if ( report_html == html ) print( "</A>" );
876
        if ( report_html == html ) print( "</A>" );
866
        if ( report_html == printed && lcount %5 == 4 ) print_underline( FALSE );
877
        if ( report_html == printed && lcount %5 == 4 ) print_underline( FALSE );
867
        lcount++;
878
        lcount++;
868
        print( "\n" );
879
        print( "\n" );
869
    }
880
    }
Line 875... Line 886...
875
    /*
886
    /*
876
     * Now produce a breakdown on a class by class basis 
887
     * Now produce a breakdown on a class by class basis 
877
     * Now print out the class placement information
888
     * Now print out the class placement information
878
     */
889
     */
879
 
890
 
880
    sort_team_data( 0, S_LC, true );                 /* Generate class placement data */
891
    sort_team_data( 0, S_LC, true );           /* Generate class placement data */
881
    last_class = -1;                           /* Invalid class to start with */
892
    last_class = -1;                           /* Invalid class to start with */
882
    memset ( class_done, 0, sizeof(class_done));
893
    memset ( class_done, 0, sizeof(class_done));
883
 
894
 
884
 
895
 
885
    for( ptr = sort_data, i = 0; i < sort_num; i++, ptr++ )
896
    for( ptr = sort_data, i = 0; i < sort_num; i++, ptr++ )
Line 900... Line 911...
900
                print_class_stats( last_class, TRUE );
911
                print_class_stats( last_class, TRUE );
901
                print_legend( last_class, 1 );
912
                print_legend( last_class, 1 );
902
                close_printer();
913
                close_printer();
903
            }
914
            }
904
 
915
 
-
 
916
            /*
-
 
917
            ** Determine if this the crazy dummy Non-equestrian class
-
 
918
            */
-
 
919
            isNeClass = (ptr->teamclass == config.nonequestrian_class );
-
 
920
 
905
            report_title = tprintf( "Category results for : %-*s", LEN_CLASS_NAME, ptr->teamclass == 0 ? "" : config.team_class[ptr->teamclass - 1].full_name );
921
            report_title = tprintf( "Category results for : %-*s", LEN_CLASS_NAME, ptr->teamclass == 0 ? "" : config.team_class[ptr->teamclass - 1].full_name );
906
 
922
 
907
            if( !open_printer( "", config.team_class[ptr->teamclass - 1].abr, 132, report_html, report_title ) )
923
            if( !open_printer( "", config.team_class[ptr->teamclass - 1].abr, 132, report_html, report_title ) )
908
                continue;
924
                continue;
909
            print_class_header( last_class = ptr->teamclass, TRUE );
925
            print_class_header( last_class = ptr->teamclass, TRUE );
Line 921... Line 937...
921
        g_record( ptr->team, &team_buf );
937
        g_record( ptr->team, &team_buf );
922
        flags = ptr->flags.bad_times;
938
        flags = ptr->flags.bad_times;
923
        eflags = (ptr->teamclass != config.nonequestrian_class && ptr->flags.non_equestrian);
939
        eflags = (ptr->teamclass != config.nonequestrian_class && ptr->flags.non_equestrian);
924
 
940
 
925
        /*
941
        /*
-
 
942
        ** Dummy up the data for the dummy nonEquestrian Class
-
 
943
        ** Its not stored in the team_buf for backwards compatability
-
 
944
        */
-
 
945
        if( isNeClass)
-
 
946
        {
-
 
947
            for( j = 0; j <= config.num_legs; j++ )
-
 
948
            {
-
 
949
                team_buf.leg[j].lc_place = sort_aux[ptr->team].lq_place[j];
-
 
950
                team_buf.leg[j].lec_place = sort_aux[ptr->team].leq_place[j];;
-
 
951
            }
-
 
952
        }
-
 
953
        else
-
 
954
        {
-
 
955
            if (ptr->flags.non_equestrian)
-
 
956
            {
-
 
957
                team_buf.leg[0].lc_place = sort_aux[ptr->team].lq_place[0];
-
 
958
                team_buf.leg[0].lec_place = sort_aux[ptr->team].leq_place[0];
-
 
959
                //eflags = false;
-
 
960
            }
-
 
961
        }
-
 
962
 
-
 
963
 
-
 
964
        /*
926
        **  If printing an HTML report then we need to mark
965
        **  If printing an HTML report then we need to mark
927
        **  the entry with a reference so that we can link to it
966
        **  the entry with a reference so that we can link to it
928
        */
967
        */
929
        if ( report_html == html )
968
        if ( report_html == html )
930
            print( "<A NAME=\"Team_%04d\"></A>",team_buf.numb );
969
            print( "<A NAME=\"Team_%04d\"></A>",team_buf.numb );
Line 970... Line 1009...
970
        */
1009
        */
971
        /* print( "  %-8s ", time_a( team_buf.leg[0].elapsed ) ); */
1010
        /* print( "  %-8s ", time_a( team_buf.leg[0].elapsed ) ); */
972
        print( "  %-8s ", time_a( ptr->lege[0] ) );
1011
        print( "  %-8s ", time_a( ptr->lege[0] ) );
973
 
1012
 
974
        if ( report_html == html ) print( "<A HREF=\"%s#Team_%04d\">", url_encode(p_filename(filebase, "finish" ,"html")), team_buf.numb );
1013
        if ( report_html == html ) print( "<A HREF=\"%s#Team_%04d\">", url_encode(p_filename(filebase, "finish" ,"html")), team_buf.numb );
975
        print( "%4.4s", pn_place( team_buf.leg[0].l_place, flags , (ptr->teamclass == config.nonequestrian_class && ptr->flags.non_equestrian)));
1014
        print( "%4.4s", pn_place( team_buf.leg[0].l_place, flags , ptr->flags.non_equestrian));
976
        if ( report_html == html ) print( "</A>" );
1015
        if ( report_html == html ) print( "</A>" );
977
 
1016
 
978
        if ( report_html == printed && lcount %5 == 4 ) print_underline( FALSE );
1017
        if ( report_html == printed && lcount %5 == 4 ) print_underline( FALSE );
979
        lcount++;
1018
        lcount++;
980
        print( "\n" );
1019
        print( "\n" );
Line 2887... Line 2926...
2887
 *
2926
 *
2888
 *========================================================================*/
2927
 *========================================================================*/
2889
 
2928
 
2890
void do_big_sort(void)
2929
void do_big_sort(void)
2891
{
2930
{
2892
    int         i, k;                            /* Looooopy things */
2931
    int         i, k, q;                             /* Looooopy things */
2893
    unsigned    j;
2932
    unsigned    j;
2894
    ty_s_data  *ptr;                             /* Pointer to sort data */
2933
    ty_s_data  *ptr;                                 /* Pointer to sort data */
2895
    int         teamclass;                           /* Current class */
2934
    int         teamclass;                           /* Current class */
-
 
2935
    int         teamclassq;                          /* Current class */
2896
    team_type   team_buf;
2936
    team_type   team_buf;
2897
 
2937
 
2898
    for( i = 0; i <= config.num_legs; i++ )
2938
    for( i = 0; i <= config.num_legs; i++ )
2899
    {
2939
    {
2900
        bool sortWithEq =  (i == 0);
2940
        bool sortWithEq =  (i == 0);
-
 
2941
 
2901
        /*
2942
        /*
2902
        **  Sort on leg elapsed time
2943
        **  Sort on leg elapsed time
2903
        **  Then save the teams elapsed place in each leg
2944
        **  Then save the teams elapsed place in each leg
2904
        */
2945
        */
2905
        sort_team_data( i, S_L, sortWithEq );
2946
        sort_team_data( i, S_L, sortWithEq );
2906
        for( j = 1, k = 1, ptr = sort_data; j <= sort_num; ptr++, j++ )
2947
        for( j = 1, k = 1, q = 1, ptr = sort_data; j <= sort_num; ptr++, j++ )
2907
        {
2948
        {
2908
            if (ptr->isNeData)
-
 
2909
                continue;
-
 
2910
//            if ( ptr->teamclass == config.nonequestrian_class && i == config.equestrian_leg )
-
 
2911
//                continue;
-
 
2912
 
-
 
2913
            sort_aux[ptr->team].l_place[i] = k++;
-
 
2914
            sort_aux[ptr->team].team = ptr->team;
2949
            sort_aux[ptr->team].team = ptr->team;
-
 
2950
 
-
 
2951
            if (ptr->isNeData) {
-
 
2952
                sort_aux[ptr->team].lq_place[i] = q++;
-
 
2953
            } else {
-
 
2954
                sort_aux[ptr->team].l_place[i] = k++;
-
 
2955
            }
2915
        }
2956
        }
2916
 
2957
 
2917
        /*
2958
        /*
2918
        **  Sort on leg end time
2959
        **  Sort on leg end time
2919
        **  Then save the teams place at the end of each leg
2960
        **  Then save the teams place at the end of each leg
2920
        */
2961
        */
2921
        sort_team_data( i, S_LE, sortWithEq);
2962
        sort_team_data( i, S_LE, sortWithEq);
2922
        for( j = 1, k = 1, ptr = sort_data; j <= sort_num; ptr++, j++ )
2963
        for( j = 1, k = 1, q = 1, ptr = sort_data; j <= sort_num; ptr++, j++ )
2923
        {
2964
        {
2924
            if (ptr->isNeData)
2965
            if (ptr->isNeData) {
-
 
2966
                sort_aux[ptr->team].leq_place[i] = q++;
-
 
2967
            }
2925
                continue;
2968
            else {
2926
 
2969
 
2927
            //if ( ptr->teamclass == config.nonequestrian_class && i == config.equestrian_leg )
-
 
2928
            //    continue;
2970
                sort_aux[ptr->team].le_place[i] = k++;
2929
            
2971
            }
2930
            sort_aux[ptr->team].le_place[i] = k++;
-
 
2931
        }
2972
        }
2932
 
2973
 
2933
        /*
2974
        /*
2934
        **  Sort on elapsed time per class
2975
        **  Sort on elapsed time per class
2935
        **  The save the teams elapsed place in each leg per class
2976
        **  Then save the teams elapsed place in each leg per class
2936
        */
2977
        */
2937
        sort_team_data( i, S_LC, sortWithEq );
2978
        sort_team_data( i, S_LC, sortWithEq );
2938
        teamclass = -1;
2979
        teamclass = -1;
-
 
2980
        teamclassq = -1;
2939
        for( k = 1, j = 1, ptr = sort_data; j <= sort_num; j++, ptr++ )
2981
        for( k = 1, j = 1, q = 1, ptr = sort_data; j <= sort_num; j++, ptr++ )
2940
        {
2982
        {
-
 
2983
            bool isNe = false;
2941
            if ( sortWithEq && ptr->teamclass == config.nonequestrian_class  ) {
2984
            if ( sortWithEq && ptr->teamclass == config.nonequestrian_class  ) {
2942
                if ( !ptr->isNeData)
2985
                if ( !ptr->isNeData)
2943
                    continue;
2986
                    isNe = true;
2944
            }
2987
            }
2945
            else {
2988
            else {
2946
                if (ptr->isNeData)
2989
                if (ptr->isNeData)
2947
                    continue;
2990
                    isNe = true;
2948
            }
2991
            }
2949
 
2992
 
-
 
2993
            if (isNe) {
2950
            if( teamclass != ptr->teamclass )
2994
                if( teamclassq != ptr->teamclass )
-
 
2995
                {
-
 
2996
                    q = 1;
-
 
2997
                    teamclassq = ptr->teamclass;
-
 
2998
                }
-
 
2999
                sort_aux[ptr->team].lq_place[i] = q++;
-
 
3000
 
2951
            {
3001
            }
-
 
3002
            else {
-
 
3003
 
-
 
3004
                if( teamclass != ptr->teamclass )
-
 
3005
                {
2952
                k = 1;
3006
                    k = 1;
2953
                teamclass = ptr->teamclass;
3007
                    teamclass = ptr->teamclass;
-
 
3008
                }
-
 
3009
                sort_aux[ptr->team].lc_place[i] = k++;
2954
            }
3010
            }
2955
            sort_aux[ptr->team].lc_place[i] = k++;
-
 
2956
        }
3011
        }
2957
 
3012
 
2958
        /*
3013
        /*
2959
        **  Sort on end time per class
3014
        **  Sort on end time per class
2960
        **  Then save the teams place at the end of each leg per class
3015
        **  Then save the teams place at the end of each leg per class
2961
        */
3016
        */
2962
        sort_team_data( i, S_LEC, sortWithEq );
3017
        sort_team_data( i, S_LEC, sortWithEq );
2963
        teamclass = -1;
3018
        teamclass = -1;
-
 
3019
        teamclassq = -1;
2964
        for( k = 1, j = 1, ptr = sort_data; j <= sort_num; j++, ptr++ )
3020
        for( k = 1, j = 1, q = 1, ptr = sort_data; j <= sort_num; j++, ptr++ )
2965
        {
3021
        {
-
 
3022
            bool isNe = false;
2966
            if ( sortWithEq &&  ptr->teamclass == config.nonequestrian_class  ) {
3023
            if ( sortWithEq &&  ptr->teamclass == config.nonequestrian_class  ) {
2967
                if ( !ptr->isNeData)
3024
                if ( !ptr->isNeData)
2968
                    continue;
3025
                    isNe = true;
2969
            }
3026
            }
2970
            else {
3027
            else {
2971
                if (ptr->isNeData)
3028
                if (ptr->isNeData)
2972
                    continue;
3029
                    isNe = true;
2973
            }
3030
            }
2974
 
3031
 
-
 
3032
            if (isNe) {
2975
            if( teamclass != ptr->teamclass )
3033
                if( teamclassq != ptr->teamclass )
-
 
3034
                {
-
 
3035
                    q = 1;
-
 
3036
                    teamclassq = ptr->teamclass;
-
 
3037
                }
-
 
3038
                sort_aux[ptr->team].leq_place[i] = q++;
2976
            {
3039
            }
-
 
3040
            else {
-
 
3041
                if( teamclass != ptr->teamclass )
-
 
3042
                {
2977
                k = 1;
3043
                    k = 1;
2978
                teamclass = ptr->teamclass;
3044
                    teamclass = ptr->teamclass;
-
 
3045
                }
-
 
3046
                sort_aux[ptr->team].lec_place[i] = k++;
2979
            }
3047
            }
2980
            sort_aux[ptr->team].lec_place[i] = k++;
-
 
2981
        }
3048
        }
2982
    }
3049
    }
2983
 
3050
 
2984
    /*
3051
    /*
2985
    **  Write the place information back to disk for use in the displays
3052
    **  Write the place information back to disk for use in the displays