From f0b4381c98f2d7ab1bf5d25d5e4560564d4c341e Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sat, 28 Aug 2004 15:28:54 +0000 Subject: [PATCH] (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. --- include/econfig-spec.h | 2 ++ include/misc.h | 1 - src/lib/global/constants.c | 1 + src/lib/update/anno.c | 5 ++++- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/econfig-spec.h b/include/econfig-spec.h index 216753dc3..d7b3482c3 100644 --- a/include/econfig-spec.h +++ b/include/econfig-spec.h @@ -292,6 +292,8 @@ EMPCFBOTH("trade_ally_cut", trade_ally_cut, float, floatset, 0, "Bonus your ally gets for you cashing in with them") 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, "Multiplier for fuel to mobility calculation") EMPCFBOTH("lost_items_timeout", lost_items_timeout, int, intset, 0, diff --git a/include/misc.h b/include/misc.h index 0b7042d9d..27acbc38e 100644 --- a/include/misc.h +++ b/include/misc.h @@ -73,7 +73,6 @@ struct mob_acc_globals { #define ATTRIBUTE(attrs) #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, which can lead to nasty heap smashes (observed with 2.2.93). Disabled for now, until we readjust thread stack sizes. */ diff --git a/src/lib/global/constants.c b/src/lib/global/constants.c index 7b0e16248..c8a57fe8e 100644 --- a/src/lib/global/constants.c +++ b/src/lib/global/constants.c @@ -81,6 +81,7 @@ int morale_base = 42; /* base for morale */ int sect_mob_neg_factor = 2; /* ETU/neg_factor = negative amount of mobility 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 */ double combat_mob = 5.0; /* how much mob do units spend for combat? */ diff --git a/src/lib/update/anno.c b/src/lib/update/anno.c index 80e461897..aca5f9c65 100644 --- a/src/lib/update/anno.c +++ b/src/lib/update/anno.c @@ -58,8 +58,11 @@ delete_old_announcements(void) char tmp_filename[1024]; int copy_file; + if (anno_keep_days < 0) + return; + time(&now); - old = now - days(ANNO_KEEP_DAYS); + old = now - days(anno_keep_days); logerror("Deleting annos older than %s", ctime(&old)); if ((annfp = fopen(annfil, "rb")) == NULL) { -- 2.43.0