Rev 1 | Blame | Compare with Previous | Last modification | View Log | RSS feed
/************************************************************************** Copyright (C) 1995 Embedded Solutions* All rights reserved** file: src\disqual.c** purpose: Disqualification operations** functions* f_disqualify - Disqualification menu* ds_team - Disqualify teams* ds_requal - Re-qualify teams* ds_displ - Display disqualified teams* del_team - Delete a team** programmer: David Purdie** revision date by reason* 00.0 27/01/95 DDP Tidies up the program and formatted the file***************************************************************************/#include "consts.h"#include "structs.h"#include "proto.h"menu_table dsq_menu[] = {{ '1', "Disqualify a team", ds_team },{ '2', "Flag a non-equestrian team", ds_non_equestrian },{ '3', "Re-qualify a team", ds_requal },{ '4', "Display disqualified and non-equestrian teams", ds_displ },{ '5', "Delete a team entry", del_team },{ 'q', "Return to main menu", 0 },{ '\0' }};/*========================================================================** Disqualification menu** Purpose:* This function is called to display the Disqualification operations** Parameters:* None** Returns:* Nothing**========================================================================*/void f_disqualify(void){do_menu( "Disqualification operations", "Select option", dsq_menu );}/*========================================================================** Disqualify teams** Purpose:* This function is called to disqualify teams* Prompt the operator for a team number and then disqualify the team** Parameters:* None** Returns:* Nothing**========================================================================*/void ds_team(void){while( g_tnum( 0, n_lines - 10, "Enter team to disqualify" ) ){printf( "\n" );console_clreol();if( g_record( team, &team_buf ) )if( team_buf.flags.disqualified && ! team_buf.flags.non_equestrian ){printf( "Team %d already disqualified\n", team );beep();}else{team_buf.flags.disqualified = TRUE;team_buf.flags.non_equestrian = FALSE;put_team_record( team, &team_buf );printf( "Team %d now disqualified\n", team );}else{printf( "Team %d not defined\n", team );beep();}}}/*========================================================================** Non Equestrian Teams** Purpose:* This function is called to flag a team as being non-equestrian* Prompt the operator for a team number and then flag the team** Parameters:* None** Returns:* Nothing**========================================================================*/void ds_non_equestrian(void){while( g_tnum( 0, n_lines - 10, "Enter team to mark Non-Equestrian" ) ){printf( "\n" );console_clreol();if( g_record( team, &team_buf ) )if( team_buf.flags.non_equestrian ){printf( "Team %d already marked Non-Equestrian\n", team );beep();}else{team_buf.flags.disqualified = TRUE;team_buf.flags.non_equestrian = TRUE;put_team_record( team, &team_buf );printf( "Team %d now marked Non-Equestrian\n", team );}else{printf( "Team %d not defined\n", team );beep();}}}/*========================================================================** Re-qualify teams** Purpose:* This function is called to re-qualify teams* Prompt the operator for a team number and then re-qualify the team** Parameters:* None** Returns:* Nothing**========================================================================*/void ds_requal(void){while( g_tnum( 0, n_lines - 10, "Enter team to re-qualify" ) ){printf( "\n" );console_clreol();if( g_record( team, &team_buf ) )if( !team_buf.flags.disqualified ){printf( "Team %d not disqualified\n", team );beep();}else{team_buf.flags.disqualified = FALSE;team_buf.flags.non_equestrian = FALSE;put_team_record( team, &team_buf );printf( "Team %d now re-qualified\n", team );}else{printf( "Team %d not defined\n", team );beep();}}}/*========================================================================** Display disqualified teams** Purpose:* This function is called to Display disqualified teams* Scan all the teams and list those that are disqualified** Parameters:* None** Returns:* Nothing**========================================================================*/void ds_displ(void){int i, j, k;int non_equestrian_count = 0;printf( "Scanning for disqualified and non-equestrian teams\n\n" );flush_out();for( k = j = 0, i = config.min_team; i <= config.max_team; i++ ){if( valid_field( i ) ){( void ) g_record( i, &team_buf );if( team_buf.flags.valid && ( team_buf.flags.disqualified || team_buf.flags.non_equestrian )){printf( "%4d%c ", i, team_buf.flags.non_equestrian ? 'N' : ' ' );flush_out();k++;if( team_buf.flags.non_equestrian )non_equestrian_count++;if( j++ > 10 ){printf( "\n" );j = 0;}}}}printf( "\n\n");printf ("Teams disqualified: %d\n", k );printf ("Non Equestrian teams: %d\n", non_equestrian_count );printf ("\nAny key to continue");getinp();}/*========================================================================** Delete a team** Purpose:* This function is called to Delete a team* Prompt the operator for a team number and then delete the team** Parameters:* None** Returns:* Nothing**========================================================================*/void del_team(void){while( g_tnum( 0, n_lines - 10, "Enter team to DELETE" ) ){printf( "\n" );console_clreol();if( g_record( team, &team_buf ) ){team_buf.flags.valid = FALSE;team_buf.flags.disqualified = FALSE;put_team_record( team, &team_buf );printf( "Team %d now deleted\n", team );}else{printf( "Team %d not defined\n", team );beep();}}}/********************************* EOF ***********************************/