Subversion Repositories svn1-original

Rev

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

Rev 134 Rev 135
Line 45... Line 45...
45
    { '1', "Set start time from category", leg_start },
45
    { '1', "Set start time from category", leg_start },
46
    { '2', "Clear all leg times", leg_ini },
46
    { '2', "Clear all leg times", leg_ini },
47
    { '3', "Reset team information", tm_init },
47
    { '3', "Reset team information", tm_init },
48
    { '4', "Generate dummy team names", tm_gen },
48
    { '4', "Generate dummy team names", tm_gen },
49
    //{ '5', "Set calculated leg start", tm_lgs },
49
    //{ '5', "Set calculated leg start", tm_lgs },
50
    { '6', "Set ordered incremental leg start", tm_lgs1 },
50
    //{ '6', "Set ordered incremental leg start", tm_lgs1 },
51
    { '7', "Set staggered start time", tm_staggered },
51
    //{ '7', "Set staggered start time", tm_staggered },
52
    { '8', "Set fixed start time", tm_fixedstart },
52
    //{ '8', "Set fixed start time", tm_fixedstart },
53
    { '9', "Clear single leg start times", tm_clearleg },
53
    { '9', "Clear single leg start times", tm_clearleg },
54
    { 'q', "Return to main menu", 0 },
54
    { 'q', "Return to main menu", 0 },
55
    { '\0' }
55
    { '\0' }
56
};
56
};
57
 
57
 
Line 90... Line 90...
90
 *  Returns:
90
 *  Returns:
91
 *      Nothing
91
 *      Nothing
92
 *
92
 *
93
 *========================================================================*/
93
 *========================================================================*/
94
 
94
 
95
void tm_lgs1(void)
95
void tm_lgs1(int leg, time_t starttime, time_t delta, bool report_it, bool clear_it)
96
{
96
{
97
    time_t      delta;                           /* The time delta */
-
 
98
    time_t      starttime;
-
 
99
    int         report_it = FALSE;               /* Report the operation */
-
 
100
    int         clear_it = FALSE;
-
 
101
 
-
 
102
    t_legs     *data;                            /* Address of table */
97
    t_legs     *data;                            /* Address of table */
103
    t_legs     *dptr;                            /* Moving pointer */
98
    t_legs     *dptr;                            /* Moving pointer */
104
    int         num_records;                     /* Number of records in array */
99
    int         num_records;                     /* Number of records in array */
105
    int         i;
100
    int         i;
106
 
101
 
107
    cur( 0, 5 );
-
 
108
    while( TRUE )
-
 
109
    {
-
 
110
        leg = 0;
-
 
111
        d_field( 0, 5, "Enter leg to set start time :", D_NUMBER, 1,
-
 
112
                 ( char * ) &leg, TRUE, M_UPDATE );
-
 
113
        if( leg == 0 )
-
 
114
            return;                              /* Null leg - just exit */
-
 
115
        if( leg <= config.num_legs )             /* Valid leg number - Exit loop */
-
 
116
            break;
-
 
117
        beep();                                  /* Make a noise and wait for valid number */
-
 
118
    }
-
 
119
 
-
 
120
    cur( 0, 5 );
-
 
121
    printf ( "Setting start times for all valid teams from %-d to %-d for leg %d\n",
-
 
122
                config.min_team, config.max_team, leg );
-
 
123
 
-
 
124
    starttime = 0;
-
 
125
    do
-
 
126
    {
-
 
127
        d_time( 0, 6, "Enter the start time : ", &starttime, TRUE );
-
 
128
        if( abort_flag )
-
 
129
            return;
-
 
130
 
-
 
131
        if( starttime < 0 )
-
 
132
            beep();
-
 
133
 
-
 
134
    } while( starttime < 0 );
-
 
135
 
-
 
136
    delta = 0;
-
 
137
    do
-
 
138
    {
-
 
139
        d_time( 0, 7, "Enter the delta time : ", &delta, TRUE );
-
 
140
        if( abort_flag )
-
 
141
            return;
-
 
142
 
-
 
143
        if( delta < 0 )
-
 
144
            beep();
-
 
145
 
-
 
146
    } while( delta < 0 );
-
 
147
 
-
 
148
 
-
 
149
    report_it = getyes( "\nGenerate leg start report" );
-
 
150
    if( abort_flag )
-
 
151
        return;
-
 
152
 
-
 
153
    clear_it = getyes("Invalidate the leg start times" );
-
 
154
    if( abort_flag )
-
 
155
        return;
-
 
156
 
102
 
157
    /*
103
    /*
158
    **  Read existing data into memory
104
    **  Read existing data into memory
159
    */
105
    */
160
    data = ( t_legs * ) calloc( ( unsigned ) ( config.max_team - config.min_team + 2 ), sizeof( t_legs ) ); /* Fetch memory */
106
    data = ( t_legs * ) calloc( ( unsigned ) ( config.max_team - config.min_team + 2 ), sizeof( t_legs ) ); /* Fetch memory */
Line 219... Line 165...
219
    **  Release the data
165
    **  Release the data
220
    */
166
    */
221
    free( data );
167
    free( data );
222
 
168
 
223
    if( report_it )
169
    if( report_it )
224
        legs_start_report(9);
170
        legs_start_report(9, leg);
225
 
171
 
226
    if ( clear_it )
172
    if ( clear_it )
227
        tm_clearleg_specified( leg, TRUE, 10 );
173
        tm_clearleg_specified( leg, TRUE, 10 );
228
}
174
}
229
 
