Subversion Repositories svn1-original

Rev

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

Rev 174 Rev 178
Line 26... Line 26...
26
*
26
*
27
* revision  date        by      reason
27
* revision  date        by      reason
28
*   00.0    27/01/95    DDP     Tidies up the program and formatted the file
28
*   00.0    27/01/95    DDP     Tidies up the program and formatted the file
29
*
29
*
30
**************************************************************************/
30
**************************************************************************/
31
 
-
 
32
#ifndef HI_TECH_C
31
#include    <QMessageBox>
33
#include    <fcntl.h>
32
#include    <fcntl.h>
34
/*#include  <memory.h> */
-
 
35
#endif
-
 
36
 
-
 
37
#include    "consts.h"
33
#include    "consts.h"
38
#include    "structs.h"
34
#include    "structs.h"
39
#include    "proto.h"
35
#include    "proto.h"
40
#include    "mainwindow.h"
36
#include    "mainwindow.h"
41
 
37
 
42
//int         team;                                /* Current team number */
-
 
43
//team_type   team_buf;                            /* Holds team data currently under display */
-
 
44
int         team_fd;                             /* Team data file descriptor */
38
int         team_fd;                             /* Team data file descriptor */
45
//int         leg = 0;                             /* Leg under investigation */
-
 
46
 
-
 
47
/*========================================================================
-
 
48
 *
-
 
49
 *  Update team data on the screen
-
 
50
 *
-
 
51
 *  Purpose:
-
 
52
 *      This function is called to update team data on the screen
-
 
53
 *      This function will prompt the operator to select a team number
-
 
54
 *      If the team is defined then the data will be displayed on the screen
-
 
55
 *
-
 
56
 *  Parameters:
-
 
57
 *      None
-
 
58
 *
-
 
59
 *  Returns:
-
 
60
 *      TRUE - Change made
-
 
61
 *
-
 
62
 *========================================================================*/
-
 
63
 
-
 
64
//void team_update(void)
-
 
65
//{
-
 
66
//    if( !g_tnum( 0, n_lines - 2, "Enter team number" ) )
-
 
67
//        return;                        /* Exit operation */
-
 
68
 
-
 
69
//    /*
-
 
70
//     **  Fetch the team record into memory
-
 
71
//     **  If the record does not exist a record with an invalid flag
-
 
72
//     **  will be returned
-
 
73
//     */
-
 
74
 
-
 
75
//    do
-
 
76
//    {
-
 
77
//        clearscreen();
-
 
78
//        g_record( team, &team_buf );
-
 
79
//        d_display( M_TEAM );
-
 
80
//        put_team_record( team, &team_buf );
-
 
81
 
-
 
82
//    } while( g_tnum( 0, n_lines - 2, "Enter next team or RETURN to exit" ) );
-
 
83
//}
-
 
84
 
-
 
85
/*=======================================================================
-
 
86
 *
-
 
87
 *  Display team data on the screen
-
 
88
 *
-
 
89
 *  Purpose:
-
 
90
 *      This function is called to Display team data on the screen
-
 
91
 *      This function will prompt the operator to select a team number
-
 
92
 *      If the team is defined then the data will be displayed on the screen
-
 
93
 *
-
 
94
 *  Parameters:
-
 
95
 *      None
-
 
96
 *
-
 
97
 *  Returns:
-
 
98
 *      TRUE - Change made
-
 
99
 *
-
 
100
 *========================================================================*/
-
 
101
 
-
 
102
//void team_display(void)
-
 
103
//{
-
 
104
//    if( !g_tnum( 0, n_lines - 2, "Enter team number" ) )
-
 
105
//        return;                        /* Exit operation */
-
 
106
 
-
 
107
//    /*
-
 
108
//     * Fetch the team record into memory
-
 
109
//     * If the record does not exist a record with an invalid flag
-
 
110
//     * will be returned
-
 
111
//     */
-
 
112
 
-
 
113
//    do
-
 
114
//    {
-
 
115
//        clearscreen();
-
 
116
//        if( g_record( team, &team_buf ) )
-
 
