From 2e63b6e02a63b1fcd639f6ae30d3d84a2b4de7ac Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 2 Aug 2020 08:23:16 +0200 Subject: [PATCH] fairland: Collect command line global variables in one place Signed-off-by: Markus Armbruster --- src/util/fairland.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/util/fairland.c b/src/util/fairland.c index 24eadd6c..92516f33 100644 --- a/src/util/fairland.c +++ b/src/util/fairland.c @@ -109,15 +109,6 @@ #include "version.h" #include "xy.h" -static int quiet = 0; - -/* If you don't specify these command line arguments, then these are the - defaults */ -#define DEFAULT_SPIKE 10 -#define DEFAULT_MOUNTAIN 0 -#define DEFAULT_CONTDIST 2 -#define DEFAULT_ISLDIST 1 - /* The following five numbers refer to elevation under which (in the case of fertility or oil) or over which (in the case of iron, gold, and uranium) sectors with that elevation will contain that resource. Elevation ranges @@ -147,14 +138,26 @@ static int quiet = 0; static void qprint(const char * const fmt, ...) ATTRIBUTE((format (printf, 1, 2))); -#define DEFAULT_OUTFILE_NAME "newcap_script" -static const char *outfile = DEFAULT_OUTFILE_NAME; - +/* + * Program arguments and options + */ +static char *program_name; +static int nc, sc; /* number and size of continents */ +static int ni, is; /* number and size of islands */ +#define DEFAULT_SPIKE 10 +static int sp; /* spike percentage */ +#define DEFAULT_MOUNTAIN 0 +static int pm; /* mountain percentage */ +#define DEFAULT_CONTDIST 2 +static int di; /* min. distance between continents */ +#define DEFAULT_ISLDIST 1 +static int id; /* ... continents and islands */ /* don't let the islands crash into each other. 1 = don't merge, 0 = merge. */ static int DISTINCT_ISLANDS = 1; - -static char *program_name; +static int quiet; +#define DEFAULT_OUTFILE_NAME "newcap_script" +static const char *outfile = DEFAULT_OUTFILE_NAME; #define STABLE_CYCLE 4 /* stability required for perterbed capitals */ #define INFINITY 999 /* a number which means "BIG" */ @@ -178,7 +181,6 @@ static int secs; /* number of sectors grown */ static int ctot; /* total number of continents and islands grown */ static int *isecs; /* array of how large each island is */ -static int nc, sc, di, sp, pm, ni, is, id; /* the 8 args to this program */ static int *capx, *capy; /* location of the nc capitals */ static int *mc, mcc; /* array and counter used for stability check when perturbing */