shithub: choc

Download patch

ref: 66d22ab030630378c2feb57a5d8cd65669713c2a
parent: e4127187e0e5de9c94a92301b4dc780bc9153fb8
author: Simon Howard <fraggle@gmail.com>
date: Thu Jun 14 17:03:22 EDT 2007

Don't send joystick updates when the joystick is disabled. Shut up
warning caused by missing header.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 904

--- a/src/i_joystick.c
+++ b/src/i_joystick.c
@@ -163,13 +163,16 @@
 
 void I_UpdateJoystick(void)
 {
-    event_t ev;
+    if (joystick != NULL)
+    {
+        event_t ev;
 
-    ev.type = ev_joystick;
-    ev.data1 = GetButtonState();
-    ev.data2 = GetAxisState(joystick_x_axis, joystick_x_invert);
-    ev.data3 = GetAxisState(joystick_y_axis, joystick_y_invert);
+        ev.type = ev_joystick;
+        ev.data1 = GetButtonState();
+        ev.data2 = GetAxisState(joystick_x_axis, joystick_x_invert);
+        ev.data3 = GetAxisState(joystick_y_axis, joystick_y_invert);
 
-    D_PostEvent(&ev);
+        D_PostEvent(&ev);
+    }
 }
 
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -37,6 +37,7 @@
 #include "doomdef.h"
 #include "doomstat.h"
 #include "d_main.h"
+#include "i_joystick.h"
 #include "i_scale.h"
 #include "i_system.h"
 #include "i_swap.h"