version 1.28 | | version 1.29 |
---|
| | |
| | |
/* | | /* |
* static char *rcsid_loop_c = | | * static char *rcsid_loop_c = |
* "$Id: loop.c,v 1.28 2005/05/06 21:10:26 tchize Exp $"; | | * "$Id: loop.c,v 1.29 2005/06/23 05:18:38 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
cycles++; | | cycles++; |
if (cycles%2 == 0) | | if (cycles%2 == 0) |
tick_the_clock(); | | tick_the_clock(); |
if (cycles == 7) { | | |
metaserver_update(); | | |
cycles=1; | | |
} | | |
FD_ZERO(&readfs); | | FD_ZERO(&readfs); |
FD_SET((uint32)init_sockets[0].fd, &readfs); | | FD_SET((uint32)init_sockets[0].fd, &readfs); |
| | |
| | /* If fastclock is set, we need to seriously slow down the updates |
| | * to the metaserver as well as watchdog. Do same for flush_old_maps() - |
| | * that is time sensitive, so there is no good reason to call it 2000 times |
| | * a second. |
| | */ |
if (settings.fastclock > 0) { | | if (settings.fastclock > 0) { |
| | #ifdef WATCHDOG |
| | if (cycles % 120000 == 0) { |
| | watchdog(); |
| | flush_old_maps(); |
| | } |
| | #endif |
| | if (cycles == 720000) { |
| | metaserver_update(); |
| | cycles=1; |
| | } |
Timeout.tv_sec=0; | | Timeout.tv_sec=0; |
Timeout.tv_usec=50; | | Timeout.tv_usec=50; |
} else { | | } else { |
Timeout.tv_sec=60; | | Timeout.tv_sec=60; |
Timeout.tv_usec=0; | | Timeout.tv_usec=0; |
| | if (cycles == 7) { |
| | metaserver_update(); |
| | cycles=1; |
} | | } |
#ifdef WATCHDOG | | |
watchdog(); | | |
#endif | | |
flush_old_maps(); | | flush_old_maps(); |
} | | } |
| | } |
while (select(socket_info.max_filedescriptor, &readfs, NULL, NULL, &Timeout)==0); | | while (select(socket_info.max_filedescriptor, &readfs, NULL, NULL, &Timeout)==0); |
| | |
reset_sleep(); /* Or the game would go too fast */ | | reset_sleep(); /* Or the game would go too fast */ |