cli: fix a freeze when turning FPS limiting back on after some boost mode

(regression in r3944)
This commit is contained in:
pengvado 2011-04-15 15:31:50 +00:00
parent a99026df03
commit e1c70f0ac6
1 changed files with 3 additions and 3 deletions

View File

@ -755,11 +755,11 @@ int main(int argc, char ** argv) {
now = SDL_GetTicks();
#endif
int delay = (limiter_tick0 + limiter_frame_counter*1000/FPS_LIMITER_FPS) - now;
if (delay > 0) {
SDL_Delay(delay);
} else if (delay < -500) { // reset if we fall too far behind don't want to run super fast until we catch up
if (delay < -500 || delay > 100) { // reset if we fall too far behind don't want to run super fast until we catch up
limiter_tick0 = now;
limiter_frame_counter = 0;
} else if (delay > 0) {
SDL_Delay(delay);
}
}
// always count frames, we'll mess up if the limiter gets turned on later otherwise