(EFF_CUSTOM): New.

(read_config_table_file): Set it.
(show_custom): Show it.
(vers): Use it.
This commit is contained in:
Markus Armbruster 2006-02-23 08:37:46 +00:00
parent 5537d902b7
commit 99a1450c98
3 changed files with 23 additions and 2 deletions

View file

@ -86,9 +86,11 @@ struct empfile {
#define EFF_MEM bit(8) #define EFF_MEM bit(8)
/* Table is read-only */ /* Table is read-only */
#define EFF_RDONLY bit(9) #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() */ /* Transient flags, only occur in argument of ef_open() */
/* Create table file, clobbering any existing file */ /* Create table file, clobbering any existing file */
#define EFF_CREATE bit(10) #define EFF_CREATE bit(11)
/* /*
* Empire `file types' * Empire `file types'

View file

@ -47,6 +47,7 @@
#include "commands.h" #include "commands.h"
#include "file.h" #include "file.h"
static void show_custom(void);
static void show_opts(int val); static void show_opts(int val);
int int
@ -209,6 +210,7 @@ vers(void)
pr("\n"); pr("\n");
pr("You can have at most %d BTUs.\n", max_btus); pr("You can have at most %d BTUs.\n", max_btus);
pr("You are disconnected after %d minutes of idle time.\n", max_idle); pr("You are disconnected after %d minutes of idle time.\n", max_idle);
show_custom();
pr("\nOptions enabled in this game:\n "); pr("\nOptions enabled in this game:\n ");
show_opts(1); show_opts(1);
pr("\n\nOptions disabled in this game:\n "); pr("\n\nOptions disabled in this game:\n ");
@ -223,6 +225,22 @@ vers(void)
return RET_OK; 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 static void
show_opts(int val) show_opts(int val)

View file

@ -109,7 +109,8 @@ read_config_table_file(char *fname)
return -1; 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) if (res != EF_BAD && n == 0)
fprintf(stderr, "Warning: configuration file %s is empty\n", fname); fprintf(stderr, "Warning: configuration file %s is empty\n", fname);