(EFF_CUSTOM): New.
(read_config_table_file): Set it. (show_custom): Show it. (vers): Use it.
This commit is contained in:
parent
5537d902b7
commit
99a1450c98
3 changed files with 23 additions and 2 deletions
|
@ -86,9 +86,11 @@ struct empfile {
|
|||
#define EFF_MEM bit(8)
|
||||
/* Table is read-only */
|
||||
#define EFF_RDONLY bit(9)
|
||||
/* Table is customized (configuration tables only) */
|
||||
#define EFF_CUSTOM bit(10)
|
||||
/* Transient flags, only occur in argument of ef_open() */
|
||||
/* Create table file, clobbering any existing file */
|
||||
#define EFF_CREATE bit(10)
|
||||
#define EFF_CREATE bit(11)
|
||||
|
||||
/*
|
||||
* Empire `file types'
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "commands.h"
|
||||
#include "file.h"
|
||||
|
||||
static void show_custom(void);
|
||||
static void show_opts(int val);
|
||||
|
||||
int
|
||||
|
@ -209,6 +210,7 @@ vers(void)
|
|||
pr("\n");
|
||||
pr("You can have at most %d BTUs.\n", max_btus);
|
||||
pr("You are disconnected after %d minutes of idle time.\n", max_idle);
|
||||
show_custom();
|
||||
pr("\nOptions enabled in this game:\n ");
|
||||
show_opts(1);
|
||||
pr("\n\nOptions disabled in this game:\n ");
|
||||
|
@ -223,6 +225,22 @@ vers(void)
|
|||
return RET_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
show_custom(void)
|
||||
{
|
||||
char *sep = "\nCustom characteristics in this game:\n ";
|
||||
int i;
|
||||
|
||||
/* TODO wrap long lines */
|
||||
for (i = 0; i < EF_MAX; i++) {
|
||||
if (ef_flags(i) & EFF_CUSTOM) {
|
||||
pr("%s%s", sep, ef_nameof(i));
|
||||
sep = ", ";
|
||||
}
|
||||
}
|
||||
if (*sep == ',')
|
||||
pr("\n");
|
||||
}
|
||||
|
||||
static void
|
||||
show_opts(int val)
|
||||
|
|
|
@ -109,7 +109,8 @@ read_config_table_file(char *fname)
|
|||
return -1;
|
||||
}
|
||||
|
||||
for (n = 0; (res = xundump(fp, fname, EF_BAD)) >= 0; n++) ;
|
||||
for (n = 0; (res = xundump(fp, fname, EF_BAD)) >= 0; n++)
|
||||
empfile[res].flags |= EFF_CUSTOM;
|
||||
if (res != EF_BAD && n == 0)
|
||||
fprintf(stderr, "Warning: configuration file %s is empty\n", fname);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue