foxygit / doom Log in
commit 66d22ab030630378c2feb57a5d8cd65669713c2a
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Thu Jun 14 21:03:22 2007 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Thu Jun 14 21:03:22 2007 +0000

    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
---
 src/i_joystick.c | 15 +++++++++------
 src/i_video.c    |  1 +
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/i_joystick.c b/src/i_joystick.c
index 3eb9069d..b6333334 100644
--- a/src/i_joystick.c
+++ b/src/i_joystick.c
@@ -163,13 +163,16 @@ static int GetAxisState(int axis, int invert)

 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);
+    }
 }

diff --git a/src/i_video.c b/src/i_video.c
index 0dfccfa3..1666171e 100644
--- 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"