Subversion Repositories svn1

Rev

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

Rev 24 Rev 31
Line 148... Line 148...
148
 
148
 
149
    report_it = getyes( "\nGenerate leg start report" );
149
    report_it = getyes( "\nGenerate leg start report" );
150
    if( abort_flag )
150
    if( abort_flag )
151
        return;
151
        return;
152
 
152
 
153
    clear_it = getyes("Reset the leg start times" );
153
    clear_it = getyes("Invalidate the leg start times" );
154
    if( abort_flag )
154
    if( abort_flag )
155
        return;
155
        return;
156
 
156
 
157
    /*
157
    /*
158
    **  Read existing data into memory
158
    **  Read existing data into memory
Line 222... Line 222...
222
 
222
 
223
    if( report_it )
223
    if( report_it )
224
        legs_start_report(9);
224
        legs_start_report(9);
225
 
225
 
226
    if ( clear_it )
226
    if ( clear_it )
227
        tm_clearleg_specified( leg, 10 );
227
        tm_clearleg_specified( leg, TRUE, 10 );
228
}
228
}
229
 
229
 
230
/*========================================================================
230
/*========================================================================
231
 *
231
 *
232
 *  Set up the leg start times for leg
232
 *  Set up the leg start times for leg
Line 287... Line 287...
287
    report_it = getyes( "\nGenerate leg start report" );
287
    report_it = getyes( "\nGenerate leg start report" );
288
    if( abort_flag )
288
    if( abort_flag )
289
        return;
289
        return;
290
 
290
 
291
    line++;
291
    line++;
292
    clear_it = getyes("Reset the leg start times" );
292
    clear_it = getyes("Invalidate the leg start times" );
293
    if( abort_flag )
293
    if( abort_flag )
294
        return;
294
        return;
295
 
295
 
296
    line++;
296
    line++;
297
    team = config.min_team;                      /* Team we are working with */
297
    team = config.min_team;                      /* Team we are working with */
Line 324... Line 324...
324
 
324
 
325
    if( report_it )
325
    if( report_it )
326
        legs_start_report(++line);
326
        legs_start_report(++line);
327
 
327
 
328
    if ( clear_it )
328
    if ( clear_it )
329
        tm_clearleg_specified( leg, ++line );
329
        tm_clearleg_specified( leg, TRUE, ++line );
330
}
330
}
331
 
331
 
332
/*========================================================================
332
/*========================================================================
333
 *
333
 *
334
 *  Set up the leg start times
334
 *  Set up the leg start times
Line 402... Line 402...
402
 *========================================================================*/
402
 *========================================================================*/
403
 
403
 
404
void tm_fixedstart(void)
404
void tm_fixedstart(void)
405
{
405
{
406
    time_t      starttime;                       /* The start time */
406
    time_t      starttime;                       /* The start time */
-
 
407
    int         report_it = FALSE;               /* Report the operation */
-
 
408
    int         clear_it = FALSE;
-
 
409
    int         line = 5;                        /* Current line */
407
 
410
    
408
    cur( 0, 5 );
411
    cur( 0, 5 );
409
    while( TRUE )
412
    while( TRUE )
410
    {
413
    {
411
        leg = 0;
414
        leg = 0;
412
        d_field( 0, 5, "Enter leg to set start time :", D_NUMBER, 1,
415
        d_field( 0, line, "Enter leg to set start time :", D_NUMBER, 1,
413
                 ( char * ) &leg, TRUE, M_UPDATE );
416
                 ( char * ) &leg, TRUE, M_UPDATE );
414
        if( leg == 0 )
417
        if( leg == 0 )
415
            return;                              /* Null leg - just exit */
418
            return;                              /* Null leg - just exit */
416
        if( leg <= config.num_legs )             /* Valid leg number - Exit loop */
419
        if( leg <= config.num_legs )             /* Valid leg number - Exit loop */
417
            break;
420
            break;
418
        beep();                                  /* Make a noise and wait for valid number */
421
        beep();                                  /* Make a noise and wait for valid number */
419
    }
422
    }
-
 
423
    line++;
420
 
424
 
421
 
425
 
422
    team = config.min_team;                      /* Team we are working with */
426
    team = config.min_team;                      /* Team we are working with */
423
    cur( 0, 5 );
427
    cur( 0, line++ );
424
    printf
428
    printf
425
        ( "Setting start times for all valid teams from %-d to %-d for leg %d\n",
429
        ( "Setting start times for all valid teams from %-d to %-d for leg %d\n",
426
          config.min_team, config.max_team, leg );
430
          config.min_team, config.max_team, leg );
427
 
431
 
428
    starttime = 0;
432
    starttime = 0;
429
    do
433
    do
430
    {
434
    {
431
        d_time( 0, 6, "Enter the start time : ", &starttime, TRUE );
435
        d_time( 0, line, "Enter the start time : ", &starttime, TRUE );
432
        if( abort_flag )
436
        if( abort_flag )
433
            return;
437
            return;
434
 
438
 
435
        if( starttime < 0 )
439
        if( starttime < 0 )
436
            beep();
440
            beep();
437
 
441
 
438
    } while( starttime < 0 );
442
    } while( starttime < 0 );
-
 
443
    
-
 
444
    line++;
-
 
445
    report_it = getyes( "\nGenerate leg start report" );
-
 
446
    if( abort_flag )
-
 
447
        return;
439
 
448
 
-
 
449
    line++;
-
 
450
    clear_it = getyes("Invalidate the leg start times" );
-
 
451
    if( abort_flag )
-
 
452
        return;
-
 
453
    
440
    while( team <= config.max_team )
454
    while( team <= config.max_team )
441
    {
455
    {
442
        if( valid_field( team ) )
456
        if( valid_field( team ) )
443
        {
457
        {
444
            g_record( team, &team_buf );
458
            g_record( team, &team_buf );
Line 461... Line 475...
461
            printf( "Upto team %d", team );
475
            printf( "Upto team %d", team );
462
            flush_out();
476
            flush_out();
463
        }
477
        }
464
        team++;
478
        team++;
465
    }
479
    }
-
 
480
    
-
 
481
    if( report_it )
-
 
482
        legs_start_report(++line);
-
 
483
 
-
 
484
    if ( clear_it )
-
 
485
        tm_clearleg_specified( leg, TRUE, ++line );
466
}
486
}
467
 
