Added a macro SDL_TICKS_PASSED() to correctly compare two 32-bit tick values.

Went through the code and used the macro and fixed a couple places that were using incorrect timestamp comparisons.
This commit is contained in:
Sam Lantinga
2013-10-20 20:42:55 -07:00
parent 04e170ceb7
commit f5fa492e26
12 changed files with 23 additions and 21 deletions

View File

@@ -1567,7 +1567,7 @@ SDL_RunXInputHaptic(void *arg)
SDL_LockMutex(hwdata->mutex);
/* If we're currently running and need to stop... */
if (hwdata->stopTicks) {
if ((hwdata->stopTicks != SDL_HAPTIC_INFINITY) && (hwdata->stopTicks < SDL_GetTicks())) {
if ((hwdata->stopTicks != SDL_HAPTIC_INFINITY) && SDL_TIMESTAMP_PASSED(SDL_GetTicks(), hwdata->stopTicks)) {
XINPUT_VIBRATION vibration = { 0, 0 };
hwdata->stopTicks = 0;
XINPUTSETSTATE(hwdata->userid, &vibration);