changeset 2647:e871cff1e3d2 gsoc2008_force_feedback

Fixed linux implementation of SDL_HapticStopAll.
author Edgar Simo <bobbens@gmail.com>
date Sun, 24 Aug 2008 17:41:22 +0000
parents 9408be170bff
children 6d705ec89fb6
files src/haptic/linux/SDL_syshaptic.c
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/haptic/linux/SDL_syshaptic.c	Sun Aug 24 17:32:50 2008 +0000
+++ b/src/haptic/linux/SDL_syshaptic.c	Sun Aug 24 17:41:22 2008 +0000
@@ -916,16 +916,18 @@
 int
 SDL_SYS_HapticStopAll(SDL_Haptic * haptic)
 {
-   int i, ret;;
+   int i, ret;
 
+   /* Linux does not support this natively so we have to loop. */
    for (i=0; i<haptic->neffects; i++) {
-      ret = SDL_SYS_HapticStopEffect(haptic, &haptic->effects[i]);
-      if (ret < 0) {
-         SDL_SetError("Haptic: Error while trying to stop all playing effects.");
-         return -1;
+      if (haptic->effects[i].hweffect != NULL) {
+         ret = SDL_SYS_HapticStopEffect(haptic, &haptic->effects[i]);
+         if (ret < 0) {
+            SDL_SetError("Haptic: Error while trying to stop all playing effects.");
+            return -1;
+         }
       }
    }
-
    return 0;
 }