diff options
| author | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-03-16 17:13:39 +0000 |
|---|---|---|
| committer | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-03-16 17:13:39 +0000 |
| commit | 932b71bf3e486fc38002bbcfba606085e48b6434 (patch) | |
| tree | 17b317eb251e856da389e2b34f4ca9ff878efb27 | |
| parent | 642a85360b3846b9e84c8a0e9671e23686313daf (diff) | |
- aktualny stav
git-svn-id: http://opensvn.csie.org/tuxanci_ng@21 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
| -rw-r--r-- | src/publicServer.c | 18 | ||||
| -rw-r--r-- | src/server.c | 8 |
2 files changed, 14 insertions, 12 deletions
diff --git a/src/publicServer.c b/src/publicServer.c index ae229d5..952628c 100644 --- a/src/publicServer.c +++ b/src/publicServer.c @@ -85,16 +85,25 @@ void findFreeSpace(int *x, int *y, int w, int h) void eventPublicServer() { - static my_time_t time = 0; + static my_time_t lastActive = 0; + my_time_t interval; + + eventNetMultiplayer(); if( time == 0 ) { - time = getMyTime(); + lastActive = getMyTime(); } - printf("time %d\n", getMyTime() - time ); + interval = getMyTime() - lastActive; + + if( interval < 50 ) + { + return; + } - time = getMyTime(); + printf("interval = %d\n", interval); + lastActive = getMyTime(); eventConflictTuxWithTeleport(arena->listTux, arena->listTeleport); eventConflictTuxWithShot(arena->listTux, arena->listShot); @@ -109,7 +118,6 @@ void eventPublicServer() eventListTux(arena->listTux); eventTimer(); - eventNetMultiplayer(); } void quitPublicServer() diff --git a/src/server.c b/src/server.c index d2f6598..2e3e141 100644 --- a/src/server.c +++ b/src/server.c @@ -593,7 +593,6 @@ void selectServerUdpSocket() static struct timeval tv = { .tv_sec = 0, .tv_usec = 50000 }; fd_set readfds; int max_fd; - unsigned int z; #ifndef BUBLIC_SERVER tv.tv_sec = 0; @@ -602,7 +601,7 @@ void selectServerUdpSocket() #ifdef BUBLIC_SERVER tv.tv_sec = 0; - tv.tv_usec = 0; + tv.tv_usec = 50000; #endif FD_ZERO(&readfds); @@ -613,11 +612,6 @@ void selectServerUdpSocket() select(max_fd+1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &tv); -#ifdef BUBLIC_SERVER - z = tv.tv_usec; - usleep( 50000 - z ); -#endif - /* printf("%d\n", tv.tv_usec); */ |