summaryrefslogtreecommitdiff
path: root/games/knightcap/patches/patch-ad
blob: 8ad85c006a9c11c623d16d556be324c18fa88d5f (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
72
73
74
75
76
77
78
$NetBSD: patch-ad,v 1.2 2009/08/01 05:29:59 hasso Exp $

--- knightcap.h.orig	1998-05-18 02:09:21 +0300
+++ knightcap.h	2009-08-01 07:33:40 +0300
@@ -92,7 +92,22 @@ typedef short etype;
 #define USE_PBRAIN 1
 #endif
 
-#define BRAIN_FILE "brain.dat"
+/*
+ * Support finding brain.dat in another directory (BRAIN_DIR) determined
+ * at compile-time.
+ */
+#ifndef BRAIN_DIR
+#define BRAIN_DIR "./"
+#endif
+#define BRAIN_FILE BRAIN_DIR "brain.dat"
+
+/*
+ * Support finding endgame tables in another direcotry (TB_DIR) determined
+ * at compile-time.
+ */
+#ifndef TB_DIR
+#define TB_DIR "../EGTB"
+#endif
 
 #ifndef RESIGN_VALUE
 #define RESIGN_VALUE (ROOK_VALUE)
@@ -296,10 +311,19 @@ typedef short etype;
 
 #define INITIAL_MATERIAL (KING_VALUE + QUEEN_VALUE + 2*ROOK_VALUE + 2*BISHOP_VALUE + 2*KNIGHT_VALUE + 8*PAWN_VALUE)
 
+#if defined(__NetBSD__)
+#include <machine/types.h>
+
+typedef int16_t int16;
+typedef u_int16_t uint16;
+typedef u_int32_t uint32;
+typedef u_int64_t uint64;
+#else
 typedef short int16;
 typedef unsigned short uint16;
 typedef unsigned uint32;
 typedef unsigned long long uint64;
+#endif
 
 typedef enum {B_KING = -6,B_QUEEN = -5,B_ROOK = -4,B_BISHOP = -3,
 	      B_KNIGHT = -2,B_PAWN = -1,
@@ -632,6 +656,11 @@ static inline int imax(int i1, int i2)
 	return i1 > i2? i1 : i2;
 }
 
+#if defined(__DragonFly__)
+#include <sys/param.h>
+#endif
+
+#if !(defined(__DragonFly__) && __DragonFly_version >= 200204)
 static inline float fmin(float i1, float i2)
 {
 	return i1 > i2? i2 : i1;
@@ -641,6 +670,7 @@ static inline float fmax(float i1, float
 {
 	return i1 > i2? i1 : i2;
 }
+#endif
 
 static inline etype emin(etype i1, etype i2)
 {
@@ -884,4 +914,8 @@ static inline int pop_count32(uint32 x)
 	return pop_count16((x) & 0xFFFF) + pop_count16((x) >> 16);
 }
 
-
+/*
+ * Make window_size global so that the GL board can be displayed at
+ * correct initial size.  window_size is defined in knightcap.c.
+ */
+extern int window_size;