175
 
Line 275... Line 221...
275
        }
221
        }
276
        team++;
222
        team++;
277
    }
223
    }
278
 
224
 
279
    if( report_it )
225
    if( report_it )
280
        legs_start_report(0);
226
        legs_start_report(0, leg);
281
 
227
 
282
    if ( clear_it )
228
    if ( clear_it )
283
        tm_clearleg_specified( leg, TRUE, 0 );
229
        tm_clearleg_specified( leg, TRUE, 0 );
284
}
230
}
285
 
231
 
Line 353... Line 299...
353
 *  Returns:
299
 *  Returns:
354
 *      Nothing
300
 *      Nothing
355
 *
301
 *
356
 *========================================================================*/
302
 *========================================================================*/
357
 
303
 
358
void tm_fixedstart(void)
304
void tm_fixedstart(int leg, time_t starttime, bool report_it, bool clear_it)
359
{
305
{
360
    time_t      starttime;                       /* The start time */
-
 
361
    int         report_it = FALSE;               /* Report the operation */
-
 
362
    int         clear_it = FALSE;
-
 
363
    int         line = 5;                        /* Current line */
306
    int         line = 5;                        /* Current line */
364
    
-
 
365
    cur( 0, 5 );
-
 
366
    while( TRUE )
-
 
367
    {
-
 
368
        leg = 0;
-
 
369
        d_field( 0, line, "Enter leg to set start time :", D_NUMBER, 1,
-
 
370
                 ( char * ) &leg, TRUE, M_UPDATE );
-
 
371
        if( leg == 0 )
-
 
372
            return;                              /* Null leg - just exit */
-
 
373
        if( leg <= config.num_legs )             /* Valid leg number - Exit loop */
-
 
374
            break;
-
 
375
        beep();                                  /* Make a noise and wait for valid number */
-
 
376
    }
-
 
377
    line++;
-
 
378
 
-
 
379
 
-
 
380
    team = config.min_team;                      /* Team we are working with */
-
 
381
    cur( 0, line++ );
-
 
382
    printf
-
 
383
        ( "Setting start times for all valid teams from %-d to %-d for leg %d\n",
-
 
384
          config.min_team, config.max_team, leg );
-
 
385
 
-
 
386
    starttime = 0;
-
 
387
    do
-
 
388
    {
-
 
389
        d_time( 0, line, "Enter the start time : ", &starttime, TRUE );
-
 
390
        if( abort_flag )
-
 
391
            return;
-
 
392
 
-
 
393
        if( starttime < 0 )
-
 
394
            beep();
-
 
395
 
-
 
396
    } while( starttime < 0 );
-
 
397
    
-
 
398
    line++;
-
 
399
    report_it = getyes( "\nGenerate leg start report" );
-
 
400
    if( abort_flag )
-
 
401
        return;
-
 
402
 
307
 
403
    line++;
-
 
404
    clear_it = getyes("Invalidate the leg start times" );
-
 
405
    if( abort_flag )
-
 
406
        return;
-
 
407
    
-
 
408
    while( team <= config.max_team )
308
    while( team <= config.max_team )
409
    {
309
    {
410
        if( valid_field( team ) )
310
        if( valid_field( team ) )
411
        {
311
        {
412
            g_record( team, &team_buf );
312
            g_record( team, &team_buf );
Line 431... Line 331...
431
        }
331
        }
432
        team++;
332
        team++;
433
    }
333
    }
434
    
334
    
435
    if( report_it )
335
    if( report_it )
436
        legs_start_report(++line);
336
        legs_start_report(++line, leg);
437
 
337
 
438
    if ( clear_it )
338
    if ( clear_it )
439
        tm_clearleg_specified( leg, TRUE, ++line );
339
        tm_clearleg_specified( leg, TRUE, ++line );
440
}
340
}
441
 