117
//            d_display( M_DISPLAY );
-
 
118
//        else
-
 
119
//        {
-
 
120
//            cur( 0, n_lines - 1 );
-
 
121
//            printf( "Team %-1d has not yet been entered", team );
-
 
122
//            beep();
-
 
123
//        }
-
 
124
//    } while( g_tnum( 0, n_lines - 2, "Enter next team or RETURN to exit" ) );
-
 
125
//}
-
 
126
 
-
 
127
/*========================================================================
-
 
128
 *
-
 
129
 *  Modify team leg times
-
 
130
 *
-
 
131
 *  Purpose:
-
 
132
 *      This function is called to modify team leg times
-
 
133
 *      This function will prompt the operator to select a team number
-
 
134
 *      If the team is defined then the data will be displayed on the screen
-
 
135
 *
-
 
136
 *  Parameters:
-
 
137
 *      None
-
 
138
 *
-
 
139
 *  Returns:
-
 
140
 *      TRUE - Change made
-
 
141
 *
-
 
142
 *========================================================================*/
-
 
143
//void leg_mods(void)
-
 
144
//{
-
 
145
//    if( !g_tnum( 0, n_lines - 2, "Enter team number" ) )
-
 
146
//        return;                        /* Exit operation */
-
 
147
 
-
 
148
//    /*
-
 
149
//     **  Fetch the team record into memory
-
 
150
//     ** If the record does not exist a record with an invalid flag
-
 
151
//     ** will be returned
-
 
152
//     */
-
 
153
 
-
 
154
//    do
-
 
155
//    {
-
 
156
//        clearscreen();
-
 
157
//        if( g_record( team, &team_buf ) )
-
 
158
//        {
-
 
159
//            set_times( &team_buf );
-
 
160
//            d_display( M_LEGS );
-
 
161
//            put_team_record( team, &team_buf );
-
 
162
//        }
-
 
163
//        else
-
 
164
//        {
-
 
165
//            cur( 0, n_lines - 1 );
-
 
166
//            printf( "Team %-1d has not yet been entered", team );
-
 
167
//            beep();
-
 
168
//        }
-
 
169
//    } while( g_tnum( 0, n_lines - 2, "Enter next team or RETURN to exit" ) );
-
 
170
 
-
 
171
//}
-
 
172
 
39
 
173
/*========================================================================
-
 
174
 *
-
 
175
 *  Display all team information
-
 
176
 *
-
 
177
 *  Purpose:
-
 
178
 *      This function is called to display all the team information
-
 
179
 *
-
 
180
 *  Parameters:
-
 
181
 *      operation       Operation to perform
-
 
182
 *
-
 
183
 *  Returns:
-
 
184
 *      Nothing
-
 
185
 *
-
 
186
 *========================================================================*/
-
 
187
//void d_display( int operation )
-
 
188
//{
-
 
189
//    int         valid = team_buf.flags.valid;
-
 
190
//    int         opr;
-
 
191
//    int         i, j;
-
 
192
//    int         age_sum;
-
 
193
 
-
 
194
//    /*
-
 
195
//     **  Refresh the entire display (using a recursive call)
-
 
196
//     */
-
 
197
//    if( operation != M_DISPLAY )
-
 
198
//        d_display( M_DISPLAY );
-
 
199
 
-
 
200
 
-
 
201
//    /*
-
 
202
//     **  Display the team number
-
 
203
//     **      This cannot be edited.
-
 
204
//     */
-
 
205
//    d_field( 0, 0, "Team number : ", D_NUMBER, 6, &team_buf.numb, TRUE,
-
 
206
//             M_DISPLAY );
-
 
207
 
-
 
208
//    /*
-
 
209
//     **  Determine the type of operation required
-
 
210
//     **      Update or Display
-
 
211
//     */
-
 
212
//    opr = ( operation & M_TEAM ) ? M_UPDATE : M_DISPLAY;
-
 
213
 
-
 
214
//    /*
-
 
215
//     **  Display / Update the team name
-
 
216
//     */
-
 