487
 
468
/*========================================================================
488
/*========================================================================
469
 *
489
 *
470
 *  Set a staggered start time for a specific leg
490
 *  Set a staggered start time for a specific leg
Line 483... Line 503...
483
 
503
 
484
void tm_staggered(void)
504
void tm_staggered(void)
485
{
505
{
486
    time_t      starttime;                       /* The start time */
506
    time_t      starttime;                       /* The start time */
487
    time_t      delta;                           /* The stagger */
507
    time_t      delta;                           /* The stagger */
-
 
508
    int         report_it = FALSE;               /* Report the operation */
-
 
509
    int         clear_it = FALSE;
-
 
510
    int         line = 5;                        /* Current line */
488
 
511
    
489
    cur( 0, 5 );
512
    cur( 0, line );
490
    while( TRUE )
513
    while( TRUE )
491
    {
514
    {
492
        leg = 0;
515
        leg = 0;
493
        d_field( 0, 5, "Enter leg to set start time :", D_NUMBER, 1,
516
        d_field( 0, 5, "Enter leg to set start time :", D_NUMBER, 1,
494
                 ( char * ) &leg, TRUE, M_UPDATE );
517
                 ( char * ) &leg, TRUE, M_UPDATE );
Line 496... Line 519...
496
            return;                              /* Null leg - just exit */
519
            return;                              /* Null leg - just exit */
497
        if( leg <= config.num_legs )             /* Valid leg number - Exit loop */
520
        if( leg <= config.num_legs )             /* Valid leg number - Exit loop */
498
            break;
521
            break;
499
        beep();                                  /* Make a noise and wait for valid number */
522
        beep();                                  /* Make a noise and wait for valid number */
500
    }
523
    }
-
 
524
    line++;
501
 
525
 
502
 
526
 
503
    team = config.min_team;                      /* Team we are working with */
527
    team = config.min_team;                      /* Team we are working with */
504
    cur( 0, 5 );
528
    cur( 0, line++ );
505
    printf
529
    printf
506
        ( "Setting staggered start times for all valid teams from %-d to %-d for leg %d\n",
530
        ( "Setting staggered start times for all valid teams from %-d to %-d for leg %d\n",
507
          config.min_team, config.max_team, leg );
531
          config.min_team, config.max_team, leg );
508
 
532
 
509
    starttime = 0;
533
    starttime = 0;
510
    do
534
    do
511
    {
535
    {
512
        d_time( 0, 6, "Enter the start time : ", &starttime, TRUE );
536
        d_time( 0, line, "Enter the start time : ", &starttime, TRUE );
513
        if( abort_flag )
537
        if( abort_flag )
514
            return;
538
            return;
515
 
539
 
516
        if( starttime < 0 )
540
        if( starttime < 0 )
517
            beep();
541
            beep();
518
 
542
 
519
    } while( starttime < 0 );
543
    } while( starttime < 0 );
