(ANNO_KEEP_DAYS, anno_keep_days): Replace macro ANNO_KEEP_DAYS by

new configuration key.  Closes #780425.
(delete_old_announcements): Do nothing when anno_keep_days is
negative.
This commit is contained in:
Markus Armbruster 2004-08-28 15:28:54 +00:00
parent e16e38dfab
commit f0b4381c98
4 changed files with 7 additions and 2 deletions

View file

@ -292,6 +292,8 @@ EMPCFBOTH("trade_ally_cut", trade_ally_cut, float, floatset, 0,
"Bonus your ally gets for you cashing in with them") "Bonus your ally gets for you cashing in with them")
EMPCFONLYC("", emp_config_dummy, int, intset, 0, "\n\n### Misc.") EMPCFONLYC("", emp_config_dummy, int, intset, 0, "\n\n### Misc.")
EMPCFBOTH("anno_keep_days", anno_keep_days, int, intset, 7,
"How long until announcements expire (<0 means never)")
EMPCFBOTH("fuel_mult", fuel_mult, int, intset, 0, EMPCFBOTH("fuel_mult", fuel_mult, int, intset, 0,
"Multiplier for fuel to mobility calculation") "Multiplier for fuel to mobility calculation")
EMPCFBOTH("lost_items_timeout", lost_items_timeout, int, intset, 0, EMPCFBOTH("lost_items_timeout", lost_items_timeout, int, intset, 0,

View file

@ -73,7 +73,6 @@ struct mob_acc_globals {
#define ATTRIBUTE(attrs) #define ATTRIBUTE(attrs)
#endif #endif
#define ANNO_KEEP_DAYS 7 /* Keep announcements around for this many days */
/* This uses a lot of thread stack with some versions of GNU libc, /* This uses a lot of thread stack with some versions of GNU libc,
which can lead to nasty heap smashes (observed with 2.2.93). which can lead to nasty heap smashes (observed with 2.2.93).
Disabled for now, until we readjust thread stack sizes. */ Disabled for now, until we readjust thread stack sizes. */

View file

@ -81,6 +81,7 @@ int morale_base = 42; /* base for morale */
int sect_mob_neg_factor = 2; /* ETU/neg_factor = negative amount of mobility int sect_mob_neg_factor = 2; /* ETU/neg_factor = negative amount of mobility
a sector has after being taken */ a sector has after being taken */
int anno_keep_days = 7; /* How long until annos expire (<0 never) */
int lost_items_timeout = 172800; /* How long before removing from database */ int lost_items_timeout = 172800; /* How long before removing from database */
double combat_mob = 5.0; /* how much mob do units spend for combat? */ double combat_mob = 5.0; /* how much mob do units spend for combat? */

View file

@ -58,8 +58,11 @@ delete_old_announcements(void)
char tmp_filename[1024]; char tmp_filename[1024];
int copy_file; int copy_file;
if (anno_keep_days < 0)
return;
time(&now); time(&now);
old = now - days(ANNO_KEEP_DAYS); old = now - days(anno_keep_days);
logerror("Deleting annos older than %s", ctime(&old)); logerror("Deleting annos older than %s", ctime(&old));
if ((annfp = fopen(annfil, "rb")) == NULL) { if ((annfp = fopen(annfil, "rb")) == NULL) {