217
//    do
-
 
218
//    {
-
 
219
//        d_field( 20, 0, "Team name : ", D_STRING, MAX_TM_NAME, team_buf.name,
-
 
220
//                 valid, opr );
-
 
221
//        if( abort_flag )
-
 
222
//            return;
-
 
223
//    } while( ( opr == M_UPDATE ) && ( !strlen( team_buf.name ) ) );
-
 
224
 
-
 
225
//    /*
-
 
226
//     **  Display / Update the class
-
 
227
//     */
-
 
228
//    do
-
 
229
//    {
-
 
230
//        d_field( 0, 1, "Class : ", D_CLASS, 1, &team_buf.teamclass, valid, opr );
-
 
231
//        if( abort_flag )
-
 
232
//            return;
-
 
233
//    } while( ( opr == M_UPDATE ) && !team_buf.teamclass );
-
 
234
 
-
 
235
//    /*
-
 
236
//     **  The record is now active
-
 
237
//     **  It may not be usefull, but it has the start of a valid recird
-
 
238
//     */
-
 
239
//    if( opr == M_UPDATE )
-
 
240
//        team_buf.flags.valid = TRUE;
-
 
241
 
-
 
242
//    /*
-
 
243
//     **  Display / Update the country name
-
 
244
//     */
-
 
245
//    d_field( 30, 1, "Country :", D_COUNTRY, 4, &team_buf.country, valid,
-
 
246
//             opr );
-
 
247
//    if( abort_flag )
-
 
248
//        return;
-
 
249
 
-
 
250
//    /*
-
 
251
//     **  Display / Update the name and sex of each team member
-
 
252
//     */
-
 
253
//    age_sum = 0;
-
 
254
//    opr = ( operation & M_TEAM ) ? M_UPDATE : M_DISPLAY;
-
 
255
//    for( i = 0; i < MAX_MEMB; i++ )
-
 
256
//    {
-
 
257
//        d_field( 0, 3 + i, "Name : ", D_STRING, MAX_PERSON_NAME,
-
 
258
//                 team_buf.members[i].name, valid, opr );
-
 
259
//        if( abort_flag )
-
 
260
//            return;
-
 
261
 
-
 
262
//        d_field( MAX_PERSON_NAME + 10, 3 + i, "Sex : ", D_SEX, 0,
-
 
263
//                 &team_buf.members[i].sex, valid, opr );
-
 
264
//        if( abort_flag )
-
 
265
//            return;
-
 
266
 
-
 
267
//        d_field( MAX_PERSON_NAME + 25, 3 + i, "Age : ", D_AGE, 3,
-
 
268
//                 &team_buf.members[i].age, valid, opr );
-
 
269
//        if( abort_flag )
-
 
270
//            return;
-
 
271
 
-
 
272
//        /*
-
 
273
//        **  Sum ages
-
 
274
//        **  -1 indicates invalid age
-
 
275
//        */
-
 
276
//        if ( age_sum >= 0 )
-
 
277
//        {
-
 
278
//            ushort age = team_buf.members[i].age;
-
 
279
//            if ( age > 0 && age < 255 )
-
 
280
//            {
-
 
281
//                age_sum += age;
-
 
282
//            }
-
 
283
//            else
-
 
284
//            {
-
 
285
//                age_sum = -1;
-
 
286
//            }
-
 
287
//        }
-
 
288
 
-
 
289
//    }
-
 
290
 
-
 
291
//    /*
-
 
292
//     **  Display / Update the leg informarion for each configured leg
-
 
293
//     */
-
 
294
//    for( j = 1; j <= config.num_legs; j++, i++ )
-
 
295
//    {
-
 
296
//        d_leg( 4 + i, j, &team_buf.leg[j], valid, operation );
-
 
297
//        if( abort_flag )
-
 
298
//        {
-
 
299
//            i += config.num_legs - j + 1;
-
 
300
//            break;
-
 
301
//        }
-
 
302
//    }
-
 
303
 
-
 
304
//    /*
-
 
305
//     **  Display the summary information
-
 
