Subversion Repositories svn1

Rev

Rev 126 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 126 Rev 380
Line 42... Line 42...
42
 *          In consistencies are :-
42
 *          In consistencies are :-
43
 *          No start time
43
 *          No start time
44
 *          No end time
44
 *          No end time
45
 *          End before start
45
 *          End before start
46
 *          Times without team data
46
 *          Times without team data
-
 
47
 *          NE team with a named NE competitor
47
 *
48
 *
48
 *
49
 *
49
 *  Parameters:
50
 *  Parameters:
50
 *      data            address of the data buffer
51
 *      data            address of the data buffer
51
 *      upto_leg;       Examine upto and including this leg
52
 *      upto_leg;       Examine upto and including this leg
Line 67... Line 68...
67
    data->flags.bad_times = FALSE;               /* Set times ok */
68
    data->flags.bad_times = FALSE;               /* Set times ok */
68
    check_error.leg = check_error.type = 0;
69
    check_error.leg = check_error.type = 0;
69
 
70
 
70
    if( !data->flags.valid )
71
    if( !data->flags.valid )
71
    {
72
    {
-
 
73
        /*
-
 
74
        ** Test for invalid team with time information present
-
 
75
        */
72
        for( i = 0; i < upto_leg; i++ )
76
        for( i = 0; i < upto_leg; i++ )
73
            if( data->leg[i + 1].end >= 0 )
77
            if( data->leg[i + 1].end >= 0 )
74
            {
78
            {
75
                check_error.type = 4;            /* Flag error */
79
                check_error.type = 4;            /* Flag error */
76
                check_error.leg = i;
80
                check_error.leg = i;
Line 81... Line 85...
81
    else
85
    else
82
    {
86
    {
83
        for( i = 0, t = 0; i < upto_leg; i++ )
87
        for( i = 0, t = 0; i < upto_leg; i++ )
84
        {
88
        {
85
            use = &data->leg[i + 1];             /* Pointer to leg data */
89
            use = &data->leg[i + 1];             /* Pointer to leg data */
-
 
90
 
-
 
91
            // Is this the NE leg ?
-
 
92
            // If NE then
-
 
93
            //      If we have a competitor name - warn
-
 
94
            //      Don't add in time
-
 
95
            if ( i + 1 == config.equestrian_leg && data->flags.non_equestrian   )
-
 
96
            {
-
 
97
                // This error is now detected by the caller
-
 
98
                //if ( data->members[i].name[0] && use->end >= 0)
-
 
99
                //{
-
 
100
                //    if( !check_error.leg )
-
 
101
                //    {
-
 
102
                //        check_error.leg = i + 1;
-
 
103
                //        check_error.type = 5;
-
 
104
                //    }
-
 
105
                //}
86
            if( ( use->start >= 0 )
106
                use->elapsed = -1;
-
 
107
                continue;
-
 
108
            }
-
 
109
 
-
 
110
 
-
 
111
            // Have a start and  end time
-
 
112
            // Calculate the elapsed time
87
                && ( use->end >= 0 ) && ( use->end > use->start ) )
113
            if( ( use->start >= 0 ) && ( use->end >= 0 ) && ( use->end > use->start ) )
-
 
114
            {
88
                t += use->elapsed = use->end - use->start;
115
                t += use->elapsed = use->end - use->start;
-
 
116
            }
89
            else
117
            else
90
            {
118
            {
-
 
119
                // Determine error
91
                use->elapsed = ( time_t ) - 1;
120
                use->elapsed = ( time_t ) - 1;
92
                data->flags.bad_times = TRUE;
121
                data->flags.bad_times = TRUE;
93
                if( !check_error.leg )
122
                if( !check_error.leg )
94
                {
123
                {
95
                    check_error.leg = i + 1;
124
                    check_error.leg = i + 1;
96
                    check_error.type++;
125
                    check_error.type = 1;
97
                    if( use->start < 0 )
126
                    if( use->start < 0 )
98
                        continue;
127
                        continue;
99
                    check_error.type++;
128
                    check_error.type = 2;
100
                    if( use->end < 0 )
129
                    if( use->end < 0 )
101
                        continue;
130
                        continue;
102
                    check_error.type++;
131
                    check_error.type = 3;
103
                }
132
                }
104
            }
133
            }
105
        }
134
        }
106
    }
135
    }
107
 
-
 
108
    data->leg[0].elapsed = t;                    /* total elapsed so far */
136
    data->leg[0].elapsed = t;                    /* total elapsed so far */
109
    data->leg[0].start = data->leg[1].start;     /* Team start */
137
    data->leg[0].start = data->leg[1].start;     /* Team start */
110
    data->leg[0].end = data->leg[upto_leg].end;  /* Team end */
138
    data->leg[0].end = data->leg[upto_leg].end;  /* Team end */
111
    return ( data->flags.bad_times );
139
    return ( data->flags.bad_times );            /* Flag errors, not warnings */
112
}
140
}
113
 
141
 
114
/*========================================================================
142
/*========================================================================
115
 *
143
 *
116
 *  Calc start times for each leg
144
 *  Calc start times for each leg