|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T d
Length: 1556 (0x614)
Types: TextFile
Names: »display_high.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
└─⟦this⟧ »EUUGD18/General/Tetris/display_high.c«
/*
** written by adam margulies vespa@ssyx.ucsc.edu
** {...}!ucbvax!ucscc!ssyx!vespa
**
** permission is granted to freely distribute this code provided that you:
**
** 1) don't charge for it
** 2) leave my name and header on it
** 3) clearly document your changes and place your name on them
**
*/
/*
** display_high.c
**
** Displays the high score list
**
*/
#include "tetris.h"
display_high()
{
FILE *fp, *fopen();
int counter, i;
cls();
mvaddstr(0,15," _____ ____ _____ ____ __ ____");
mvaddstr(1,15,"/\\ \\ /\\ \\/\\ \\ /\\ \\ /\\ \\ /\\ \\");
mvaddstr(2,15,"\\/_ _// / __/\\/_ _// / // / // / __/");
mvaddstr(3,15,"/ / / / / __/ / / / / / _// / //\\/_ /");
mvaddstr(4,15,"\\/_/ \\/___/ \\/_/ \\/___\\ \\/_/ \\/___/");
csr_draw(0,14,4,60);
resetty();
printf("\n");
printf("\n");
if ((fp = fopen(HIGHSCOREFILE, "r")) == NULL){
SIGHOLD(14);
cls();
csr(23,0);
resetty();
fprintf(stderr, "%s\n", HIGHSCOREFILE);
perror("opening highscore file");
exit(3);
}
flock(fileno(fp), LOCK_EX);
for(counter=0;counter<15;counter++){
fscanf(fp, "%d\n", &high_score[counter]);
fscanf(fp, "%s\n", high_user[counter]);
fgets(high_name[counter], 255, fp);
for (i=0; i<255; i++)
if (high_name[counter][i] == '\n')
high_name[counter][i] = '\0';
printf(" %2.2d. %7.7d %40.40s (%s) \n", counter+1,
high_score[counter], high_name[counter], high_user[counter]);
}
flock(fileno(fp), LOCK_UN);
fclose(fp);
}