306
//     **      For the team
-
 
307
//     **      Event and class placing information
-
 
308
//     **      Total age
-
 
309
//     */
-
 
310
//    d_leg( 4 + i, 0, &team_buf.leg[0], valid, M_DISPLAY );
-
 
311
 
-
 
312
//    d_field( 0, 6 + i, "Event placing : ", D_NUMBER, 1,
-
 
313
//             &team_buf.leg[0].le_place, valid, M_DISPLAY );
-
 
314
//    d_field( 20, 6 + i, "Class placing : ", D_NUMBER, 1,
-
 
315
//             &team_buf.leg[0].lec_place, valid, M_DISPLAY );
-
 
316
//    d_field( 40, 6 + i, "Total Age : ", D_STRING, 5,
-
 
317
//             age_a(age_sum), valid, M_DISPLAY );
-
 
318
             
-
 
319
 
-
 
320
//    if( team_buf.flags.non_equestrian )
-
 
321
//        d_field( 0, 7 + i, "Non-Equestrian", D_NULL, 1, 0, valid, M_DISPLAY );
-
 
322
//    else if( team_buf.flags.disqualified )
-
 
323
//        d_field( 0, 7 + i, "Disqualified", D_NULL, 1, 0, valid, M_DISPLAY );
-
 
324
 
-
 
325
//}
-
 
326
 
-
 
327
/*========================================================================
-
 
328
 *
-
 
329
 *  Display / Update leg time information
-
 
330
 *
-
 
331
 *  Purpose:
-
 
332
 *      This function is called to display and update the leg
-
 
333
 *      time information.
-
 
334
 *
-
 
335
 *  Parameters:
-
 
336
 *      y           Screen position
-
 
337
 *      leg         Leg to process
-
 
338
 *      data        Leg data
-
 
339
 *      valid       Data valid flag
-
 
340
 *      operation   Operation to perform
-
 
341
 *
-
 
342
 *  Returns:
-
 
343
 *      Nothing
-
 
344
 *
-
 
345
 *========================================================================*/
-
 
346
//void d_leg( int y, int leg, leg_type * data, int valid, int operation )
-
 
347
//{
-
 
348
//    int         i;
-
 
349
//    int         oprs, oprf;
-
 
350
 
-
 
351
//    /*
-
 
352
//     **  Display the field header
-
 
353
//     */
-
 
354
//    if( operation == M_DISPLAY )
-
 
355
//    {
-
 
356
//        if( leg != 0 )
-
 
357
//        {
-
 
358
//            d_field( 0, y, "Leg ", D_NUMBER, 1, &leg, TRUE, M_DISPLAY );
-
 
359
//            d_field( 7, y, "", D_STRING, MAX_LEG_NAME,
-
 
360
//                     config.leg_name[leg - 1], TRUE, M_DISPLAY );
-
 
361
//        }
-
 
362
//        else
-
 
363
//            d_field( 0, y, "Overall team times", D_STRING, 0, "", TRUE, M_DISPLAY );
-
 
364
//    }
-
 
365
 
-
 
366
//    /*
-
 
367
//     **  If we are doing an update,. then ensure that all the team times
-
 
368
//     **  have been tested
-
 
369
//     */
-
 
370
 
-
 
371
//    if( operation & M_ALL )
-
 
372
//        test_times( &team_buf, 0 );              /* Set up all team times */
-
 
373
 
-
 
374
//    oprs = ( ( parallel_legs )
-
 
375
//             || ( operation & M_ALEGS )
-
 
376
//             || ( operation & M_LEGS ) ) ? M_UPDATE : M_DISPLAY;
-
 
377
 
-
 
378
//    oprf = ( operation & M_LEGS ) ? M_UPDATE : M_DISPLAY;
-
 
379
 
-
 
380
//    /*
-
 
381
//     **  if start time edited then flag as manual entry
-
 
382
//     **  redo calculations and refresh screen with new information
-
 
383
//     */
-
 
384
 
-
 
385
//    if( d_field
-
 
386
//        ( 25, y, data->manual ? "MS " : " S ", D_TIME, 8, &data->start, valid,
-
 
