Subversion Repositories svn1

Rev

Rev 1 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 root 1
/*************************************************************************
2
*           Copyright (C) 1995 Embedded Solutions
3
*                       All rights reserved
4
*
5
* file:     src\disqual.c
6
*
7
* purpose:  Disqualification operations
8
*
9
* functions
10
*       f_disqualify            - Disqualification menu
11
*       ds_team                 - Disqualify teams
12
*       ds_requal               - Re-qualify teams
13
*       ds_displ                - Display disqualified teams
14
*       del_team                - Delete a team
15
*
16
* programmer: David Purdie
17
*
18
* revision  date        by      reason
19
*   00.0    27/01/95    DDP     Tidies up the program and formatted the file
20
*
21
**************************************************************************/
22
 
23
#include    "consts.h"
24
#include    "structs.h"
25
#include    "proto.h"
26
 
27
menu_table  dsq_menu[] = {
28
    { '1', "Disqualify a team", ds_team },
29
    { '2', "Flag a non-equestrian team", ds_non_equestrian },
30
    { '3', "Re-qualify a team", ds_requal },
31
    { '4', "Display disqualified and non-equestrian teams", ds_displ },
32
    { '5', "Delete a team entry", del_team },
33
    { 'q', "Return to main menu", 0 },
34
    { '\0' }
35
};
36
 
37
 
38
/*========================================================================
39
 *
40
 *  Disqualification menu
41
 *
42
 *  Purpose:
43
 *      This function is called to display the Disqualification operations
44
 *
45
 *  Parameters:
46
 *      None
47
 *
48
 *  Returns:
49
 *      Nothing
50
 *
51
 *========================================================================*/
52
 
53
void f_disqualify(void)
54
{
55
    do_menu( "Disqualification operations", "Select option", dsq_menu );
56
}
57
 
58
/*========================================================================
59
 *
60
 *  Disqualify teams
61
 *
62
 *  Purpose:
63
 *      This function is called to disqualify teams
64
 *      Prompt the operator for a team number and then disqualify the team
65
 *
66
 *  Parameters:
67
 *      None
68
 *
69
 *  Returns:
70
 *      Nothing
71
 *
72
 *========================================================================*/
73
 
74
void ds_team(void)
75
{
76
    while( g_tnum( 0, n_lines - 10, "Enter team to disqualify" ) )
77
    {
78
        printf( "\n" );
79
        console_clreol();
80
        if( g_record( team, &team_buf ) )
81
            if( team_buf.flags.disqualified && ! team_buf.flags.non_equestrian )
82
            {
83
                printf( "Team %d already disqualified\n", team );
84
                beep();
85
            }
86
            else
87
            {
88
                team_buf.flags.disqualified = TRUE;
89
                team_buf.flags.non_equestrian = FALSE;
90
                put_team_record( team, &team_buf );
91
                printf( "Team %d now disqualified\n", team );
92
            }
93
        else
94
        {
95
            printf( "Team %d not defined\n", team );
96
            beep();
97
        }
98
    }
99
}
100
 
101
/*========================================================================
102
 *
103
 *  Non Equestrian Teams
104
 *
105
 *  Purpose:
106
 *      This function is called to flag a team as being non-equestrian
107
 *      Prompt the operator for a team number and then flag the team
108
 *
109
 *  Parameters:
110
 *      None
111
 *
112
 *  Returns:
113
 *      Nothing
114
 *
115
 *========================================================================*/
116
 
117
void ds_non_equestrian(void)
118
{
119
    while( g_tnum( 0, n_lines - 10, "Enter team to mark Non-Equestrian" ) )
120
    {
121
        printf( "\n" );
122
        console_clreol();
123
        if( g_record( team, &team_buf ) )
124
            if( team_buf.flags.non_equestrian )
125
            {
126
                printf( "Team %d already marked Non-Equestrian\n", team );
127
                beep();
128
            }
129
            else
130
            {
131
                team_buf.flags.disqualified = TRUE;
132
                team_buf.flags.non_equestrian = TRUE;
133
                put_team_record( team, &team_buf );
134
                printf( "Team %d now marked Non-Equestrian\n", team );
135
            }
136
        else
137
        {
138
            printf( "Team %d not defined\n", team );
139
            beep();
140
        }
141
    }
142
}
143
/*========================================================================
144
 *
145
 *  Re-qualify teams
146
 *
147
 *  Purpose:
148
 *      This function is called to re-qualify teams
149
 *      Prompt the operator for a team number and then re-qualify the team
150
 *
151
 *  Parameters:
152
 *      None
153
 *
154
 *  Returns:
155
 *      Nothing
156
 *
157
 *========================================================================*/
