Make SDL_SYS_HapticMouse() count device indexes like HapticByDevIndex().
authorRyan C. Gordon <icculus@icculus.org>
Wed, 05 Feb 2014 18:36:40 -0500
changeset 8177 fa40b7b0a1c0
parent 8176 9efac2fd6ed6
child 8178 d74974cacb9b
Make SDL_SYS_HapticMouse() count device indexes like HapticByDevIndex().
src/haptic/darwin/SDL_syshaptic.c
--- a/src/haptic/darwin/SDL_syshaptic.c	Wed Feb 05 01:02:09 2014 -0500
+++ b/src/haptic/darwin/SDL_syshaptic.c	Wed Feb 05 18:36:40 2014 -0500
@@ -571,15 +571,15 @@
 int
 SDL_SYS_HapticMouse(void)
 {
-    int device_index = 0;
+    int device_index = numhaptics-1;
     SDL_hapticlist_item *item;
 
     for (item = SDL_hapticlist; item; item = item->next) {
         if ((item->usagePage == kHIDPage_GenericDesktop) &&
-            (item->usage == kHIDUsage_GD_Mouse))
+            (item->usage == kHIDUsage_GD_Mouse)) {
             return device_index;
-
-        ++device_index;
+        }
+        device_index--;
     }
 
     return -1;