387
//          oprs ) )
-
 
388
//    {
-
 
389
//        data->manual = TRUE;
-
 
390
//        test_times( &team_buf, 0 );
-
 
391
//        for( i = leg; i <= config.num_legs; i++ )
-
 
392
//            d_leg( y + i - leg, i, &team_buf.leg[i], valid, M_DISPLAY );
-
 
393
//        d_leg( y + i - leg, 0, &team_buf.leg[0], valid, M_DISPLAY );
-
 
394
//    }
-
 
395
 
-
 
396
//    /*
-
 
397
//     **  If time changed then redo calcs and refresh screen
-
 
398
//     */
-
 
399
//    if( d_field( 37, y, "F ", D_TIME, 8, &data->end, valid, oprf ) )
-
 
400
//    {
-
 
401
//        set_times( &team_buf );
-
 
402
//        test_times( &team_buf, 0 );
-
 
403
//        for( i = leg; i <= config.num_legs; i++ )
-
 
404
//            d_leg( y + i - leg, i, &team_buf.leg[i], valid, M_DISPLAY );
-
 
405
//        d_leg( y + i - leg, 0, &team_buf.leg[0], valid, M_DISPLAY );
-
 
406
//    }
-
 
407
 
-
 
408
//    d_field( 48, y, "E ", D_TIME, 8, &data->elapsed, valid, M_DISPLAY );
-
 
409
//    if( leg == 0 )
-
 
410
//    {
-
 
411
//        d_field( 60, y, "", D_STRING, 10,
-
 
412
//                 ( team_buf.flags.bad_times ==
-
 
413
//                   TRUE ) ? "Incomplete" : "          ", valid, M_DISPLAY );
-
 
414
//    }
-
 
415
//    else
-
 
416
//    {
-
 
417
//        d_field( 60, y, "", D_NUMBER, 4, &data->le_place, valid, M_DISPLAY );
-
 
418
//        d_field( 65, y, "", D_NUMBER, 4, &data->l_place, valid, M_DISPLAY );
-
 
419
//        d_field( 70, y, "", D_NUMBER, 4, &data->lec_place, valid, M_DISPLAY );
-
 
420
//        d_field( 75, y, "", D_NUMBER, 4, &data->lc_place, valid, M_DISPLAY );
-
 
421
//    }
-
 
422
//}
-
 
423
 
-
 
424
/*========================================================================
-
 
425
 *
-
 
426
 *  Display / Update simple time information
-
 
427
 *
-
 
428
 *  Purpose:
-
 
429
 *      This function is called to display and update the leg
-
 
430
 *      time information.
-
 
431
 *
-
 
432
 *  Parameters:
-
 
433
 *      x, y        Screen position
-
 
434
 *      prompt      Prompt to display
-
 
435
 *      data        Address of time data
-
 
436
 *      valid       Data valid flag
-
 
437
 *
-
 
438
 *  Returns:
-
 
439
 *      Nothing
-
 
440
 *
-
 
441
 *========================================================================*/
-
 
442
//void d_time( int x, int y, const char *prompt, time_t *data, int valid )
-
 
443
//{
-
 
444
//        d_field( x, y, prompt, D_TIME, 8, ( char * ) data, valid, M_DISPLAY );
-
 
445
//        d_field( x, y, prompt, D_TIME, 8, ( char * ) data, valid, M_UPDATE );
-
 
446
//}
-
 
447
 
-
 
448
/*========================================================================
-
 
449
 *
-
 
450
 *  Display / Update field on the screen
-
 
451
 *
-
 
452
 *  Purpose:
-
 
453
 *      
-
 
454
 *      This function is called to display and update a field on the screen
-
 
455
 *      This routine will display a record from the team structure
-
 
456
 *      The type of data and other parameters is passed in
-
 
457
 *      This function is fundimental to the entire display subsystem
-
 
458
 *
-
 
459
 *
-
 
460
 *
-
 
461
 *  Parameters:
-
 
462
 *      x           The screen col
-
 
463
 *      y           The line number
-
 
464
 *      prompt      The field lable
-
 
465
 *      type        type of field
-
 
466
 *      length      Length of the numeric field
-
 
467
 *      data        Pointer to the data
-
 
468
 *      valid       data field is valid
-
 
469
 *      operation   Operation type
-
 
470
 *
-
 
471
 *  Returns:
-
 
472
 *      TRUE - Change has been made
-
 
473
 *
-
 
474
 *========================================================================*/