158
 
159
void ds_requal(void)
160
{
161
    while( g_tnum( 0, n_lines - 10, "Enter team to re-qualify" ) )
162
    {
163
        printf( "\n" );
164
        console_clreol();
165
        if( g_record( team, &team_buf ) )
166
            if( !team_buf.flags.disqualified )
167
            {
168
                printf( "Team %d not disqualified\n", team );
169
                beep();
170
            }
171
            else
172
            {
173
                team_buf.flags.disqualified = FALSE;
174
                team_buf.flags.non_equestrian = FALSE;
175
                put_team_record( team, &team_buf );
176
                printf( "Team %d now re-qualified\n", team );
177
            }
178
        else
179
        {
180
            printf( "Team %d not defined\n", team );
181
            beep();
182
        }
183
    }
184
}
185
 
186
/*========================================================================
187
 *
188
 *  Display disqualified teams
189
 *
190
 *  Purpose:
191
 *      This function is called to Display disqualified teams
192
 *      Scan all the teams and list those that are disqualified
193
 *
194
 *  Parameters:
195
 *      None
196
 *
197
 *  Returns:
198
 *      Nothing
199
 *
200
 *========================================================================*/
201
 
202
void ds_displ(void)
203
{
204
    int     i, j, k;
205
    int     non_equestrian_count = 0;
206
 
207
    printf( "Scanning for disqualified and non-equestrian teams\n\n" );
208
    flush_out();
209
    for( k = j = 0, i = config.min_team; i <= config.max_team; i++ )
210
    {
211
        if( valid_field( i ) )
212
        {
213
            ( void ) g_record( i, &team_buf );
214
            if( team_buf.flags.valid && ( team_buf.flags.disqualified || team_buf.flags.non_equestrian ))
215
            {
216
                printf( "%4d%c ", i, team_buf.flags.non_equestrian ? 'N' : ' ' );
217
                flush_out();
218
                k++;
219
                if( team_buf.flags.non_equestrian )
220
                    non_equestrian_count++;
221
                if( j++ > 10 )
222
                {
223
                    printf( "\n" );
224
                    j = 0;
225
                }
226
            }
227
        }
228
    }
229
    printf( "\n\n");
230
    printf ("Teams disqualified: %d\n", k );
231
    printf ("Non Equestrian teams: %d\n", non_equestrian_count );
232
    printf ("\nAny key to continue");
233
    getinp();
234
}
235
 
236
/*========================================================================
237
 *
238
 *  Delete a team
239
 *
240
 *  Purpose:
241
 *      This function is called to Delete a team
242
 *      Prompt the operator for a team number and then delete the team
243
 *
244
 *  Parameters:
245
 *      None
246
 *
247
 *  Returns:
248
 *      Nothing
249
 *
250
 *========================================================================*/
251
 
252
void del_team(void)
253
{
254
    while( g_tnum( 0, n_lines - 10, "Enter team to DELETE" ) )
255
    {
256
        printf( "\n" );
257
        console_clreol();
258
        if( g_record( team, &team_buf ) )
259
        {
260
            team_buf.flags.valid = FALSE;
261
            team_buf.flags.disqualified = FALSE;
262
            put_team_record( team, &team_buf );
263
            printf( "Team %d now deleted\n", team );
264
        }
265
        else
266
        {
267
            printf( "Team %d not defined\n", team );
268
            beep();
269
        }
270
    }
271
}
272
 
273
/********************************* EOF ***********************************/