Fixed linux implementation of SDL_HapticStopAll. gsoc2008_force_feedback
authorEdgar Simo <bobbens@gmail.com>
Sun, 24 Aug 2008 17:41:22 +0000
branchgsoc2008_force_feedback
changeset 2647e871cff1e3d2
parent 2646 9408be170bff
child 2648 6d705ec89fb6
Fixed linux implementation of SDL_HapticStopAll.
src/haptic/linux/SDL_syshaptic.c
     1.1 --- a/src/haptic/linux/SDL_syshaptic.c	Sun Aug 24 17:32:50 2008 +0000
     1.2 +++ b/src/haptic/linux/SDL_syshaptic.c	Sun Aug 24 17:41:22 2008 +0000
     1.3 @@ -916,16 +916,18 @@
     1.4  int
     1.5  SDL_SYS_HapticStopAll(SDL_Haptic * haptic)
     1.6  {
     1.7 -   int i, ret;;
     1.8 +   int i, ret;
     1.9  
    1.10 +   /* Linux does not support this natively so we have to loop. */
    1.11     for (i=0; i<haptic->neffects; i++) {
    1.12 -      ret = SDL_SYS_HapticStopEffect(haptic, &haptic->effects[i]);
    1.13 -      if (ret < 0) {
    1.14 -         SDL_SetError("Haptic: Error while trying to stop all playing effects.");
    1.15 -         return -1;
    1.16 +      if (haptic->effects[i].hweffect != NULL) {
    1.17 +         ret = SDL_SYS_HapticStopEffect(haptic, &haptic->effects[i]);
    1.18 +         if (ret < 0) {
    1.19 +            SDL_SetError("Haptic: Error while trying to stop all playing effects.");
    1.20 +            return -1;
    1.21 +         }
    1.22        }
    1.23     }
    1.24 -
    1.25     return 0;
    1.26  }
    1.27