(kw_read, kw_find, kwtab, kw_list): Were used to evaluate the hours
file until 4.2.7. Since then kw_read() is unused, and kw_find() always returns NULL. Remove. kw_find() callers changed.
This commit is contained in:
parent
5dec30d66c
commit
05acaece48
4 changed files with 0 additions and 80 deletions
|
@ -42,9 +42,7 @@
|
||||||
#define CF_TIMERANGE 3
|
#define CF_TIMERANGE 3
|
||||||
#define CF_WEEKDAY 4
|
#define CF_WEEKDAY 4
|
||||||
|
|
||||||
extern s_char *kw_find(s_char *);
|
|
||||||
extern s_char *kw_parse(int, s_char *, int *);
|
extern s_char *kw_parse(int, s_char *, int *);
|
||||||
extern int kw_read(FILE *);
|
|
||||||
extern s_char *get_time(s_char *, int *);
|
extern s_char *get_time(s_char *, int *);
|
||||||
extern s_char *weekday(s_char *, int *);
|
extern s_char *weekday(s_char *, int *);
|
||||||
|
|
||||||
|
|
|
@ -40,65 +40,6 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
struct kwtab {
|
|
||||||
struct kwtab *next;
|
|
||||||
s_char *name;
|
|
||||||
s_char *text;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct kwtab *kw_list;
|
|
||||||
|
|
||||||
int
|
|
||||||
kw_read(FILE * fp)
|
|
||||||
{
|
|
||||||
register struct kwtab *kw;
|
|
||||||
register struct kwtab *next;
|
|
||||||
s_char buf[255];
|
|
||||||
s_char *p;
|
|
||||||
int n;
|
|
||||||
|
|
||||||
for (kw = kw_list; kw != 0; kw = next) {
|
|
||||||
next = kw->next;
|
|
||||||
free(kw->name);
|
|
||||||
free(kw->text);
|
|
||||||
free(kw);
|
|
||||||
}
|
|
||||||
kw_list = 0;
|
|
||||||
for (n = 0; fgets(buf, sizeof(buf), fp) != 0; n++) {
|
|
||||||
/* Allow for comments.. any line starting with # */
|
|
||||||
if (buf[0] == '#')
|
|
||||||
continue;
|
|
||||||
p = strrchr(buf, '\n');
|
|
||||||
if (p != 0)
|
|
||||||
*p = 0;
|
|
||||||
if ((p = strchr(buf, ':')) == 0) {
|
|
||||||
logerror("kw_read: Bad keyword line #%d\n", n);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
*p++ = 0;
|
|
||||||
while (*p && isspace(*p))
|
|
||||||
p++;
|
|
||||||
kw = (struct kwtab *)malloc(sizeof(*kw));
|
|
||||||
kw->name = strcpy(malloc(strlen(buf) + 1), buf);
|
|
||||||
kw->text = strcpy(malloc(strlen(p) + 1), p);
|
|
||||||
kw->next = kw_list;
|
|
||||||
kw_list = kw;
|
|
||||||
}
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
s_char *
|
|
||||||
kw_find(s_char *name)
|
|
||||||
{
|
|
||||||
register struct kwtab *kw;
|
|
||||||
|
|
||||||
for (kw = kw_list; kw != 0; kw = kw->next) {
|
|
||||||
if (strcmp(kw->name, name) == 0)
|
|
||||||
return kw->text;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* destructive parse
|
* destructive parse
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -210,19 +210,8 @@ getminleft(time_t now, int *hour, int *mpd)
|
||||||
|
|
||||||
tm = localtime(&now);
|
tm = localtime(&now);
|
||||||
curtime = tm->tm_min + tm->tm_hour * 60;
|
curtime = tm->tm_min + tm->tm_hour * 60;
|
||||||
if (NULL != (bp = kw_find("minutes")))
|
|
||||||
kw_parse(CF_VALUE, bp, mpd);
|
|
||||||
natp = getnatp(player->cnum);
|
natp = getnatp(player->cnum);
|
||||||
nminleft = *mpd - natp->nat_minused;
|
nminleft = *mpd - natp->nat_minused;
|
||||||
if (NULL != (bp = kw_find("hours"))) {
|
|
||||||
/*
|
|
||||||
* assume hours has already been set; just verify
|
|
||||||
* that it is present
|
|
||||||
*/
|
|
||||||
n = hour[1] - curtime;
|
|
||||||
if (n < nminleft)
|
|
||||||
nminleft = n;
|
|
||||||
}
|
|
||||||
n = 60 * 24 - (tm->tm_min + tm->tm_hour * 60);
|
n = 60 * 24 - (tm->tm_min + tm->tm_hour * 60);
|
||||||
if (n < nminleft)
|
if (n < nminleft)
|
||||||
nminleft = n;
|
nminleft = n;
|
||||||
|
|
|
@ -59,14 +59,6 @@ update_sched(void *unused)
|
||||||
"Waits until players idle", 0);
|
"Waits until players idle", 0);
|
||||||
time(&now);
|
time(&now);
|
||||||
(void)gamehours(now, hour);
|
(void)gamehours(now, hour);
|
||||||
if (NULL != (kw = kw_find("s_p_etu")))
|
|
||||||
kw_parse(CF_VALUE, kw, &s_p_etu);
|
|
||||||
if (NULL != (kw = kw_find("etu_per_update")))
|
|
||||||
kw_parse(CF_VALUE, kw, &etu_per_update);
|
|
||||||
if (NULL != (kw = kw_find("adj_update")))
|
|
||||||
kw_parse(CF_VALUE, kw, &adj_update);
|
|
||||||
if (NULL != (kw = kw_find("update_window")))
|
|
||||||
kw_parse(CF_VALUE, kw, &update_window);
|
|
||||||
if (s_p_etu <= 0) {
|
if (s_p_etu <= 0) {
|
||||||
logerror("bad value for s_p_etu (%d)", s_p_etu);
|
logerror("bad value for s_p_etu (%d)", s_p_etu);
|
||||||
s_p_etu = 2 * 60;
|
s_p_etu = 2 * 60;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue