]> git.pond.sub.org Git - empserver/commitdiff
Utility programs `land', `ore' and `perfect' haven't been built by
authorMarkus Armbruster <armbru@pond.sub.org>
Tue, 9 Mar 2004 14:22:57 +0000 (14:22 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 9 Mar 2004 14:22:57 +0000 (14:22 +0000)
default for ages (at least 4.2.0 '98).  Unsurprisingly, they don't
compile anymore.  Remove them.

man/land.1 [deleted file]
man/ore.1 [deleted file]
man/perfect.1 [deleted file]
src/util/Makefile
src/util/land.c [deleted file]
src/util/ore.c [deleted file]
src/util/perfect.c [deleted file]

diff --git a/man/land.1 b/man/land.1
deleted file mode 100644 (file)
index 7226006..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-.TH LAND 1
-.UC
-.SH NAME
-land \- Empire land generator
-.SH SYNOPSIS
-.B land
-[
-.IR sectrange
-.IR mincontdist
-.IR chunksize
-.IR numchunks
-.IR numisle
-]
-.br
-.SH DESCRIPTION
-While most deities prefer to use
-.I fairland
-to generate their land, this program is included as an alternative for
-creating the geography for a game.
-.SH OPTIONS
-.TP
-.IR sectrange
-smoothing area (default = 3)
-.TP
-.IR mincontdist
-minimum distance between continents (default = 2)
-.TP
-.IR chunksize
-basic land block size (default = 2)
-.TP
-.IR numchunks
-number of chunks per continent (default = 70)
-.TP
-.IR numisle
-number of islands (default is based on world size)
diff --git a/man/ore.1 b/man/ore.1
deleted file mode 100644 (file)
index 979f9d9..0000000
--- a/man/ore.1
+++ /dev/null
@@ -1,31 +0,0 @@
-.TH ORE 1
-.UC
-.SH NAME
-ore \- Empire resource generator
-.SH SYNOPSIS
-.B ore
-[
-.BI \-e\ configfile
-]
-[
-.BI \-s\ sectfile
-]
-.br
-.SH DESCRIPTION
-While most deities prefer to use
-.I fairland
-to generate their ore, this program is included as an alternative for
-creating the resources for a game.
-.SH OPTIONS
-.TP
-.BI \-e\ configfile
-causes
-.I ore
-to use the game configuration specified in 
-.I configfile
-(by default, the file "econfig" in the data directory is used)
-.TP
-.BI \-s\ sectfile
-give resources to the sectors in 
-.I sectfile
-(default is the "sector" file in the data directory)
diff --git a/man/perfect.1 b/man/perfect.1
deleted file mode 100644 (file)
index 1ad43a8..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-.TH PERFECT 1
-.UC
-.SH NAME
-perfect \- create perfect resources
-.SH SYNOPSIS
-.B perfect
-[
-.BI \-e\ configfile
-]
-[
-.BI \-s\ sectfile
-]
-.br
-.SH DESCRIPTION
-While most deities prefer to use
-.I fairland
-to generate their resources, this program is included as an alternative for
-creating the resources for a game.  It sets all resources to 100.
-.SH OPTIONS
-.TP
-.BI \-e\ configfile
-causes
-.I perfect
-to use the game configuration specified in 
-.I configfile
-(by default, the file "econfig" in the data directory is used)
-.TP
-.BI \-s\ sectfile
-give resources to the sectors in 
-.I sectfile
-(default is the "sector" file in the data directory)
index e1ecccb95c658385afbb83de1878ad4bdc79c223..b74ab03f36d693e25fdaa2fac4eb54d3f80e943b 100644 (file)
@@ -44,9 +44,9 @@ NTLIBS = $(LIBDIR)\libsubs.lib \
        $(LIBDIR)\libgen.lib \
        $(LIBDIR)\libglobal.lib
 
-OBJS = fairland.o files.o land.o ore.o pconfig.o perfect.o
+OBJS = fairland.o files.o pconfig.o
 
-NTOBJS = fairland.obj files.obj land.obj ore.obj pconfig.obj perfect.obj
+NTOBJS = fairland.obj files.obj pconfig.obj
 
 nt: ntfairland ntfiles ntpconfig
 
@@ -54,8 +54,6 @@ all: fairland files pconfig
 
 osx: fairland files pconfig
 
-# all: $(OBJS) fairland files land ore pconfig perfect
-
 ntfiles: files.obj
        link /OUT:files.exe \
         /NOD /DEBUG:full /DEBUGTYPE:cv /MACHINE:IX86 /NOLOGO \
@@ -68,12 +66,6 @@ ntfiles: files.obj
 files: files.o
        $(CC) -o files $(IFLAGS) $(CFLAGS) files.o $(LIBS) $(LFLAGS) -lc
 
-land: land.o
-       $(CC) -o land $(IFLAGS) $(CFLAGS) land.o $(LIBS) $(LFLAGS) -lc
-
-ore: ore.o
-       $(CC) -o ore $(IFLAGS) $(CFLAGS) ore.o $(LIBS) $(LFLAGS) -lc
-
 fairland: fairland.o
        $(CC) -o fairland $(IFLAGS) $(CFLAGS) fairland.o $(LIBS) $(LFLAGS) -lc
 
@@ -86,9 +78,6 @@ ntfairland: fairland.obj
         libcmt.lib \
         oldnames.lib
 
-perfect: perfect.o
-       $(CC) -o perfect $(IFLAGS) $(CFLAGS) perfect.o $(LIBS) $(LFLAGS) -lc
-
 pconfig: pconfig.o
        $(CC) -o pconfig $(IFLAGS) $(CFLAGS) pconfig.o $(LIBS) $(LFLAGS) -lc
 
@@ -102,25 +91,19 @@ ntpconfig: pconfig.o
         oldnames.lib
 
 clean:
-       -(rm -f files land ore fairland perfect pconfig $(OBJS))
+       -(rm -f files fairland pconfig $(OBJS))
        -(del /q *.exe *.pdb *.ilk $(NTOBJS))
 
 install:
        -(mkdir $(EMPDIR)/bin)
        -(cp files $(EMPDIR)/bin)
-#      -(cp land $(EMPDIR)/bin)
-#      -(cp ore $(EMPDIR)/bin)
        -(cp fairland $(EMPDIR)/bin)
-#      -(cp perfect $(EMPDIR)/bin)
        -(cp pconfig $(EMPDIR)/bin)
 
 ntinstall:
        -(mkdir $(NTINSTDIR)\bin)
        -(copy files.exe $(NTINSTDIR)\bin)
-#      -(copy land.exe $(NTINSTDIR)\bin)
-#      -(copy ore.exe $(NTINSTDIR)\bin)
        -(copy fairland.exe $(NTINSTDIR)\bin)
-#      -(copy perfect.exe $(NTINSTDIR)\bin)
        -(copy pconfig.exe $(NTINSTDIR)\bin)
 
 include ../make.rules
diff --git a/src/util/land.c b/src/util/land.c
deleted file mode 100644 (file)
index 5d17adf..0000000
+++ /dev/null
@@ -1,406 +0,0 @@
-/*
- *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
- *                           Ken Stevens, Steve McClure
- *
- *  This program 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
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  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
- *
- *  ---
- *
- *  See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
- *  related information and legal notices. It is expected that any future
- *  projects/authors will amend these files as needed.
- *
- *  ---
- *
- *  land.c: New version of empcre - Create the land masses in the game
- * 
- *  Known contributors to this file:
- *     James Anderson, 1987
- *     Dave Pare, 1989
- */
-
-#include <stdio.h>
-#include <fcntl.h>
-#include "var.h"
-#include "misc.h"
-#include "power.h"
-#include "nat.h"
-#include "sect.h"
-#include "gamesdef.h"
-#include "file.h"
-#include "xy.h"
-#include "prototypes.h"
-
-#define rnd(x) (random() % (x))
-
-#define XPLATES                ((WORLD_X) / 2) /* basically world x-y size */
-#define YPLATES                (WORLD_Y)
-#define        XSIZE           (XPLATES)
-#define YSIZE          (YPLATES)
-
-#define BIGV           256     /* used in making altitude */
-#define SMALLV         128     /* ex-ocean: rnd(SMALLV) - rnd(BIGV) */
-
-typedef enum plates {
-    OCEAN, ISLAND, CONTINENT
-} plate_e;
-
-#define LANDMIN                1       /* plate altitude for normal land */
-#define HILLMIN                34      /* plate altitude for hills */
-#define PLATMIN                36      /* plate altitude for plateau */
-#define HIGHMIN                98      /* plate altitude for mountains */
-
-#define LANDCH         60      /* land plate percentage */
-#define NUMLAND                (YPLATES * XPLATES * LANDCH)/100
-#define NUMISLE                NUMLAND/5       /* 1 isle for 5 land */
-#define NUMWATER       (XPLATES * YPLATES) - (NUMLAND + NUMISLE)
-
-#define SECTRANGE      3       /* smoothing area */
-#define MINCONTDIST    2       /* minimum continent distance */
-#define CHUNKSIZE      2       /* basic land block size */
-#define NEWCONTDIST    (rnd(mincontdist) + mincontdist)
-                                       /* dist away from others for newcont */
-#define NUMCHUNKS      70      /* number of CHUNKS per cont */
-
-struct sctstr sects[YSIZE][XSIZE];
-
-plate_e plates[YPLATES][XPLATES];
-int world[YSIZE][XSIZE];
-
-int sectrange = SECTRANGE;
-int mincontdist = MINCONTDIST;
-int chunksize = CHUNKSIZE;
-int numchunks = NUMCHUNKS;
-int numisle = NUMISLE;
-
-static void initworld();
-static void growcont();
-static void newcont();
-static int verify();
-static int makeland();
-static void make_altitude();
-static int total_land();
-static void make_sects();
-static void land_sct_init(coord x, coord y, s_char *ptr);
-
-
-int
-main(argc, argv)
-int argc;
-s_char **argv;
-{
-    extern struct empfile empfile[];
-    register int n;
-    int x, y;
-    int i, j;
-    time_t now;
-    int fd;
-    int left;
-    int big;
-
-    if (argc > 1 && argc != 6) {
-       printf("usage: %s sectrange mincontdist chunksize numchunks numisle\n",
-              *argv);
-       return -1;
-    }
-    if (argc == 6) {
-       sectrange = atoi(argv[1]);
-       mincontdist = atoi(argv[2]);
-       chunksize = atoi(argv[3]);
-       numchunks = atoi(argv[4]);
-       numisle = atoi(argv[5]);
-    }
-    printf("sectrange: %d\n", sectrange);
-    printf("mincontdist: %d\n", mincontdist);
-    printf("chunksize: %d\n", chunksize);
-    printf("numchunks: %d\n", numchunks);
-    printf("numisle: %d\n", numisle);
-    fd = open(empfile[EF_SECTOR].file, O_RDWR | O_CREAT | O_TRUNC, 0660);
-    if (fd < 0) {
-       perror(empfile[EF_SECTOR].file);
-       return -1;
-    }
-    time(&now);
-    srandom(now + getpid());
-    initworld((plate_e *)plates);
-    left = NUMLAND;
-    printf("Creating continents");
-    while (left > 0) {
-       big = (left / (numchunks * 3 * chunksize * chunksize)) + 1;
-       for (n = 0; n < big; n++) {
-           newcont(plates, &x, &y, NEWCONTDIST);
-           left -= makeland(plates, x, y, chunksize, CONTINENT);
-       }
-       for (n = 0; n < big * numchunks; n++) {
-           growcont(plates, &x, &y);
-           left -= makeland(plates, x, y, chunksize, CONTINENT);
-           if ((n % numchunks) == 0) {
-               printf(".");
-               fflush(stdout);
-           }
-       }
-    }
-    printf("\n");
-    printf("Creating islands");
-    for (n = 0; n < numisle; n++) {
-       /* find an open spot */
-       while (plates[(i = rnd(YPLATES))][(j = rnd(XPLATES))] != OCEAN) ;
-       plates[i][j] = ISLAND;
-    }
-    printf("\n");
-    printf("Making altitude\n");
-    make_altitude(plates, world);
-    printf("Creating sectors\n");
-    make_sects(world, sects);
-    printf("Writing sectors\n");
-    n = write(fd, sects, sizeof(sects));
-    if (n < 0) {
-       perror(empfile[EF_SECTOR].file);
-       return -1;
-    }
-    if (n != sizeof(sects)) {
-       printf("%s: partial write\n", empfile[EF_SECTOR].file);
-       return -1;
-    }
-    close(fd);
-    exit(0);
-}
-
-static void
-initworld(plates)
-register plate_e *plates;
-{
-    register int i;
-
-    for (i = 0; i < XPLATES * YPLATES; i++)
-       *plates++ = OCEAN;
-}
-
-static void
-growcont(plates, xp, yp)
-register plate_e plates[YPLATES][XPLATES];
-int *xp;
-int *yp;
-{
-    int x, y;
-
-    /* merge with another one */
-    while (plates[(y = rnd(YPLATES))][(x = rnd(XPLATES))] == OCEAN) ;
-    *xp = x;
-    *yp = y;
-}
-
-static void
-newcont(plates, xp, yp, dist)
-register plate_e plates[YPLATES][XPLATES];
-int *xp;
-int *yp;
-int dist;
-{
-    register int x, y;
-    int i;
-
-    for (i = 0; i < 30; i++) {
-       y = rnd(YPLATES);
-       x = rnd(XPLATES);
-       if (verify(plates, x, y, OCEAN, dist))
-           break;
-    }
-    if (i == 30) {
-       growcont(plates, xp, yp);
-    } else {
-       *xp = x;
-       *yp = y;
-    }
-}
-
-/*
- * verify that with "dist", there are only type "what" sectors
- * returns 0 if fail, 1 if success.
- */
-static int
-verify(plates, x, y, what, dist)
-register plate_e plates[YPLATES][XPLATES];
-int x;
-int y;
-int what;
-int dist;
-{
-    register int xbase, ybase;
-    register int x1, y1;
-
-    for (ybase = y - dist; ybase <= y + dist; ybase++) {
-       for (xbase = x - dist; xbase <= x + dist; xbase++) {
-           /* normalize to world coords */
-           y1 = ybase < 0 ? ybase + YPLATES : ybase % YPLATES;
-           x1 = xbase < 0 ? xbase + XPLATES : xbase % XPLATES;
-           if (plates[y1][x1] != what)
-               return 0;
-       }
-    }
-    return 1;
-}
-
-static int
-makeland(plates, x, y, dist, what)
-register plate_e plates[YPLATES][XPLATES];
-int x;
-int y;
-int dist;
-int what;
-{
-    register int xbase, ybase;
-    register int xfail, yfail;
-    register int x1, y1;
-    int created;
-
-    created = 0;
-    for (ybase = y - dist; ybase <= y + dist; ybase++) {
-       yfail = y - ybase;
-       if (yfail < 0)
-           yfail = -yfail;
-       y1 = ybase < 0 ? ybase + YPLATES : ybase % YPLATES;
-       for (xbase = x - dist; xbase <= x + dist; xbase++) {
-           x1 = xbase < 0 ? xbase + XPLATES : xbase % XPLATES;
-           if (plates[y1][x1] != OCEAN)
-               continue;
-           xfail = x - x1;
-           if (xfail < 0)
-               xfail = -xfail;
-           if (xfail < yfail)
-               xfail = yfail;
-           if (xfail < dist - 1 || !rnd(xfail + 1) || !rnd(xfail + 1)) {
-               plates[y1][x1] = what;
-               created++;
-           }
-       }
-    }
-    return created;
-}
-
-static void
-make_altitude(plates, world)
-register plate_e plates[YPLATES][XPLATES];
-register int world[YSIZE][XSIZE];
-{
-    register int x, y;
-
-    for (y = 0; y < YPLATES; y++) {
-       for (x = 0; x < XPLATES; x++) {
-           switch (plates[y][x]) {
-           case OCEAN:
-                               /*-BIGV, -SMALLV/2, SMALLV*/
-               world[y][x] = rnd(SMALLV) - rnd(BIGV);
-               break;
-           case ISLAND:
-                               /*-BIGV, 0, BIGV*/
-               world[y][x] = rnd(BIGV) - rnd(BIGV) + 2;
-               break;
-           case CONTINENT:
-                               /*-SMALLV, SMALLV/2, BIGV*/
-               world[y][x] = rnd(BIGV) - rnd(SMALLV);
-           }
-       }
-    }
-}
-
-static int
-total_land(world, xbase, ybase, range)
-register int world[YSIZE][XSIZE];
-register int xbase;
-int ybase;
-register int range;
-{
-    register int x;
-    register int xmax;
-    register int total;
-    register int *row;
-    int y;
-    int ymax;
-
-    total = 0;
-    xmax = xbase + range;
-    ymax = ybase + range;
-    for (y = ybase; y < ymax; y++) {
-       row = world[y % YSIZE];
-       for (x = xbase; x < xmax; x++)
-           total += row[x % XSIZE];
-    }
-    return total;
-}
-
-static void
-make_sects(world, sects)
-register int world[YSIZE][XSIZE];
-struct sctstr *sects;
-{
-    register struct sctstr *sct;
-    register int i;
-    register int x, y;
-    int elev[12 + 12 + 3];     /* # sects from -12 to 12 in steps of 10 elev */
-    int range;
-    int rangesq;
-    int total;
-    int sum;
-
-    for (i = 0; i < 12 + 12 + 3; i++)
-       elev[i] = 0;
-    sum = 0;
-    sct = sects;
-    for (y = 0; y < YSIZE; y++) {
-       for (x = 0; x < XSIZE; x++, sct++) {
-           land_sct_init(x * 2 + (y & 01), y, (s_char *)sct);
-           range = 3 + rnd(sectrange);
-           rangesq = range * range;
-           total = total_land(world, x, y, range) / rangesq;
-           if (total < LANDMIN) {
-               sct->sct_type = SCT_WATER;
-           } else if (total < HILLMIN)
-               sct->sct_type = SCT_RURAL;
-           else if (total < PLATMIN)
-               sct->sct_type = SCT_MOUNT;
-           else if (total < HIGHMIN)
-               sct->sct_type = SCT_RURAL;
-           else
-               sct->sct_type = SCT_MOUNT;
-           sct->sct_elev = total;
-           sct->sct_newtype = sct->sct_type;
-           sum += total;
-           if (total < -129)
-               elev[0]++;
-           else if (total > 129)
-               elev[26]++;
-           else
-               elev[13 + total / 10]++;
-       }
-    }
-    for (i = 0; i < 12 + 12 + 3; i++)
-       if (elev[i] != 0)
-           printf("%4d sectors elevation %4d to %4d\n",
-                  elev[i], 10 * i - 140, 10 * i - 130);
-}
-
-static void
-land_sct_init(coord x, coord y, s_char *ptr)
-{
-    struct sctstr *sp = (struct sctstr *)ptr;
-
-    sp->ef_type = EF_SECTOR;
-    sp->sct_x = x;
-    sp->sct_y = y;
-    sp->sct_dist_x = x;
-    sp->sct_dist_y = y;
-}
diff --git a/src/util/ore.c b/src/util/ore.c
deleted file mode 100644 (file)
index 7a6d895..0000000
+++ /dev/null
@@ -1,413 +0,0 @@
-/*
- *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
- *                           Ken Stevens, Steve McClure
- *
- *  This program 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
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  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
- *
- *  ---
- *
- *  See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
- *  related information and legal notices. It is expected that any future
- *  projects/authors will amend these files as needed.
- *
- *  ---
- *
- *  ore.c: Create a world
- * 
- *  Known contributors to this file:
- *     Thomas Ruschak
- */
-
-/*
- * In the oceans, it puts oil = (2d6-4)*10+d10, fert = (2d6-2)*10+d10
- *                        (max of 127 in both cases)
- *
- * For islands smaller than ISLANDSIZE, it puts in normal
- *     resources. (These are assumed to be small non-start islands)
- * For islands at least ISLANDSIZE big, it makes normal fert,
- *     but it uses the MIN, OIL, GOLD, and URAN arrays to find out
- *     what resources to put there. The intent is to find all start
- *     islands, and give them all a pre-determined spread of stuff.
- *     To change the stuff, just change the MIN, OIL, GOLD, and URAN arrays.
- *
- * For example, if the GOLD array is 90,80,70,60, it'll try to put 1
- *     sector with 90 gold, 1 with 80 gold, 1 with 70, and 1 with 60 gold
- *     on each island of at least ISLANDSIZE. It will not overrun start
- *     sectors, and should be run AFTER you have placed capitals.
- */
-
-* /
-#if defined(aix) || defined(linux) || defined(solaris)
-#include <unistd.h>
-#endif /* aix or linux */
-#include <stdio.h>
-#include <fcntl.h>
-#include "misc.h"
-#include "var.h"
-#include "sect.h"
-#include "gamesdef.h"
-#include "file.h"
-#include "path.h"
-#include "xy.h"
-#include "prototypes.h"
-#define XPLATES                WORLD_X/2
-#define YPLATES                WORLD_Y
-#define YbyX           (YPLATES*XPLATES/8)
-#define ISLANDSIZE     25
-#define ISLANDMAX      1000
-int MIN[] = { 90, 85, 85, 85, 70, 70, 70, 70, 70 };
-int OIL[] = { 90, 80, 70, 60, 50 };
-int GOLD[] = { 90, 80, 70, 60, 50 };
-int URAN[] = { 90, 80, 70, 60, 50 };
-
-#define MIN_TYPE       0
-#define OIL_TYPE       1
-#define GOLD_TYPE      2
-#define URAN_TYPE      3
-
-struct sctstr sects[YPLATES * XPLATES];
-u_char s[WORLD_Y][WORLD_X];
-short c[WORLD_Y][WORLD_X];
-short e[WORLD_Y][WORLD_X];
-int size[YbyX];
-int goldchance[YbyX];
-int ironchance[YbyX];
-int oilchance[YbyX];
-int fertchance[YbyX];
-int urchance[YbyX];
-int ix[ISLANDMAX], iy[ISLANDMAX], ic[ISLANDMAX], in = 0;
-int cont = 0;
-
-void makec();
-void makeore();
-int place();
-int nearelev();
-
-int
-main(argc, argp)
-int argc;
-s_char **argp;
-{
-    register struct sctstr *sp;
-    register int y;
-    register int x;
-    int sectf;
-    time_t now;
-    s_char *sectfil = NULL;
-    int xx, x1, y1;
-    extern char *optarg;
-    int opt;
-    char *config_file = NULL;
-
-
-    while ((opt = getopt(argc, argp, "e:s:")) != EOF) {
-       switch (opt) {
-       case 'e':
-           config_file = optarg;
-           break;
-       case 's':
-           sectfil = optarg;
-           break;
-       }
-    }
-
-    emp_config(config_file);
-
-    if (sectfil == NULL)
-       sectfil = empfile[EF_SECTOR].file;
-    time(&now);
-    srandom((unsigned int)now);
-    sectf = open(sectfil, O_RDWR, 0);
-    if (sectf < 0) {
-       perror(sectfil);
-       exit(1);
-    }
-    read(sectf, sects, sizeof(sects));
-    sp = sects;
-    for (y = 0; y < WORLD_Y; y++) {
-       for (x = 0; x < WORLD_X; x++) {
-           if (((x ^ y) & 1))
-               continue;
-           c[sp->sct_y][sp->sct_x] = 0;
-           s[sp->sct_y][sp->sct_x] = sp->sct_type;
-           e[sp->sct_y][sp->sct_x] = sp->sct_elev;
-           sp++;
-       }
-    }
-    for (y = 0; y < WORLD_Y; y++) {
-       for (x = 0; x < WORLD_X; x++) {
-           if (((x ^ y) & 1))
-               continue;
-           if (c[y][x] != 0)
-               continue;
-           if (s[y][x] == SCT_WATER)
-               continue;
-
-           makec(x, y, 0);
-
-           for (y1 = 0; y1 < WORLD_Y; y1++)
-               for (x1 = 0; x1 < WORLD_X; x1++)
-                   if (c[y1][x1] < 0) {
-                       size[cont]++;
-                       c[y1][x1] = cont;
-                   }
-           if (size[cont] == 0)
-               continue;
-           if (size[cont] >= ISLANDSIZE) {
-               xx = ISLANDSIZE / 2;
-               for (y1 = 0; y1 < WORLD_Y; y1++)
-                   for (x1 = 0; x1 < WORLD_X; x1++)
-                       if (c[y1][x1] == cont) {
-                           if (--xx == 0) {
-                               ix[in] = x1;
-                               iy[in] = y1;
-                               ic[in] = cont;
-                               in++;
-                           }
-                       }
-               printf("Found island %d of size %d at %d,%d\n",
-                      in, size[cont], ix[in - 1], iy[in - 1]);
-           } else {
-               printf("Found islet %d of size %d\n", cont, size[cont]);
-               for (y1 = 0; y1 < WORLD_Y; y1++)
-                   for (x1 = 0; x1 < WORLD_X; x1++)
-                       if (c[y1][x1] == cont)
-                           c[y1][x1] = ISLANDMAX + 1;
-           }
-       }
-    }
-
-    sp = sects;
-    for (y = 0; y < WORLD_Y; y++) {
-       for (x = 0; x < WORLD_X; x++) {
-           if (((x ^ y) & 1))
-               continue;
-           makeore(sp++);
-       }
-    }
-    for (x = 0; x < in; x++) {
-       printf("Making ore for island %d\n", x);
-       place(x, MIN, sizeof(MIN) / sizeof(int), OFFSET(sctstr, sct_min),
-             "MIN");
-       place(x, URAN, sizeof(URAN) / sizeof(int),
-             OFFSET(sctstr, sct_uran), "URAN");
-       place(x, OIL, sizeof(OIL) / sizeof(int), OFFSET(sctstr, sct_oil),
-             "OIL");
-       place(x, GOLD, sizeof(GOLD) / sizeof(int),
-             OFFSET(sctstr, sct_gmin), "GOLD");
-    }
-
-    lseek(sectf, 0L, 0);
-    write(sectf, sects, sizeof(sects));
-    close(sectf);
-    exit(0);
-}
-
-#define max(a,b) (a < b ? b : a)
-
-void
-makec(x, y, n)
-int x;
-int y;
-int n;
-{
-    register int dy;
-    register int dx;
-    register int dir;
-
-    if (s[y][x] == SCT_WATER)
-       return;
-
-    if (c[y][x] != 0)
-       return;
-
-    if (n == 0)
-       n = ++cont;
-
-    c[y][x] = -1;
-
-    for (dir = 1; dir <= 6; dir++) {
-       dx = (diroff[dir][0] + x + WORLD_X) % WORLD_X;
-       dy = (diroff[dir][1] + y + WORLD_Y) % WORLD_Y;
-       makec(dx, dy, n);
-    }
-}
-
-#define MINIMUM(x,y) (x > y ? y : x)
-#define MAXIMUM(x,y) (x > y ? x : y)
-
-void
-makeore(sp)
-register struct sctstr *sp;
-{
-    int elev;
-    int oil, gmin, iron, fertil, ur;
-    int lev;
-    int i;
-    int x, y;
-
-    if (sp->sct_type == SCT_SANCT)
-       return;
-
-    y = sp->sct_y;
-    x = sp->sct_x;
-
-    elev = e[y][x];
-    lev = (elev * 12 + nearelev(x, y)) / 18;
-    i = c[y][x];
-    oil = 0;
-    iron = 0;
-    gmin = 0;
-    fertil = 0;
-    ur = 0;
-
-    if (sp->sct_type == SCT_WATER) {
-       oil = MAXIMUM(((roll(6) + roll(6) - 4) * 10 + roll(10)), 0);
-       sp->sct_oil = MINIMUM(oil, 127);
-       fertil = MAXIMUM(((roll(6) + roll(6) - 2) * 12 + roll(10)), 0);
-       sp->sct_fertil = MINIMUM(fertil, 127);
-       return;
-    }
-    iron = roll(100) + 100 - roll(100);
-    oil = roll(100) + 100 - roll(100);
-    ur = roll(100) + 100 - roll(100);
-    gmin = roll(100) + 100 - roll(100);
-    fertil = 85 + 100 - roll(100);
-
-    iron = MAXIMUM(iron, 0);
-    oil = MAXIMUM(oil, 0);
-    ur = MAXIMUM(ur, 0);
-    gmin = MAXIMUM(gmin, 0);
-    fertil = MAXIMUM(fertil, 0);
-    iron = MINIMUM(iron, 127);
-    oil = MINIMUM(oil, 127);
-    ur = MINIMUM(ur, 127);
-    gmin = MINIMUM(gmin, 127);
-    fertil = MINIMUM(fertil, 127);
-
-    sp->sct_fertil = fertil;
-    if (i > ISLANDMAX) {
-       sp->sct_oil = oil;
-       sp->sct_min = iron;
-       sp->sct_gmin = gmin;
-       sp->sct_uran = ur;
-    } else {
-       fertil -= 20;
-       fertil = MAXIMUM(fertil, 0);
-       fertil = MINIMUM(fertil, 127);
-       sp->sct_fertil = fertil;
-    }
-}
-
-int
-nearelev(x, y)
-int x;
-int y;
-{
-    int dir;
-    int dx;
-    int dy;
-    int level;
-
-    level = 0;
-    for (dir = 1; dir <= 6; dir++) {
-       dx = (diroff[dir][0] + x + WORLD_X) % WORLD_X;
-       dy = (diroff[dir][1] + y + WORLD_Y) % WORLD_Y;
-       level += e[dy][dx];
-    }
-    return level;
-}
-
-/*             Already in libgen.a
-roll(n)
-       int     n;
-{
-       return random() % n;
-}
-*/
-
-int
-min(a, b)
-int a;
-int b;
-{
-    if (a < b)
-       return a;
-    return b;
-}
-
-int
-place(island, res, num, offset, restype)
-int island, res[], num, offset;
-s_char *restype;
-{
-    int x1, y1, x2, y2, x3, y3, j, k;
-    int tried[WORLD_Y][WORLD_X];
-    int numtried, there;
-    struct sctstr *foo;
-
-    x1 = ix[island];
-    y1 = iy[island];
-
-    for (k = 0; k < num; k++) {
-
-       x2 = x1;
-       y2 = y1;
-       memset(tried, 0, sizeof(tried));
-       numtried = 0;
-       while ((sects[y2 * XPLATES + x2 / 2].sct_type == SCT_WATER) ||
-              (*
-               ((u_char *)(((s_char *)&sects[y2 * XPLATES + x2 / 2]) +
-                           offset)) > 0)
-              || (sects[y2 * XPLATES + x2 / 2].sct_type == SCT_MOUNT)) {
-
-           there =
-               *((u_char *)(((s_char *)&sects[y2 * XPLATES + x2 / 2]) +
-                            offset));
-
-           foo = &sects[y2 * XPLATES + x2 / 2];
-
-           if (sects[y2 * XPLATES + x2 / 2].sct_type == SCT_RURAL) {
-               if (!tried[y2][x2]) {
-                   tried[y2][x2] = 1;
-                   numtried++;
-                   if (numtried == ISLANDSIZE) {
-                       int a, b;
-                       printf("*** %d) couldn't place %s %d (%d)\n",
-                              island, restype, k, res[k]);
-                       for (a = 0; a < WORLD_Y; a++)
-                           for (b = 0; b < WORLD_X; b++)
-                               if (tried[a][b])
-                                   printf("\tTried %d,%d\n", b, a);
-                       return (0);
-                   }
-               }
-           }
-           do {
-               j = roll(6);
-               x3 = (diroff[j][0] + x2 + WORLD_X) % WORLD_X;
-               y3 = (diroff[j][1] + y2 + WORLD_Y) % WORLD_Y;
-           } while (sects[y3 * XPLATES + x3 / 2].sct_type == SCT_WATER);
-           x2 = x3;
-           y2 = y3;
-       }
-
-/*             sects[y2*XPLATES+x2/2].sct_min = MIN[k]; */
-       *((u_char *)(((s_char *)&sects[y2 * XPLATES + x2 / 2]) + offset)) =
-           res[k];
-    }
-    return (1);
-}
diff --git a/src/util/perfect.c b/src/util/perfect.c
deleted file mode 100644 (file)
index ea2880c..0000000
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
- *                           Ken Stevens, Steve McClure
- *
- *  This program 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
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  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
- *
- *  ---
- *
- *  See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
- *  related information and legal notices. It is expected that any future
- *  projects/authors will amend these files as needed.
- *
- *  ---
- *
- *  perfect.c: Create a perfect world
- * 
- *  Known contributors to this file:
- *     James Anderson, 1986
- *     Dave Pare, 1986
- */
-
-#if defined(aix) || defined(linux) || defined(solaris)
-#include <unistd.h>
-#endif /* aix or linux */
-
-#include <stdio.h>
-#include <fcntl.h>
-#include "misc.h"
-#include "var.h"
-#include "sect.h"
-#include "gamesdef.h"
-#include "file.h"
-#include "path.h"
-#include "xy.h"
-#include "prototypes.h"
-
-#define XPLATES                (WORLD_X / 2)
-#define YPLATES                WORLD_Y
-#define YbyX           (YPLATES*XPLATES/8)
-
-struct sctstr sects[YPLATES * XPLATES];
-u_char s[YPLATES][XPLATES];
-short c[YPLATES][XPLATES];
-short e[YPLATES][XPLATES];
-int size[YbyX];
-int goldchance[YbyX];
-int ironchance[YbyX];
-int oilchance[YbyX];
-int fertchance[YbyX];
-int urchance[YbyX];
-
-void makec();
-void makeore();
-int nearelev();
-
-int
-main(argc, argp)
-int argc;
-s_char **argp;
-{
-    register struct sctstr *sp;
-    register int y;
-    register int x;
-    int sectf;
-    int i;
-    time_t now;
-    s_char *sectfil = NULL;
-    extern char *optarg;
-    int opt;
-    char *config_file = NULL;
-
-
-    while ((opt = getopt(argc, argp, "e:s:")) != EOF) {
-       switch (opt) {
-       case 'e':
-           config_file = optarg;
-           break;
-       case 's':
-           sectfil = optarg;
-           break;
-       }
-    }
-
-    emp_config(config_file);
-
-    if (sectfil == NULL)
-       sectfil = empfile[EF_SECTOR].file;
-
-    time(&now);
-    srandom((unsigned int)now);
-    sectf = open(sectfil, O_RDWR, 0);
-    if (sectf < 0) {
-       perror(sectfil);
-       exit(1);
-    }
-    read(sectf, sects, sizeof(sects));
-    sp = sects;
-    for (y = 0; y < WORLD_Y; y++) {
-       for (x = 0; x < WORLD_X; x++) {
-           if (((x ^ y) & 1))
-               continue;
-           c[y][x / 2] = 0;
-           s[y][x / 2] = sp->sct_type;
-           e[y][x / 2] = sp->sct_elev;
-           sp++;
-       }
-    }
-    for (y = 0; y < WORLD_Y; y++) {
-       for (x = 0; x < WORLD_X; x++) {
-           if (((x ^ y) & 1))
-               continue;
-           if (c[y][x / 2] != 0)
-               continue;
-           makec(x, y, 0);
-       }
-    }
-    printf("size  oil  gold fert iron\n");
-    for (i = 1; i < YbyX && size[i]; i++) {
-       oilchance[i] = 5 + roll(75) - min(size[i] / 15, 10);
-/*             goldchance[i] = 3 + roll(45) -  */
-       goldchance[i] = 3 + roll(55) -
-           (oilchance[i] + min(size[i] / 15, 10));
-/*             urchance[i] = roll(40) - goldchance[i]; */
-       urchance[i] = roll(30) - goldchance[i];
-       fertchance[i] = roll(40) - (goldchance[i] + oilchance[i]);
-       ironchance[i] = roll(45) - (goldchance[i] + oilchance[i] / 2);
-       if (size[i] > 10) {
-           printf("%3d   %3d  %3d  %3d  %3d\n",
-                  size[i], oilchance[i], goldchance[i],
-                  fertchance[i], ironchance[i]);
-       }
-    }
-    if (i == YbyX)
-       printf("Oops.  YbyX not big enough\n");
-    sp = sects;
-    for (y = 0; y < WORLD_Y; y++) {
-       for (x = 0; x < WORLD_X; x++) {
-           if (((x ^ y) & 1))
-               continue;
-           makeore(sp++);
-       }
-    }
-    lseek(sectf, 0L, 0);
-    write(sectf, sects, sizeof(sects));
-    close(sectf);
-    exit(0);
-}
-
-int cont = 0;
-
-#define max(a,b) (a < b ? b : a)
-
-void
-makec(x, y, n)
-int x;
-int y;
-int n;
-{
-    register int dy;
-    register int dx;
-    register int dir;
-    register short *cp;
-
-    if (s[y][x / 2] == SCT_WATER)
-       return;
-    cp = &c[y][x / 2];
-    if (*cp != 0)
-       return;
-    if (n == 0)
-       n = ++cont;
-    *cp = n;
-    size[n]++;
-    for (dir = 1; dir <= 6; dir++) {
-       dx = (diroff[dir][0] + x + WORLD_X) % WORLD_X;
-       dy = (diroff[dir][1] + y + WORLD_Y) % WORLD_Y;
-       makec(dx, dy, n);
-    }
-}
-
-void
-makeore(sp)
-register struct sctstr *sp;
-{
-    int elev;
-    int oil, gmin, iron, fertil, ur;
-    int lev;
-    int i;
-    int x, y;
-
-    y = sp->sct_y;
-    x = sp->sct_x;
-    elev = e[y][x / 2];
-    lev = (elev * 12 + nearelev(x, y)) / 18;
-    i = c[y][x / 2];
-    oil = 0;
-    iron = 0;
-    gmin = 0;
-    fertil = 0;
-    ur = 0;
-    if (lev < 20 && lev > -15 && roll(100) < 30 + oilchance[i] + lev) {
-       oil = (45 - lev) + roll(50);
-       if (oil > 100)
-           oil = 100;
-       if (oil < 10)
-           oil = 0;
-    }
-    if (lev > 15 && roll(20 + lev) < lev + ironchance[i]) {
-       iron = lev + roll(55);
-       if (iron > 100)
-           iron = 100;
-       if (iron < 10)
-           iron = 0;
-    }
-    if (lev > 16 && roll(35 + lev) < lev + goldchance[i]) {
-       gmin = (lev - 5) + roll(45);
-       if (gmin > 100)
-           gmin = 100;
-       if (gmin < 10)
-           gmin = 0;
-    }
-    if (lev > 14 && roll(35 + lev) < lev + urchance[i]) {
-       ur = (lev - 5) + roll(45);
-       if (ur > 100)
-           ur = 100;
-       if (ur < 10)
-           ur = 0;
-    }
-    fertil = (85 + fertchance[i] - lev) - (((iron + gmin) / 2) - oil / 3);
-    if (fertil > 120)
-       fertil = 120;
-    if (fertil < 0)
-       fertil = 0;
-    sp->sct_oil = 100;
-    sp->sct_min = 100;
-    sp->sct_gmin = 100;
-    sp->sct_fertil = 100;
-    sp->sct_uran = 100;
-}
-
-int
-nearelev(x, y)
-int x;
-int y;
-{
-    int dir;
-    int dx;
-    int dy;
-    int level;
-
-    level = 0;
-    for (dir = 1; dir <= 6; dir++) {
-       dx = (diroff[dir][0] + x + WORLD_X) % WORLD_X;
-       dy = (diroff[dir][1] + y + WORLD_Y) % WORLD_Y;
-       level += e[dy][dx / 2];
-    }
-    return level;
-}
-
-/*             Already in libgen.a
-roll(n)
-       int     n;
-{
-       return random() % n;
-}
-*/
-
-int
-min(a, b)
-int a;
-int b;
-{
-    if (a < b)
-       return a;
-    return b;
-}