-
 
475
//bool d_field( int x,
-
 
476
//              int y,
-
 
477
//              const char *prompt,
-
 
478
//              int type, int length, const void *data, int valid, int operation )
-
 
479
//{
-
 
480
//    time_t      t;
-
 
481
//    int         i;
-
 
482
//    sex_type    s;
-
 
483
//    int         change = 0;
-
 
484
//    int         idata;
-
 
485
 
-
 
486
//    /*
-
 
487
//     **  Position the cursor and display the field title
-
 
488
//     */
-
 
489
//    cur( x, y );
-
 
490
//    printf( "%s", prompt );
-
 
491
 
-
 
492
//    /*
-
 
493
//     **  If the ABORT flag is set then DISPLAY the field
-
 
494
//     */
-
 
495
//    if( abort_flag )
-
 
496
//        operation = M_DISPLAY;
-
 
497
 
-
 
498
//    /*
-
 
499
//     **  Display the current field value
-
 
500
//     **      Only if the data field is valid
-
 
501
//     **      Only if the M_DISPLAY operation is requested
-
 
502
//     */
-
 
503
//    if( valid && ( operation == M_DISPLAY ) )
-
 
504
//    {
-
 
505
//        switch ( type )
-
 
506
//        {
-
 
507
//        case D_STRING:
-
 
508
//        case D_USTRING:
-
 
509
//            printf( "%-*.*s", length, length, (char *)data );
-
 
510
//            break;
-
 
511
 
-
 
512
//        case D_NUMBER:
-
 
513
//            printf( "%-*d", length, *( short * ) data );
-
 
514
//            break;
-
 
515
 
-
 
516
//        case D_SEX:
-
 
517
//            if( *( sex_type * ) data != unknown )
-
 
518
//                printf( "%s",
-
 
519
//                        ( *( sex_type * ) data ==
-
 
520
//                          male ) ? "Male" : "Female" );
-
 
521
//            break;
-
 
522
 
-
 
523
//        case D_TIME:
-
 
524
//            printf( "%s", time_a( *( time_t * ) data ) );
-
 
525
//            break;
-
 
526
 
-
 
527
//        case D_CLASS:
-
 
528
//            if( *( short * ) data > 0 )
-
 
529
//            {
-
 
530
//                printf( "%2.2s", config.team_class[( *( int * ) data ) - 1].abr );
-
 
531
//                printf( "  %-*.*s", LEN_CLASS_NAME, LEN_CLASS_NAME,
-
 
532
//                        config.team_class[( *( int * ) data ) - 1].full_name );
-
 
533
//            }
-
 
534
//            break;
-
 
535
 
-
 
536
//        case D_COUNTRY:
-
 
537
//            if( *( short * ) data > 0 )
-
 
538
//            {
-
 
539
//                printf( "%4.4s",
-
 
540
//                        config.country_name[( *( int * ) data ) - 1].abr );
-
 
541
//                printf( "  %-*.*s", LEN_CNTRY_NAME, LEN_CNTRY_NAME,
-
 
542
//                        config.country_name[( *( int * ) data ) -
-
 
543
//                                            1].full_name );
-
 
544
//            }
-
 
545
//            break;
-
 
546
 
-
 
547
//        case D_AGE:
-
 
548
//            if( *( uchar * ) data > 0 )
-
 
549
//            {
-
 
550
//                printf( "%-*d", length, *( uchar * ) data );
-
 
551
//            }
-
 
552
//            break;
-
 
553
            
-
 
554
 
-
 
555
//        case D_NULL:
-
 
556
//            break;
-
 
557
 
-
 
