diff src/haptic/linux/SDL_syshaptic.c @ 2519:af9df9662807 gsoc2008_force_feedback

More explicit with iterations and length. Added spherical coordinates (not available on linux).
author Edgar Simo <bobbens@gmail.com>
date Tue, 15 Jul 2008 15:53:48 +0000
parents 07a5b225b9c9
children 366d84fdf8d1
line wrap: on
line diff
--- a/src/haptic/linux/SDL_syshaptic.c	Tue Jul 15 11:24:25 2008 +0000
+++ b/src/haptic/linux/SDL_syshaptic.c	Tue Jul 15 15:53:48 2008 +0000
@@ -672,17 +672,15 @@
  * Runs an effect.
  */
 int
-SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect * effect, int iterations)
+SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect * effect,
+                        Uint32 iterations)
 {
    struct input_event run;
 
    /* Prepare to run the effect */
    run.type = EV_FF;
    run.code = effect->hweffect->effect.id;
-   if (iterations == SDL_HAPTIC_INFINITY)
-      run.value = INT_MAX;
-   else
-      run.value = iterations;
+   run.value = (iterations > INT_MAX) ? INT_MAX : iterations;
 
    if (write(haptic->hwdata->fd, (const void*) &run, sizeof(run)) < 0) {
       SDL_SetError("Haptic: Unable to run the effect: %s", strerror(errno));