-
 
544
    line++;
520
 
545
 
521
    delta = 0;
546
    delta = 0;
522
    do
547
    do
523
    {
548
    {
524
        d_time( 0, 7, "Enter the stagger time : ", &delta, TRUE );
549
        d_time( 0, line, "Enter the stagger time : ", &delta, TRUE );
525
        if( abort_flag )
550
        if( abort_flag )
526
            return;
551
            return;
527
 
552
 
528
        if( delta < 0 )
553
        if( delta < 0 )
529
            beep();
554
            beep();
530
 
555
 
531
    } while( delta < 0 );
556
    } while( delta < 0 );
532
 
557
 
-
 
558
    line++;
-
 
559
    report_it = getyes( "\nGenerate leg start report" );
-
 
560
    if( abort_flag )
-
 
561
        return;
-
 
562
 
-
 
563
    line++;
-
 
564
    clear_it = getyes("Invalidate the leg start times" );
-
 
565
    if( abort_flag )
-
 
566
        return;
533
 
567
 
534
    while( team <= config.max_team )
568
    while( team <= config.max_team )
535
    {
569
    {
536
        if( valid_field( team ) )
570
        if( valid_field( team ) )
537
        {
571
        {
Line 556... Line 590...
556
            printf( "Upto team %d", team );
590
            printf( "Upto team %d", team );
557
            flush_out();
591
            flush_out();
558
        }
592
        }
559
        team++;
593
        team++;
560
    }
594
    }
-
 
595
    
-
 
596
    if( report_it )
-
 
597
        legs_start_report(++line);
-
 
598
 
-
 
599
    if ( clear_it )
-
 
600
        tm_clearleg_specified( leg, TRUE,  ++line );
561
}
601
}
562
 
602
 
563
/*========================================================================
603
/*========================================================================
564
 *
604
 *
565
 *  Clear start times on a specific leg
605
 *  Clear start times on a specific leg
Line 597... Line 637...
597
        ( "Setting start times for all valid teams from %-d to %-d for leg %d\n",
637
        ( "Setting start times for all valid teams from %-d to %-d for leg %d\n",
598
          config.min_team, config.max_team, leg );
638
          config.min_team, config.max_team, leg );
599
    if( !getyes( "Continue operation" ) )
639
    if( !getyes( "Continue operation" ) )
600
        return;
640
        return;
601
 
641
 
602
    tm_clearleg_specified( leg, 6 );
642
    tm_clearleg_specified( leg, FALSE, 6 );
603
}
643
}
604
 
644
 
605
/*========================================================================
645
/*========================================================================
606
 *
646
 *
607
 *  Clear start times on a specific leg
647
 *  Clear start times on a specific leg
608
 *
648
 *
609
 *  Purpose:
649
 *  Purpose:
610
 *      This function is called to clear start times on a specifc leg
650
 *      This function is called to clear start times on a specifc leg
611
 *
651
 *
612
 *  Parameters:
652
 *  Parameters:
613
 *      None
653
 *      cleg                - Leg to clear
-
 
654
 *      manual              - Force manual, else leave alone
-
 
655
 *      line                - Current display line number
614
 *
656
 *
615
 *  Returns:
657
 *  Returns:
616
 *      Nothing
658
 *      Nothing
617
 *
659
 *
618
 *========================================================================*/
660
 *========================================================================*/
619
 
661
 
620
void tm_clearleg_specified(int cleg, int line)
662
void tm_clearleg_specified(int cleg, bool manual, int line)
621
{
663
{
622
 
664
 
623
    /*
665
    /*
624
    **  Validate the users argument
666
    **  Validate the users argument
625
    */
667
    */
Line 633... Line 675...
633
    while( team <= config.max_team )
675
    while( team <= config.max_team )
634
    {
676
    {
635
        if( valid_field( team ) )
677
        if( valid_field( team ) )
636
        {
678
        {
637
            g_record( team, &team_buf );
679
            g_record( team, &team_buf );
638
            team_buf.leg[leg].manual = FALSE;
680
            team_buf.leg[leg].manual = manual;
639
            team_buf.leg[leg].start = ( time_t ) -1;
681
            team_buf.leg[leg].start = ( time_t ) -1;
640
 
682
            
641
            set_times( &team_buf );
683
            set_times( &team_buf );
642
            test_times( &team_buf, 0 );
684
            test_times( &team_buf, 0 );
643
            put_team_record( team, &team_buf );
685
            put_team_record( team, &team_buf );
644
        }
686
        }
645
        if( team % 10 == 0 )
687
        if( team % 10 == 0 )