src/haptic/SDL_haptic.c
branchgsoc2008_force_feedback
changeset 2526 2d88b82ce781
parent 2524 1a55848ce198
child 2560 2274406ba792
     1.1 --- a/src/haptic/SDL_haptic.c	Thu Jul 17 16:08:46 2008 +0000
     1.2 +++ b/src/haptic/SDL_haptic.c	Fri Jul 18 08:00:16 2008 +0000
     1.3 @@ -440,6 +440,8 @@
     1.4           if (SDL_SYS_HapticNewEffect(haptic,&haptic->effects[i],effect) != 0) {
     1.5              return -1; /* Backend failed to create effect */
     1.6           }
     1.7 +
     1.8 +         SDL_memcpy(&haptic->effects[i].effect, effect, sizeof(SDL_HapticEffect));
     1.9           return i;
    1.10        }
    1.11     }
    1.12 @@ -471,11 +473,18 @@
    1.13        return -1;
    1.14     }
    1.15  
    1.16 +   /* Can't change type dynamically. */
    1.17 +   if (data->type != haptic->effects[effect].effect.type) {
    1.18 +      SDL_SetError("Haptic: Updating effect type is illegal.");
    1.19 +      return -1;
    1.20 +   }
    1.21 +
    1.22     /* Updates the effect */
    1.23     if (SDL_SYS_HapticUpdateEffect(haptic,&haptic->effects[effect],data) < 0) {
    1.24        return -1;
    1.25     }
    1.26  
    1.27 +   SDL_memcpy(&haptic->effects[effect].effect, data, sizeof(SDL_HapticEffect));
    1.28     return 0;
    1.29  }
    1.30