558
//        default:
-
 
559
//            printf( "Unknown data type" );
-
 
560
//            break;
-
 
561
//        }
-
 
562
//    }
-
 
563
 
-
 
564
//    /*
-
 
565
//     **  If updating the field then extract the required information
-
 
566
//     */
-
 
567
//    if( operation == M_UPDATE )
-
 
568
//    {
-
 
569
//        switch ( type )
-
 
570
//        {
-
 
571
//        case D_STRING:
-
 
572
//            change = ( getstring( length, (char *)data, Alphanum ) );
-
 
573
//            break;
-
 
574
 
-
 
575
//        case D_USTRING:
-
 
576
//            change = ( getstring( length, (char *)data, AlphnumUpper ) );
-
 
577
//            break;
-
 
578
 
-
 
579
//        case D_NUMBER:
-
 
580
//            idata = *(short *)data;
-
 
581
//            change = getnum( length, &idata );
-
 
582
//            if ( change )
-
 
583
//                *( short *)data = idata;
-
 
584
//            break;
-
 
585
 
-
 
586
//        case D_SEX:
-
 
587
//            if( ( s = getsex() ) != unknown )
-
 
588
//            {
-
 
589
//                change = ( *( sex_type * ) data != s );
-
 
590
//                *( sex_type * ) data = s;
-
 
591
//            }
-
 
592
//            break;
-
 
593
 
-
 
594
//        case D_TIME:
-
 
595
//            if( ( t = get_time(*( time_t * ) data) ) >= 0 )
-
 
596
//            {
-
 
597
//                change = ( *( time_t * ) data != t );
-
 
598
//                *( time_t * ) data = t;
-
 
599
//            }
-
 
600
//            break;
-
 
601
 
-
 
602
//        case D_CLASS:
-
 
603
//            if( ( i = getclass() ) != 0 )
-
 
604
//            {
-
 
605
//                change = *( short * ) data != i;
-
 
606
//                *( short * ) data = i;
-
 
607
//            }
-
 
608
//            break;
-
 
609
 
-
 
610
//        case D_COUNTRY:
-
 
611
//            if( ( i = getcountry() ) != 0 )
-
 
612
//            {
-
 
613
//                change = *( short * ) data != i;
-
 
614
//                *( short * ) data = i;
-
 
615
//            }
-
 
616
//            break;
-
 
617
 
-
 
618
//        case D_AGE:
-
 
619
//            idata = *(uchar *)data;
-
 
620
//            change = getnum( length, &idata );
-
 
621
//            if ( change )
-
 
622
//                *( uchar *)data = idata;
-
 
623
//            break;
-
 
624
            
-
 
625
 
-
 
626
//        case D_NULL:
-
 
627
//            break;
-
 
628
 
-
 
629
//        default:
-
 
630
//            printf( "Unknown data type" );
-
 
631
//            break;
-
 
632
//        }
-
 
633
 
-
 
634
//        /*
-
 
635
//         **  Having accepted the input now DISPLAY the data (once again)
-
 
636
//         **      Done to allow aborted field to re-display original values
-
 
637
//         */
-
 
638
//        d_field( x, y, prompt, type, length, data, TRUE, M_DISPLAY );
-
 
639
//    }
-
 
640
//    return ( change );
-
 
641
//}
-
 
642
 
-
 
643
/*========================================================================
-
 
644
 *
-
 
645
 *  Get a team number from the operator
-
 
646
 *
-
 
647
 *  Purpose:
-
 
648
 *      This function is called to Get a team number from the operator
-
 
649
 *          Prompt the operator for a team number
-
 
650
 *          Verify that the team number is valid
-
 
651
 *          Allow escape characters in the process
-
 
652
 *
-
 
653
 *          This routine will return TRUE if the team number is valid
-
 
654
 *          The team number is returned in the global variable "team"
-
 
655
 *
-
 
656
 *  Parameters:
-
 
657
 *      x,y         Screen coords
-
 
658
 *      prompt      Operator prompt
-
 
659
 *
-
 
660
 *  Returns:
-
 
661
 *      TRUE    : Number OK
-
 
662
 *
-
 
663
 *========================================================================*/
