shithub: cstory

Download patch

ref: d04bd946490b611552c7d7baa2d42f8817caa32c
parent: 2b34cf7965df65eff6742ed0e1a0b0f37200c189
author: Clownacy <[email protected]>
date: Mon Jan 20 18:53:41 EST 2020

Use SDL_TICKS_PASSED for frame-limiting

This probably works-around overflow

--- a/src/Draw.cpp
+++ b/src/Draw.cpp
@@ -63,13 +63,13 @@
 		// Framerate limiter
 		timeNow = SDL_GetTicks();
 
-		if (timeNow >= timePrev + FRAMERATE)
+		if (SDL_TICKS_PASSED(timeNow, timePrev + FRAMERATE))
 			break;
 
 		SDL_Delay(1);
 	}
 
-	if (timeNow >= timePrev + 100)
+	if (SDL_TICKS_PASSED(timeNow, timePrev + 100))
 		timePrev = timeNow;	// If the timer is freakishly out of sync, panic and reset it, instead of spamming frames for who-knows how long
 	else
 		timePrev += FRAMERATE;