]> git.pond.sub.org Git - empserver/blobdiff - src/util/fairland.c
Drop add's obscure sector check and wipe functionality
[empserver] / src / util / fairland.c
index 38e1cae5a99f3c82f6b7551e0c96fecb2a93ba34..87e14e6ff8bb42e47c4fb53387c030e92bb66fbd 100644 (file)
@@ -1,11 +1,11 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2010, Dave Pare, Jeff Bailey, Thomas Ruschak,
- *                           Ken Stevens, Steve McClure
+ *  Copyright (C) 1986-2011, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *                Ken Stevens, Steve McClure, Markus Armbruster
  *
- *  This program is free software; you can redistribute it and/or modify
+ *  Empire is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
+ *  the Free Software Foundation, either version 3 of the License, or
  *  (at your option) any later version.
  *
  *  This program is distributed in the hope that it will be useful,
@@ -14,8 +14,7 @@
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  *  ---
  *
@@ -55,7 +54,7 @@ static int quiet = 0;
 #define FERT_MAX   56
 
 /* raise OIL_MAX for more oil */
-#define OIL_MAX    33
+#define OIL_MAX           33
 
 /* lower IRON_MIN for more iron */
 #define IRON_MIN   22
@@ -103,7 +102,7 @@ static int DISTINCT_ISLANDS = 1;
 static char *program_name;
 
 #define STABLE_CYCLE 4         /* stability required for perterbed capitals */
-#define INFINITY        999    /* a number which means "BIG" */
+#define INFINITY       999     /* a number which means "BIG" */
 
 /* these defines prevent infinite loops:
 */
@@ -153,7 +152,7 @@ static const char *numletter =
 static void help(char *);
 static void usage(void);
 static void parse_args(int argc, char *argv[]);
-static int allocate_memory(void);
+static void allocate_memory(void);
 static void init(void);
 static int drift(void);
 static void grow_continents(void);
@@ -228,8 +227,7 @@ main(int argc, char *argv[])
        exit(1);
     empfile_fixup();
 
-    if (allocate_memory() == -1)
-       exit(-1);
+    allocate_memory();
     print_vars();
 
     do {
@@ -262,14 +260,12 @@ main(int argc, char *argv[])
        fprintf(stderr, "Can't chdir to %s (%s)\n", gamedir, strerror(errno));
        exit(EXIT_FAILURE);
     }
-    if (!ef_open(EF_SECTOR, EFF_MEM | EFF_NOTIME, WORLD_SZ())) {
-       perror("ef_open");
+    if (!ef_open(EF_SECTOR, EFF_MEM | EFF_NOTIME))
        exit(1);
-    }
     write_sects();
     qprint("writing to sectors file...\n");
     if (!ef_close(EF_SECTOR))
-       exit(-1);
+       exit(1);
 
     output();
     qprint("\n\nA script for adding all the countries can be found in \"%s\".\n",
@@ -431,7 +427,7 @@ parse_args(int argc, char *argv[])
   VARIABLE INITIALIZATION
 ****************************************************************************/
 
-static int
+static void
 allocate_memory(void)
 {
     int i;
@@ -464,7 +460,6 @@ allocate_memory(void)
        sectc[i] = calloc(is * 2, sizeof(int));
     }
 
-    return 0;
 }
 
 static void
@@ -1158,12 +1153,12 @@ write_newcap_script(void)
     }
 
     for (c = 0; c < nc; ++c) {
-       fprintf(script, "add %d %d %d n i\n", c + 1, c + 1, c + 1);
+       fprintf(script, "add %d %d %d n\n", c + 1, c + 1, c + 1);
        if (AIRPORT_MARKER)
            fprintf(script, "des %d,%d -\n", capx[c], capy[c]);
        fprintf(script, "newcap %d %d,%d\n", c + 1, capx[c], capy[c]);
     }
-    fprintf(script, "add %d visitor visitor v i\n", c + 1);
+    fprintf(script, "add %d visitor visitor v\n", c + 1);
     fclose(script);
     return 0;
 }