summaryrefslogtreecommitdiff
path: root/noncore/games/kbill/Scorelist.cc
blob: 88253736f014881e9ca0a744681c437fb5e8bbb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include <qstring.h>
#ifdef KDEVER
#include <kapplication.h>
#include <kstandarddirs.h>
#endif
#include "objects.h"

FILE *Scorelist::open_file(char *mode) {
// 	QString file;
// 	file.sprintf("%s/kbill/scores", (const char *)locate("data",""));
// 	//kdDebug() << locate("data","") << endl;
// 	return fopen (file, mode);
}

void Scorelist::read() {
// 	FILE *scorefile = open_file("r");
// 	int i;
// 	if (scorefile) {
// 		for (i=0; i<10; i++) {
// 			fgets (name[i], 21, scorefile);
// 			fscanf (scorefile, "%d%d\n", &(level[i]), &(score[i]));
// 		}
// 		fclose(scorefile);
// 	}
// 	else
// 		for (i=0; i<10; i++) {
// 			strcpy(name[i], "me");
// 			level[i] = score[i] = 0;
// 		}
}

void Scorelist::write() {
// 	int i, j;
// 	FILE *scorefile = open_file("w");
// 	if (!scorefile) return;
// 	for (i=0; i<10; i++) {
// 		fputs(name[i], scorefile);
// 		for (j=strlen(name[i]); j<25; j++)
// 			fputc(' ', scorefile);
// 		fprintf (scorefile, " %d %d\n", level[i], score[i]);
// 	}
// 	fclose(scorefile);
}

/*  Add new high score to list   */
void Scorelist::recalc (char *str) {
// 	int i;
// 	if (score[9] >= game.score) return;
// 	for (i=9; i>0; i--) {
// 		if (score[i-1] < game.score) {
// 			strcpy (name[i], name[i-1]);
// 			level[i] = level[i-1];
// 			score[i] = score[i-1];
// 		}
// 		else break;
// 	}
// 	strcpy (name[i], str);
// 	level[i] = game.level;
// 	score[i] = game.score;
}

void Scorelist::update() {
// 	char str[500], temp[40];
// 	int i, j;
// 	strcpy (str,"High Scores:\n\n");
// 	strcat (str, "Name                 Level    Score\n");
// 	for (i=0; i<10; i++) {
// 		strcat (str, name[i]);
// 		for (j=strlen(name[i]); j<21; j++) strcat (str, " ");
// 		sprintf (temp, "%5d  %7d\n", level[i], score[i]);
// 		strcat (str, temp);
// 	}
// 	ui.update_hsbox(str);
}