]> git.pond.sub.org Git - empserver/commitdiff
fairland: Move qprint() and NUMTRIES
authorMarkus Armbruster <armbru@pond.sub.org>
Mon, 10 Aug 2020 13:52:02 +0000 (15:52 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 19 Jan 2021 07:55:21 +0000 (08:55 +0100)
qprint() was carelessly added at the end of the file in Empire 2,
where it's under the "Write a script for placing capitals" headline.
Move it to a more sensible place.

NUMTRIES was added behind the global variables in Empire 2.  Move it
before them, and reformat its comment.

The order of forward declarations of static functions looks random.
Reorder them to match the order of definitions.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/util/fairland.c

index 338f25967c3e23ef4994201e246e79ec62d0c47e..22a953929d24652ed8c5f29e1b5b65d28e8e2fb2 100644 (file)
 #include "version.h"
 #include "xy.h"
 
+/*
+ * Number of retries when growing land fails
+ */
+#define NUMTRIES 10
+
 /* do not change these defines */
 #define LANDMIN                1       /* plate altitude for normal land */
 #define PLATMIN                36      /* plate altitude for plateau */
@@ -188,9 +193,6 @@ struct resource_point uran_conf[] = {
     { 98, 0 },
     { 127, 0 } };
 
-static void qprint(const char * const fmt, ...)
-    ATTRIBUTE((format (printf, 1, 2)));
-
 /*
  * Program arguments and options
  */
@@ -300,30 +302,29 @@ static unsigned short *distance;
 static int *bfs_queue;
 static int bfs_queue_head, bfs_queue_tail;
 
-#define NUMTRIES 10            /* keep trying to grow this many times */
-
 static const char *numletter =
     "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
 
+static void print_vars(void);
+static void qprint(const char * const fmt, ...)
+    ATTRIBUTE((format (printf, 1, 2)));
 static void help(char *);
 static void usage(void);
 static void parse_args(int argc, char *argv[]);
 static void allocate_memory(void);
 static void init(void);
 static int drift(void);
+static int stable(int);
+static void fl_move(int);
 static int grow_continents(void);
+static int grow_islands(void);
 static void create_elevations(void);
-static void write_sects(void);
-static void output(void);
-static int write_newcap_script(void);
-static int stable(int);
 static void elevate_prep(void);
 static void elevate_land(void);
 static void elevate_sea(void);
-
-static void print_vars(void);
-static void fl_move(int);
-static int grow_islands(void);
+static void write_sects(void);
+static void output(void);
+static int write_newcap_script(void);
 
 /* Debugging aids: */
 void print_own_map(void);
@@ -453,6 +454,18 @@ print_vars(void)
     printf("World dimensions: %dx%d\n", WORLD_X, WORLD_Y);
 }
 
+static void
+qprint(const char *const fmt, ...)
+{
+    va_list ap;
+
+    if (!quiet) {
+       va_start(ap, fmt);
+       vfprintf(stdout, fmt, ap);
+       va_end(ap);
+    }
+}
+
 static void
 help(char *complaint)
 {
@@ -1665,15 +1678,3 @@ write_newcap_script(void)
     fclose(script);
     return 1;
 }
-
-static void
-qprint(const char *const fmt, ...)
-{
-    va_list ap;
-
-    if (!quiet) {
-       va_start(ap, fmt);
-       vfprintf(stdout, fmt, ap);
-       va_end(ap);
-    }
-}