summaryrefslogtreecommitdiff
path: root/games/rocksndiamonds/patches/patch-ak
blob: 75e140a8f916739ebb83525ba0c335b3940ba0f8 (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
$NetBSD: patch-ak,v 1.2 2003/08/05 15:12:47 adam Exp $

--- src/libgame/system.c.orig	2003-08-04 23:01:27.000000000 +0200
+++ src/libgame/system.c
@@ -1163,10 +1163,16 @@ inline void InitJoysticks()
   return;	/* joysticks generally deactivated by compile-time directive */
 #endif
 
+  /* pkgsrc: InitJoystick will be called more than once, so reset
+   * the state variable 'joystick' only if there's no joystick available
+   * (yet).
+   */
   /* always start with reliable default values */
-  joystick.status = JOYSTICK_NOT_AVAILABLE;
-  for (i=0; i<MAX_PLAYERS; i++)
-    joystick.fd[i] = -1;		/* joystick device closed */
+  if (joystick.status == JOYSTICK_NOT_AVAILABLE)
+  {
+    for (i=0; i<MAX_PLAYERS; i++)
+      joystick.fd[i] = -1;		/* joystick device closed */
+  }
 
 #if defined(TARGET_SDL)
   SDLInitJoysticks();