Package: gravitywars / 1.102-34

010_highscores.diff Patch series | download
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
Index: gravitywars-1.102/GravityWars101.c
===================================================================
--- gravitywars-1.102.orig/GravityWars101.c	2006-05-16 06:33:23.000000000 +0200
+++ gravitywars-1.102/GravityWars101.c	2006-05-16 06:33:58.000000000 +0200
@@ -215,14 +215,13 @@
       if (ShipScore>HighScore) {
 	HighScore=ShipScore;
 
-	strcpy(filename,gamename);
-	strcpy(&filename[gamenamelen],"data/hscore.gw");
-	if ( ( fileptr=fopen(filename,"w") )!=NULL) {
-	  fprintf(fileptr,"%d\n",ShipScore);
+	strcpy(filename,"/var/games/gravitywars/hscore.gw");
+	if ( ( fileptr=fopen(filename,"w") ) != NULL) {
+	  fprintf(fileptr,"%ld\n",ShipScore);
 	  fclose(fileptr);
 	}
 	else {
-	  printf("Can't write the HighScore!!!!");
+	  printf("Can't write the HighScore!!!!\n");
 	  doPanic();
 	}
       }
Index: gravitywars-1.102/init.c
===================================================================
--- gravitywars-1.102.orig/init.c	2006-05-16 06:33:20.000000000 +0200
+++ gravitywars-1.102/init.c	2006-05-16 06:34:00.000000000 +0200
@@ -486,8 +486,8 @@
     exit(1);
   }
 
-  strcpy(filename,gamename);
-  strcpy(&filename[gamenamelen],"data/hscore.gw");
+  hs[0]='\0';
+  strcpy(filename,"/var/games/gravitywars/hscore.gw");
   if ( ( fileptr=fopen(filename,"r") )!=NULL) {
     fscanf(fileptr,"%s",hs);
     fclose(fileptr);
@@ -498,7 +498,7 @@
   }
 
   HighScore=atoi(hs);
-
+  return 0;
 }
 
 /*------------------------------------------------------------------- rotGfx */