summaryrefslogtreecommitdiff
path: root/games/xpipeman/patches/patch-af
blob: 6cc731cde19bcb0ee8db5f80376bec7023f74eb9 (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
$NetBSD: patch-af,v 1.4 2006/08/02 19:58:54 kristerw Exp $

--- score.c.orig	1991-09-13 22:32:12.000000000 +0200
+++ score.c	2006-08-02 21:55:55.000000000 +0200
@@ -70,7 +70,7 @@
 	write_out_scores();
 
 static FILE *scorefile = 0;
-char *score_filename;
+extern AppData app_data;
 
 /*----------------------------------------------------------------------*/
 
@@ -87,7 +87,7 @@
   }
   if(scorefile) {
 #ifndef SYSV
-    flock(scorefile->_file, LOCK_UN);
+    flock(fileno(scorefile), LOCK_UN);
 #endif
     fclose(scorefile);
     show_scores();
@@ -95,17 +95,17 @@
 }
 
 
-static void
+void
 load_scores()
 {
   int i = 0;
 
-  if( !(scorefile = fopen(score_filename,"r+")) ) {
-    scorefile = fopen(score_filename, "w");
+  if( !(scorefile = fopen(app_data.score_filename,"r+")) ) {
+    scorefile = fopen(app_data.score_filename, "w");
     return;
   }
 #ifndef SYSV
-  flock(scorefile->_file, LOCK_EX);
+  flock(fileno(scorefile), LOCK_EX);
 #endif
   while( fgets(scores[i].score,6,scorefile) 	/* get score */
       && fgets(scores[i].name,26,scorefile) 	/* get name */
@@ -118,7 +118,7 @@
 }
 
 
-static void
+void
 new_high_score(current_score,level)
   int current_score,level;
 {
@@ -151,7 +151,7 @@
 }
 
 
-static void
+void
 write_out_scores()
 {
   int i;
@@ -281,7 +281,7 @@
 
   if(scorefile) {
 #ifndef SYSV
-    flock(scorefile->_file, LOCK_UN);
+    flock(fileno(scorefile), LOCK_UN);
 #endif
     fclose(scorefile);
     show_scores();