pkgsrc/games/xpipeman/patches/patch-af

71 lines
1.4 KiB
Text

$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();