341
 
Line 453... Line 353...
453
 *  Returns:
353
 *  Returns:
454
 *      Nothing
354
 *      Nothing
455
 *
355
 *
456
 *========================================================================*/
356
 *========================================================================*/
457
 
357
 
458
void tm_staggered(void)
358
void tm_staggered(int leg, time_t starttime, time_t delta, bool report_it, bool clear_it )
459
{
359
{
460
    time_t      starttime;                       /* The start time */
-
 
461
    time_t      delta;                           /* The stagger */
-
 
462
    int         report_it = FALSE;               /* Report the operation */
-
 
463
    int         clear_it = FALSE;
-
 
464
    int         line = 5;                        /* Current line */
360
    int         line = 5;                        /* Current line */
465
    
361
    
466
    cur( 0, line );
-
 
467
    while( TRUE )
-
 
468
    {
-
 
469
        leg = 0;
-
 
470
        d_field( 0, 5, "Enter leg to set start time :", D_NUMBER, 1,
-
 
471
                 ( char * ) &leg, TRUE, M_UPDATE );
-
 
472
        if( leg == 0 )
-
 
473
            return;                              /* Null leg - just exit */
-
 
474
        if( leg <= config.num_legs )             /* Valid leg number - Exit loop */
-
 
475
            break;
-
 
476
        beep();                                  /* Make a noise and wait for valid number */
-
 
477
    }
-
 
478
    line++;
-
 
479
 
-
 
480
 
-
 
481
    team = config.min_team;                      /* Team we are working with */
-
 
482
    cur( 0, line++ );
-
 
483
    printf
-
 
484
        ( "Setting staggered start times for all valid teams from %-d to %-d for leg %d\n",
-
 
485
          config.min_team, config.max_team, leg );
-
 
486
 
-
 
487
    starttime = 0;
-
 
488
    do
-
 
489
    {
-
 
490
        d_time( 0, line, "Enter the start time : ", &starttime, TRUE );
-
 
491
        if( abort_flag )
-
 
492
            return;
-
 
493
 
-
 
494
        if( starttime < 0 )
-
 
495
            beep();
-
 
496
 
-
 
497
    } while( starttime < 0 );
-
 
498
    line++;
-
 
499
 
-
 
500
    delta = 0;
-
 
501
    do
-
 
502
    {
-
 
503
        d_time( 0, line, "Enter the stagger time : ", &delta, TRUE );
-
 
504
        if( abort_flag )
-
 
505
            return;
-
 
506
 
-
 
507
        if( delta < 0 )
-
 
508
            beep();
-
 
509
 
-
 
510
    } while( delta < 0 );
-
 
511
 
-
 
512
    line++;
-
 
513
    report_it = getyes( "\nGenerate leg start report" );
-
 
514
    if( abort_flag )
-
 
515
        return;
-
 
516
 
-
 
517
    line++;
-
 
518
    clear_it = getyes("Invalidate the leg start times" );
-
 
519
    if( abort_flag )
-
 
520
        return;
-
 
521
 
-
 
522
    while( team <= config.max_team )
362
    while( team <= config.max_team )
523
    {
363
    {
524
        if( valid_field( team ) )
364
        if( valid_field( team ) )
525
        {
365
        {
526
            g_record( team, &team_buf );
366
            g_record( team, &team_buf );
Line 546... Line 386...
546
        }
386
        }
547
        team++;
387
        team++;
548
    }
388
    }
549
    
389
    
550
    if( report_it )
390
    if( report_it )
551
        legs_start_report(++line);
391
        legs_start_report(++line, leg);
552
 
392
 
553
    if ( clear_it )
393
    if ( clear_it )
554
        tm_clearleg_specified( leg, TRUE,  ++line );
394
        tm_clearleg_specified( leg, TRUE,  ++line );
555
}
395
}
556
 
396
 
Line 795... Line 635...
795
 *  Returns:
635
 *  Returns:
796
 *      Nothing
636
 *      Nothing
797
 *
637
 *
798
 *========================================================================*/
638
 *========================================================================*/
799
 
639
 
800
void legs_start_report(int line)
640
void legs_start_report(int line, int leg)
801
{
641
{
802
    int         i;
642
    int         i;
803
    t_legs     *data;                            /* Address of table */
643
    t_legs     *data;                            /* Address of table */
804
    t_legs     *dptr;                            /* Moving pointer */
644
    t_legs     *dptr;                            /* Moving pointer */
805
    int         last_team;
645
    int         last_team;