From 3dc73b39d2e03de4f77354a040d1bfd05aeb5979 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sat, 4 Sep 2004 19:32:48 +0000 Subject: [PATCH] (NEWS_PERIOD, news_keep_days): Replace macro NEWS_PERIOD by new configuration key news_keep_days. --- include/econfig-spec.h | 2 ++ include/news.h | 2 -- src/lib/global/constants.c | 1 + src/lib/subs/nreport.c | 9 ++++----- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/econfig-spec.h b/include/econfig-spec.h index c03520227..78055d38a 100644 --- a/include/econfig-spec.h +++ b/include/econfig-spec.h @@ -291,6 +291,8 @@ EMPCFBOTH("trade_ally_cut", trade_ally_cut, float, NSC_FLOAT, 0, EMPCF_COMMENT("\n\n### Misc.") EMPCFBOTH("anno_keep_days", anno_keep_days, int, NSC_INT, KM_INTERNAL, "How long until announcements expire (<0 means never)") +EMPCFBOTH("news_keep_days", news_keep_days, int, NSC_INT, KM_INTERNAL, + "How long until news expire") EMPCFBOTH("fuel_mult", fuel_mult, int, NSC_INT, 0, "Multiplier for fuel to mobility calculation") EMPCFBOTH("lost_items_timeout", lost_items_timeout, int, NSC_INT, KM_INTERNAL, diff --git a/include/news.h b/include/news.h index c48a8013e..ffd21d6fc 100644 --- a/include/news.h +++ b/include/news.h @@ -157,8 +157,6 @@ struct rptstr { #define N_TELE 11 #define N_MAX_PAGE 11 -#define NEWS_PERIOD days(10) - #define getnews(n, p) \ ef_read(EF_NEWS, n, p) #define putnews(n, p) \ diff --git a/src/lib/global/constants.c b/src/lib/global/constants.c index 4cd8964a7..f89c110b0 100644 --- a/src/lib/global/constants.c +++ b/src/lib/global/constants.c @@ -82,6 +82,7 @@ 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 news_keep_days = 10; /* How long until news 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/subs/nreport.c b/src/lib/subs/nreport.c index 5907276f6..264e5c802 100644 --- a/src/lib/subs/nreport.c +++ b/src/lib/subs/nreport.c @@ -38,6 +38,7 @@ #include "file.h" #include "empio.h" #include +#include "optlist.h" #include "prototypes.h" static void filereport(int, int, int, int); @@ -105,13 +106,11 @@ addfree(int n) static void findfree(void) { - register time_t oldnewstime; - register int n; + time_t oldnewstime; + int n; struct nwsstr news; - time_t newstime; - (void)time(&newstime); - oldnewstime = newstime - NEWS_PERIOD; + oldnewstime = time(NULL) - days(news_keep_days); for (n = 0; getnews(n, &news); n++) { if (news.nws_when < oldnewstime) addfree(n); -- 2.43.0