File: book.c.patch

package info (click to toggle)
sjeng 11.2-15
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,436 kB
  • sloc: ansic: 13,378; sh: 324; makefile: 29
file content (55 lines) | stat: -rw-r--r-- 1,443 bytes parent folder | download | duplicates (5)
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
Author: Lukas Geyer <geyer@math.uni-dortmund.de>
Description: Adjust book locations (book.c).
--- sjeng-11.2.orig/book.c
+++ sjeng-11.2/book.c
@@ -21,6 +21,8 @@
 
 */
 
+#include <unistd.h>
+
 #include "sjeng.h"
 #include "protos.h"
 #include "extvars.h"
@@ -38,6 +40,8 @@
 #define book_solid 4         /* =   */
 #define book_murky 5         /* ?!  */
 
+#define BOOK_PATH "/usr/share/games/sjeng/"
+
 int init_book (void) {
 
    /* simply read all the book moves into a book array.  The book will be
@@ -63,27 +67,27 @@
 
    if (Variant == Normal)
      {
-       if ((f_book = fopen ("normal.opn", "r")) == NULL)
+       if ((f_book = fopen (BOOK_PATH "normal.opn", "r")) == NULL)
 	 return FALSE;
      }
    else if (Variant == Crazyhouse)
      {
-       if ((f_book = fopen ("zh.opn", "r")) == NULL)
+       if ((f_book = fopen (BOOK_PATH "zh.opn", "r")) == NULL)
 	 return FALSE;
      }
    else if (Variant == Suicide)
      {
-       if ((f_book = fopen ("suicide.opn", "r")) == NULL)
+       if ((f_book = fopen (BOOK_PATH "suicide.opn", "r")) == NULL)
 	 return FALSE;
      }
    else if (Variant == Losers)
    {
-       if ((f_book = fopen ("losers.opn", "r")) == NULL)
+       if ((f_book = fopen (BOOK_PATH "losers.opn", "r")) == NULL)
 	 return FALSE;
    }
    else
      {
-       if ((f_book = fopen ("bug.opn", "r")) == NULL)
+       if ((f_book = fopen (BOOK_PATH "bug.opn", "r")) == NULL)
 	 return FALSE;
      }