#include "timing.h" inline tick_t getGameCurrentTick(Uint32 startTime_ms) { /* char buf[128]; sprintf(buf, "SDL_GetTicks()==%i, startTime_ms==%i, TICK_DURATION_MS==%i", SDL_GetTicks(), startTime_ms, TICK_DURATION_MS); logs(LOG_DEBUG, buf);*/ tick_t t = SDL_GetTicks()-startTime_ms; //FIXME Débordements possibles ?!? return t/TICK_DURATION_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 return delay_ms; } return 0; } inline Uint32 updateDriftOnEventReception(tick_t localCurrentTick, tick_t eventServerTick) { //FIXME : WTF dans cette gestion de temps ??? Ou est l'implémentation réelle telle que décrite dans archi.txt ?? return localCurrentTick - eventServerTick; }