(NEWS_PERIOD, news_keep_days): Replace macro NEWS_PERIOD by new
configuration key news_keep_days.
This commit is contained in:
parent
2dd13e096d
commit
3dc73b39d2
4 changed files with 7 additions and 7 deletions
|
@ -291,6 +291,8 @@ EMPCFBOTH("trade_ally_cut", trade_ally_cut, float, NSC_FLOAT, 0,
|
||||||
EMPCF_COMMENT("\n\n### Misc.")
|
EMPCF_COMMENT("\n\n### Misc.")
|
||||||
EMPCFBOTH("anno_keep_days", anno_keep_days, int, NSC_INT, KM_INTERNAL,
|
EMPCFBOTH("anno_keep_days", anno_keep_days, int, NSC_INT, KM_INTERNAL,
|
||||||
"How long until announcements expire (<0 means never)")
|
"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,
|
EMPCFBOTH("fuel_mult", fuel_mult, int, NSC_INT, 0,
|
||||||
"Multiplier for fuel to mobility calculation")
|
"Multiplier for fuel to mobility calculation")
|
||||||
EMPCFBOTH("lost_items_timeout", lost_items_timeout, int, NSC_INT, KM_INTERNAL,
|
EMPCFBOTH("lost_items_timeout", lost_items_timeout, int, NSC_INT, KM_INTERNAL,
|
||||||
|
|
|
@ -157,8 +157,6 @@ struct rptstr {
|
||||||
#define N_TELE 11
|
#define N_TELE 11
|
||||||
#define N_MAX_PAGE 11
|
#define N_MAX_PAGE 11
|
||||||
|
|
||||||
#define NEWS_PERIOD days(10)
|
|
||||||
|
|
||||||
#define getnews(n, p) \
|
#define getnews(n, p) \
|
||||||
ef_read(EF_NEWS, n, p)
|
ef_read(EF_NEWS, n, p)
|
||||||
#define putnews(n, p) \
|
#define putnews(n, p) \
|
||||||
|
|
|
@ -82,6 +82,7 @@ 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 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 */
|
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? */
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "empio.h"
|
#include "empio.h"
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include "optlist.h"
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
|
|
||||||
static void filereport(int, int, int, int);
|
static void filereport(int, int, int, int);
|
||||||
|
@ -105,13 +106,11 @@ addfree(int n)
|
||||||
static void
|
static void
|
||||||
findfree(void)
|
findfree(void)
|
||||||
{
|
{
|
||||||
register time_t oldnewstime;
|
time_t oldnewstime;
|
||||||
register int n;
|
int n;
|
||||||
struct nwsstr news;
|
struct nwsstr news;
|
||||||
time_t newstime;
|
|
||||||
|
|
||||||
(void)time(&newstime);
|
oldnewstime = time(NULL) - days(news_keep_days);
|
||||||
oldnewstime = newstime - NEWS_PERIOD;
|
|
||||||
for (n = 0; getnews(n, &news); n++) {
|
for (n = 0; getnews(n, &news); n++) {
|
||||||
if (news.nws_when < oldnewstime)
|
if (news.nws_when < oldnewstime)
|
||||||
addfree(n);
|
addfree(n);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue