Diffstat (limited to 'noncore/games/kbill/Scorelist.cc') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/games/kbill/Scorelist.cc | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/noncore/games/kbill/Scorelist.cc b/noncore/games/kbill/Scorelist.cc new file mode 100644 index 0000000..8825373 --- a/dev/null +++ b/noncore/games/kbill/Scorelist.cc | |||
@@ -0,0 +1,75 @@ | |||
1 | #include <qstring.h> | ||
2 | #ifdef KDEVER | ||
3 | #include <kapplication.h> | ||
4 | #include <kstandarddirs.h> | ||
5 | #endif | ||
6 | #include "objects.h" | ||
7 | |||
8 | FILE *Scorelist::open_file(char *mode) { | ||
9 | // QString file; | ||
10 | // file.sprintf("%s/kbill/scores", (const char *)locate("data","")); | ||
11 | // //kdDebug() << locate("data","") << endl; | ||
12 | // return fopen (file, mode); | ||
13 | } | ||
14 | |||
15 | void Scorelist::read() { | ||
16 | // FILE *scorefile = open_file("r"); | ||
17 | // int i; | ||
18 | // if (scorefile) { | ||
19 | // for (i=0; i<10; i++) { | ||
20 | // fgets (name[i], 21, scorefile); | ||
21 | // fscanf (scorefile, "%d%d\n", &(level[i]), &(score[i])); | ||
22 | // } | ||
23 | // fclose(scorefile); | ||
24 | // } | ||
25 | // else | ||
26 | // for (i=0; i<10; i++) { | ||
27 | // strcpy(name[i], "me"); | ||
28 | // level[i] = score[i] = 0; | ||
29 | // } | ||
30 | } | ||
31 | |||
32 | void Scorelist::write() { | ||
33 | // int i, j; | ||
34 | // FILE *scorefile = open_file("w"); | ||
35 | // if (!scorefile) return; | ||
36 | // for (i=0; i<10; i++) { | ||
37 | // fputs(name[i], scorefile); | ||
38 | // for (j=strlen(name[i]); j<25; j++) | ||
39 | // fputc(' ', scorefile); | ||
40 | // fprintf (scorefile, " %d %d\n", level[i], score[i]); | ||
41 | // } | ||
42 | // fclose(scorefile); | ||
43 | } | ||
44 | |||
45 | /* Add new high score to list */ | ||
46 | void Scorelist::recalc (char *str) { | ||
47 | // int i; | ||
48 | // if (score[9] >= game.score) return; | ||
49 | // for (i=9; i>0; i--) { | ||
50 | // if (score[i-1] < game.score) { | ||
51 | // strcpy (name[i], name[i-1]); | ||
52 | // level[i] = level[i-1]; | ||
53 | // score[i] = score[i-1]; | ||
54 | // } | ||
55 | // else break; | ||
56 | // } | ||
57 | // strcpy (name[i], str); | ||
58 | // level[i] = game.level; | ||
59 | // score[i] = game.score; | ||
60 | } | ||
61 | |||
62 | void Scorelist::update() { | ||
63 | // char str[500], temp[40]; | ||
64 | // int i, j; | ||
65 | // strcpy (str,"High Scores:\n\n"); | ||
66 | // strcat (str, "Name Level Score\n"); | ||
67 | // for (i=0; i<10; i++) { | ||
68 | // strcat (str, name[i]); | ||
69 | // for (j=strlen(name[i]); j<21; j++) strcat (str, " "); | ||
70 | // sprintf (temp, "%5d %7d\n", level[i], score[i]); | ||
71 | // strcat (str, temp); | ||
72 | // } | ||
73 | // ui.update_hsbox(str); | ||
74 | } | ||
75 | |||