-
 
664
//bool g_tnum( int x, int y, const char *prompt )
-
 
665
//{
-
 
666
//    int         new_team = 0;                   /* team number that will be input */
-
 
667
 
-
 
668
//    while( TRUE )
-
 
669
//    {
-
 
670
//        team = 0;
-
 
671
//        abort_flag = FALSE;
-
 
672
//        cur( x, y );
-
 
673
//        printf( "%s : ", prompt );
-
 
674
//        //console_clreol();
-
 
675
//        if( !getnum( 6, &new_team ) )
-
 
676
//            return ( FALSE );                    /* No input */
-
 
677
 
-
 
678
//        /*
-
 
679
//         * verify that the team number is within the allowed numbers
-
 
680
//         */
-
 
681
 
-
 
682
//        if( !valid_field( new_team ) )
-
 
683
//        {
-
 
684
//            beep();
-
 
685
//            printf( "\nTeam %-1d is not valid", new_team );
-
 
686
//            continue;
-
 
687
//        }
-
 
688
//        team = new_team;
-
 
689
//        return ( TRUE );
-
 
690
//    }
-
 
691
//}
-
 
692
 
40
 
693
/*========================================================================
41
/*========================================================================
694
 *
42
 *
695
 *  Read a team record from disk
43
 *  Read a team record from disk
696
 *
44
 *
Line 812... Line 160...
812
 *      FALSE : Error encountered
160
 *      FALSE : Error encountered
813
 *
161
 *
814
 *========================================================================*/
162
 *========================================================================*/
815
bool init_team_data(void)
163
bool init_team_data(void)
816
{
164
{
-
 
165
    QString dataFileName(filepath);
-
 
166
    dataFileName.append(datfile);
817
 
167
 
818
    team_fd = open( datfile, OPEN_RW, 0 );
168
    team_fd = open( qPrintable(dataFileName), OPEN_RW, 0 );
819
    if( team_fd < 0 )
169
    if( team_fd < 0 )
820
    {
170
    {
821
        /*
171
        /*
822
         * file does not exist - create it 
172
         * file does not exist - create it 
823
         */
173
         */
-
 
174
        if (QMessageBox::Cancel == QMessageBox::question ( 0,
-
 
175
                                                       "Data File Load Error",
-
 
176
                                                       "Cannot load or read Team Data file.\n"
-
 
177
                                                       "If you continue a new (empty) file will be created\n"
-
 
178
                                                       "If you cancel then the application will terminate.",
-
 
179
                                                       QMessageBox::Ok | QMessageBox::Cancel
824
        printf( "The team data file does not exist.\n" );
180
                                                       ) )
-
 
181
        {
825
//        if( getyes( "Create the data file" ) )
182
            qDebug("Cancel to bad team data");
-
 
183
            exit(2);
-
 
184
        }
-
 
185
        else
826
//        {
186
        {
-
 
187
            qDebug("Create empty Team Data file");
827
//            team_fd = creat( datfile, 0664 );
188
            team_fd = creat( qPrintable(dataFileName), 0664 );
828
//            if( team_fd > 0 )
189
            if( team_fd > 0 )
829
//            {
190
            {
830
//                close( team_fd );                /* Close th file */
191
                close( team_fd );                /* Close the file */
831
//                team_fd = open( datfile, OPEN_RW, 644 );
192
                team_fd = open( qPrintable(dataFileName), OPEN_RW, 644 );
832
//                if( team_fd < 0 )
193
                if( team_fd < 0 )
-
 
194
                {
833
//                    perror( "Team datafile" );
195
                    perror( "Team datafile" );
-
 
196
                    qFatal( "Program aborted. Team Data error" );
-
 
197
                }
834
//            }
198
            }
835
//        }
199
        }
836
    }
200
    }
837
    return ( team_fd >= 0 );
201
    return ( team_fd >= 0 );
838
}
202
}
839
 
203
 
840
/*========================================================================
204
/*========================================================================