src/haptic/win32/SDL_syshaptic.c
branchgsoc2008_force_feedback
changeset 2604 4eee4d565368
parent 2603 a84ce5ae8936
child 2605 0ea3be6e81a7
--- a/src/haptic/win32/SDL_syshaptic.c	Tue Aug 05 15:56:35 2008 +0000
+++ b/src/haptic/win32/SDL_syshaptic.c	Tue Aug 05 16:02:56 2008 +0000
@@ -568,14 +568,18 @@
       case SDL_HAPTIC_CARTESIAN:
          effect->dwFlags |= DIEFF_CARTESIAN;
          rglDir[0] = dir->dir[0];
-         rglDir[1] = dir->dir[1];
-         rglDir[2] = dir->dir[2];
+         if (naxes > 1)
+            rglDir[1] = dir->dir[1];
+         if (naxes > 2)
+            rglDir[2] = dir->dir[2];
          return 0;
       case SDL_HAPTIC_SPHERICAL:
          effect->dwFlags |= DIEFF_SPHERICAL;
          rglDir[0] = dir->dir[0];
-         rglDir[1] = dir->dir[1];
-         rglDir[2] = dir->dir[2];
+         if (naxes > 1)
+            rglDir[1] = dir->dir[1];
+         if (naxes > 2)
+            rglDir[2] = dir->dir[2];
          return 0;
 
       default: