diff options
Diffstat (limited to 'src/timing.c')
-rw-r--r-- | src/timing.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/timing.c b/src/timing.c index 01b0aee..896b973 100644 --- a/src/timing.c +++ b/src/timing.c @@ -8,8 +8,12 @@ inline tick_t getGameCurrentTick(Uint32 startTime_ms) { return t/TICK_DURATION_MS; } -inline void waitForNextTick(Uint32 timeBefore_ms, Uint32 drift_ms) { +inline int waitForNextTick(Uint32 timeBefore_ms, Uint32 drift_ms) { int delay_ms; delay_ms=TICK_DURATION_MS-(SDL_GetTicks()-timeBefore_ms)+drift_ms; - if (delay_ms>0) SDL_Delay(delay_ms); //TODO Si le client rame trop, faut décrocher la partie + if (delay_ms>0) { + SDL_Delay(delay_ms); //TODO Si le client rame trop, faut décrocher la partie + return delay_ms; + } + return 0; } |