version 1.18 | | version 1.19 |
---|
| | |
/* | | /* |
* static char *rcsid_main_c = | | * static char *rcsid_main_c = |
* "$Id: main.c,v 1.18 2000/12/18 07:38:25 cvs Exp $"; | | * "$Id: main.c,v 1.19 2001/01/15 22:33:32 cvs Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
| | |
/* | | /* |
* do_specials() is a collection of functions to call from time to time. | | * do_specials() is a collection of functions to call from time to time. |
| | * Modified 2000-1-14 MSW to use the global pticks count to determine how |
| | * often to do things. This will allow us to spred them out more often. |
| | * I use prime numbers for the factor count - in that way, it is less likely |
| | * these actions will fall on the same tick (compared to say using 500/2500/15000 |
| | * which would mean on that 15,000 tick count a whole bunch of stuff gets |
| | * done). Of course, there can still be times where multiple specials are |
| | * done on the same tick, but that will happen very infrequently |
| | * |
| | * I also think this code makes it easier to see how often we really are |
| | * doing the various things. |
*/ | | */ |
| | |
| | |
void do_specials() { | | void do_specials() { |
static int special_count = 0, special2 = 0; | | |
| | |
if(++special_count < 500) | | |
return; | | |
special_count = 0; | | |
special2++; | | |
| | |
#ifdef WATCHDOG | | #ifdef WATCHDOG |
| | if (!(pticks % 503)) |
watchdog(); | | watchdog(); |
#endif | | #endif |
| | |
| | if (!(pticks % 509)) |
flush_old_maps(); /* Clears the tmp-files of maps which have reset */ | | flush_old_maps(); /* Clears the tmp-files of maps which have reset */ |
if(!(special2%5)) { | | |
| | if (!(pticks % 2503)) |
fix_weight(); /* Hack to fix weightproblems caused by bugs */ | | fix_weight(); /* Hack to fix weightproblems caused by bugs */ |
| | |
| | if (!(pticks % 2521)) |
metaserver_update(); /* 2500 ticks is about 5 minutes */ | | metaserver_update(); /* 2500 ticks is about 5 minutes */ |
if (!(special2%25)) | | |
| | if (!(pticks % 5003)) |
| | write_book_archive(); |
| | |
| | if (!(pticks % 5009)) |
| | clean_friendly_list(); |
| | |
| | if (!(pticks % 12503)) |
fix_luck(); | | fix_luck(); |
} | | } |
if (!(special2%10)) write_book_archive(); | | |
} | | |
| | |
/* | | /* |
* last_time is when the last tick was executed. | | * last_time is when the last tick was executed. |