Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Scorelist.cc

Go to the documentation of this file.
00001 #include <qstring.h>
00002 #ifdef KDEVER
00003 #include <kapplication.h>
00004 #include <kstandarddirs.h>
00005 #endif
00006 #include "objects.h"
00007 
00008 FILE *Scorelist::open_file(char *mode) {
00009 //      QString file;
00010 //      file.sprintf("%s/kbill/scores", (const char *)locate("data",""));
00011 //      //kdDebug() << locate("data","") << endl;
00012 //      return fopen (file, mode);
00013 }
00014 
00015 void Scorelist::read() {
00016 //      FILE *scorefile = open_file("r");
00017 //      int i;
00018 //      if (scorefile) {
00019 //              for (i=0; i<10; i++) {
00020 //                      fgets (name[i], 21, scorefile);
00021 //                      fscanf (scorefile, "%d%d\n", &(level[i]), &(score[i]));
00022 //              }
00023 //              fclose(scorefile);
00024 //      }
00025 //      else
00026 //              for (i=0; i<10; i++) {
00027 //                      strcpy(name[i], "me");
00028 //                      level[i] = score[i] = 0;
00029 //              }
00030 }
00031 
00032 void Scorelist::write() {
00033 //      int i, j;
00034 //      FILE *scorefile = open_file("w");
00035 //      if (!scorefile) return;
00036 //      for (i=0; i<10; i++) {
00037 //              fputs(name[i], scorefile);
00038 //              for (j=strlen(name[i]); j<25; j++)
00039 //                      fputc(' ', scorefile);
00040 //              fprintf (scorefile, " %d %d\n", level[i], score[i]);
00041 //      }
00042 //      fclose(scorefile);
00043 }
00044 
00045 /*  Add new high score to list   */
00046 void Scorelist::recalc (char *str) {
00047 //      int i;
00048 //      if (score[9] >= game.score) return;
00049 //      for (i=9; i>0; i--) {
00050 //              if (score[i-1] < game.score) {
00051 //                      strcpy (name[i], name[i-1]);
00052 //                      level[i] = level[i-1];
00053 //                      score[i] = score[i-1];
00054 //              }
00055 //              else break;
00056 //      }
00057 //      strcpy (name[i], str);
00058 //      level[i] = game.level;
00059 //      score[i] = game.score;
00060 }
00061 
00062 void Scorelist::update() {
00063 //      char str[500], temp[40];
00064 //      int i, j;
00065 //      strcpy (str,"High Scores:\n\n");
00066 //      strcat (str, "Name                 Level    Score\n");
00067 //      for (i=0; i<10; i++) {
00068 //              strcat (str, name[i]);
00069 //              for (j=strlen(name[i]); j<21; j++) strcat (str, " ");
00070 //              sprintf (temp, "%5d  %7d\n", level[i], score[i]);
00071 //              strcat (str, temp);
00072 //      }
00073 //      ui.update_hsbox(str);
00074 }
00075 

Generated on Sat Nov 5 16:17:20 2005 for OPIE by  doxygen 1.4.2