diff options
| author | Dusan Durech <dusan.d@centrum.sk> | 2008-11-01 22:11:44 +0100 |
|---|---|---|
| committer | Dusan Durech <dusan.d@centrum.sk> | 2008-11-01 22:11:44 +0100 |
| commit | 4c77447a924530f5bad212e39535adb373d5bcf4 (patch) | |
| tree | 957f74901c05fa6d0d0371d7cac6d99a433a1d7f /src/client/interface.c | |
| parent | b361c7bc3532f22caf053b779ba970de8c346893 (diff) | |
Hack for timer being too busy after loading arena
Diffstat (limited to 'src/client/interface.c')
| -rw-r--r-- | src/client/interface.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/client/interface.c b/src/client/interface.c index d2f99fb..75efca9 100644 --- a/src/client/interface.c +++ b/src/client/interface.c @@ -23,6 +23,7 @@ static bool_t isInterfaceInit = FALSE; // flag, kterym se ridi zarazovani klaves do bufferu bool_t keyboardBufferEnabled = FALSE; +bool_t isSlowHack; bool_t isInterfaceInicialized() { @@ -116,6 +117,7 @@ int initSDL() srand((unsigned) time(NULL)); isInterfaceInit = TRUE; + isSlowHack = FALSE; return 0; } @@ -192,6 +194,33 @@ static void action_esc() } */ +void activeSlowHack() +{ + isSlowHack = TRUE; +} + +static void slowHackRoutine() +{ + static time_t lastTime = 0; + + if( lastTime == 0 ) + { + lastTime = getMyTime(); + return; + } + + if( getMyTime() - lastTime >= 50 ) + { + lastTime = 0; + isSlowHack = FALSE; + return; + } + + //printf("SLOW HACK : %d\n", (getMyTime() - lastTime)); + + lastTime = getMyTime(); +} + int eventAction() { SDL_Event event; @@ -223,6 +252,12 @@ int eventAction() case SDL_USEREVENT: switch (event.user.code) { case USR_EVT_TIMER: + if( isSlowHack ) + { + slowHackRoutine(); + break; + } + drawScreen(); eventScreen(); eventHotKey(); |