home *** CD-ROM | disk | FTP | other *** search
- This says there should be a patchlevel.h file containing a 0; it should
- unpack with the shar containing this patch. It will be updated to be
- patchlevel 1 by this patch. Kent.
-
- Prereq: 0
-
- *** patchlevel.h.old Sat Apr 20 00:24:56 1991
- --- patchlevel.h Sat Apr 20 00:25:47 1991
- ***************
- *** 1 ****
- ! #define patchlevel 0
- --- 1 ----
- ! #define patchlevel 1
- *** README.old Fri Apr 19 23:48:02 1991
- --- README Sat Apr 20 00:19:09 1991
- ***************
- *** 1,4 ****
- ! Townmaze -- A Program to Design "Bard's Tale I"-Style City Mazes
-
- Copyright 1991 by Kent Paul Dolan, Mountain View, CA, USA 94039-0755
-
- --- 1,4 ----
- ! Townmaze v1.1 -- A Program to Design "Bard's Tale I"-Style City Mazes
-
- Copyright 1991 by Kent Paul Dolan, Mountain View, CA, USA 94039-0755
-
- ***************
- *** 71,76 ****
- --- 71,81 ----
- display. You may also want to read the townuser.doc and townpgmr.doc
- files for more information about the program for users and programmers
- respectively.
- +
- + File CHANGES documents the running changes from release to release, and
- + file townmaze.test will do a complete test of the user interface code;
- + when you see how big script townmaze.test is, you'll know why providing
- + a script was a friendly gesture.
-
- Any non-commercial use of this code is permitted, in whole or in part;
- credit to the author is requested but not demanded. Commercial use may
- *** getargs.c.old Fri Apr 19 18:13:35 1991
- --- getargs.c Fri Apr 19 22:18:55 1991
- ***************
- *** 21,28 ****
- --- 21,59 ----
- char *argv[];
- #endif
- {
- + int scantemp;
- int i;
-
- + /*
- + ** The next two data items and the code at the bottom to use them are
- + ** adapted, and mostly stolen wholesale and reformatted, from suggestions
- + ** submitted by "GLENN E. HOST" <host@ccf4.nrl.navy.mil> along with a
- + ** very prompt bug report. Besides, his changes made me go back and look
- + ** harder at this interface; I hope this error reporting is more useful.
- + ** Thanks, Glenn!
- + */
- +
- + int errctr;
- +
- + static char *quit_messages[] =
- + {
- + " (-h): Maze height must be 11 or greater",
- + " (-h): Maze height must be an odd number",
- + " (-w): Maze width must be 11 or greater",
- + " (-w): Maze width must be an odd number",
- + " (-g): Maze gates must be a non-negative number",
- + " (-g): Too many maze gates to fit",
- + " (-l): Gates left must be a non-negative number",
- + "s: Gates left (-l) must be no greater than gates at start (-g)",
- + " (-c): Maze courts must be a non-negative number",
- + " (-c): Too many maze courts to fit",
- + "s: At least one court (-c) or one gate (-g) must exist",
- + " (-u): Maze unused must be a non-negative number",
- + " (-u): Too many unused cells to fit",
- + " (-s): Straightness must be a non-negative number",
- + " (-s): Straightness must be less than 999"
- + };
- +
- #if PROGRESS
- fprintf(stderr,"Get arguments ");
- #endif
- ***************
- *** 31,36 ****
- --- 62,68 ----
- {
- if ((argc%2) != 1)
- {
- + fprintf(stderr,"\n*** Parameters must come in flag/value pairs\n\n");
- usage();
- exit(1);
- }
- ***************
- *** 39,44 ****
- --- 71,79 ----
- {
- if ((*argv[i]) != '-')
- {
- + fprintf(stderr,
- + "\n*** Expected flag, didn't see '-' for argument %d\n\n",i);
- +
- usage();
- exit(1);
- }
- ***************
- *** 45,52 ****
- switch (*(argv[i]+1))
- {
- case 'h':
- ! if (sscanf(argv[i+1],"%d",&mazeheight) == EOF)
- {
- usage();
- exit(1);
- }
- --- 80,89 ----
- switch (*(argv[i]+1))
- {
- case 'h':
- ! if ( ((scantemp = sscanf(argv[i+1],"%d",&mazeheight)) == EOF)
- ! || (scantemp == 0))
- {
- + fprintf(stderr,"\n*** Unable to read value after '-h'\n\n");
- usage();
- exit(1);
- }
- ***************
- *** 53,112 ****
- break;
-
- case 'w':
- ! if (sscanf(argv[i+1],"%d",&mazewidth) == EOF)
- {
- usage();
- exit(1);
- }
- break;
-
- ! case 'r':
- ! if (sscanf(argv[i+1],"%ld",&randomseed) == EOF)
- {
- usage();
- exit(1);
- }
- - SEEDRANDOM(randomseed); /* override clock seed in main() */
- break;
-
- ! case 'g':
- ! if (sscanf(argv[i+1],"%d",&mazegates) == EOF)
- {
- usage();
- exit(1);
- }
- break;
-
- ! case 'l':
- ! if (sscanf(argv[i+1],"%d",&leftgates) == EOF)
- {
- usage();
- exit(1);
- }
- break;
-
- ! case 'c':
- ! if (sscanf(argv[i+1],"%d",&mazecourts) == EOF)
- {
- usage();
- exit(1);
- }
- break;
-
- ! case 'u':
- ! if (sscanf(argv[i+1],"%d",&mazeunused) == EOF)
- {
- usage();
- exit(1);
- }
- break;
-
- ! case 's':
- ! if (sscanf(argv[i+1],"%d",&mazestraightness) == EOF)
- {
- usage();
- exit(1);
- }
- break;
-
- default:
- --- 90,163 ----
- break;
-
- case 'w':
- ! if ( ((scantemp = sscanf(argv[i+1],"%d",&mazewidth)) == EOF)
- ! || (scantemp == 0))
- {
- + fprintf(stderr,"\n*** Unable to read value after '-w'\n\n");
- usage();
- exit(1);
- }
- break;
-
- ! case 'g':
- ! if ( ((scantemp = sscanf(argv[i+1],"%d",&mazegates)) == EOF)
- ! || (scantemp == 0))
- {
- + fprintf(stderr,"\n*** Unable to read value after '-g'\n\n");
- usage();
- exit(1);
- }
- break;
-
- ! case 'l':
- ! if ( ((scantemp = sscanf(argv[i+1],"%d",&leftgates)) == EOF)
- ! || (scantemp == 0))
- {
- + fprintf(stderr,"\n*** Unable to read value after '-l'\n\n");
- usage();
- exit(1);
- }
- break;
-
- ! case 'c':
- ! if ( ((scantemp = sscanf(argv[i+1],"%d",&mazecourts)) == EOF)
- ! || (scantemp == 0))
- {
- + fprintf(stderr,"\n*** Unable to read value after '-c'\n\n");
- usage();
- exit(1);
- }
- break;
-
- ! case 'u':
- ! if ( ((scantemp = sscanf(argv[i+1],"%d",&mazeunused)) == EOF)
- ! || (scantemp == 0))
- {
- + fprintf(stderr,"\n*** Unable to read value after '-u'\n\n");
- usage();
- exit(1);
- }
- break;
-
- ! case 's':
- ! if ( ((scantemp = sscanf(argv[i+1],"%d",&mazestraightness)) == EOF)
- ! || (scantemp == 0))
- {
- + fprintf(stderr,"\n*** Unable to read value after '-s'\n\n");
- usage();
- exit(1);
- }
- break;
-
- ! case 'r':
- ! if ( ((scantemp = sscanf(argv[i+1],"%ld",&randomseed)) == EOF)
- ! || (scantemp == 0))
- {
- + fprintf(stderr,"\n*** Unable to read value after '-r'\n\n");
- usage();
- exit(1);
- }
- + SEEDRANDOM(randomseed); /* override clock seed in main() */
- break;
-
- default:
- ***************
- *** 116,137 ****
- i += 2;
- }
- }
- ! if ( ((mazewidth%2) != 1)
- ! || ((mazeheight%2) != 1)
- ! || (mazewidth < 11)
- ! || (mazeheight < 11)
- ! || (mazegates < 0)
- ! || (mazegates > (2*((mazeheight - 6)/7) + 2*((mazewidth- 6)/7)))
- ! || (leftgates < 0)
- ! || (leftgates > mazegates)
- ! || (mazecourts < 0)
- ! || (mazecourts > (((mazeheight - 5)/6)*((mazewidth - 5)/6)))
- ! || ((mazecourts + mazegates) < 1)
- ! || (mazeunused > (((mazeheight - 1)/14)*((mazewidth - 1)/14)))
- ! || (mazestraightness < 0)
- ! || (mazestraightness > 998)
- )
- {
- usage();
- exit(1);
- }
- --- 167,204 ----
- i += 2;
- }
- }
- ! /*
- ! ** Thanks to "GLENN E. HOST" <host@ccf4.nrl.navy.mil> for the idea, and
- ! ** most of the new code here, to dump out the reason a command line
- ! ** failed when it does. The functionality was pretty obviously needed
- ! ** with this many parameters and ways to fail. Don't blame Glenn for the
- ! ** way the code looks now, it's back in what he called my "interesting
- ! ** coding style".
- ! */
- ! if ( (errctr=0, mazeheight < 11)
- ! || (errctr++, (mazeheight%2) != 1)
- ! || (errctr++, mazewidth < 11)
- ! || (errctr++, (mazewidth%2) != 1)
- ! || (errctr++, mazegates < 0)
- ! || (errctr++, mazegates > ( 2*((mazeheight - 5)/6)
- ! + 2*((mazewidth - 5)/6)))
- ! || (errctr++, leftgates < 0)
- ! || (errctr++, leftgates > mazegates)
- ! || (errctr++, mazecourts < 0)
- ! || (errctr++, mazecourts > (((mazeheight - 5)/6)*((mazewidth - 5)/6)))
- ! || (errctr++, (mazecourts + mazegates) < 1)
- ! || (errctr++, mazeunused < 0)
- ! || (errctr++, mazeunused > (((mazeheight - 5)/14)*((mazewidth - 5)/14)))
- ! || (errctr++, mazestraightness < 0)
- ! || (errctr++, mazestraightness > 998)
- )
- {
- + fprintf(stderr,"\n*** Bad argument%s. You said:\n\n",
- + quit_messages[errctr]);
- + fprintf(stderr,"ht %d wd %d gates %d left %d courts %d",
- + mazeheight,mazewidth,mazegates,leftgates,mazecourts);
- + fprintf(stderr," unused %d straight %d seed %ld\n\n",
- + mazeunused, mazestraightness,randomseed);
- usage();
- exit(1);
- }
- *** makespace.c.old Fri Apr 19 18:12:19 1991
- --- makespace.c Fri Apr 19 18:21:11 1991
- ***************
- *** 41,47 ****
- exit(1);
- }
-
- ! for (i = 0; i < mazewidth; i++)
- {
- if ((cmaze[i] = (char *)malloc(mazewidth * sizeof(char))) == NULL)
- {
- --- 41,53 ----
- exit(1);
- }
-
- ! /*
- ! ** Thanks to "GLENN E. HOST" <host@ccf4.nrl.navy.mil> for spotting a bug
- ! ** here that should have killed something during testing; I had mazewidth
- ! ** for mazeheight in the loop limit here.
- ! */
- !
- ! for (i = 0; i < mazeheight; i++)
- {
- if ((cmaze[i] = (char *)malloc(mazewidth * sizeof(char))) == NULL)
- {
- *** makestreet.c.old Fri Apr 19 22:48:48 1991
- --- makestreet.c Fri Apr 19 22:54:42 1991
- ***************
- *** 211,218 ****
- /*
- ** Only let an isolated cell become live if it is interior; stops
- ** streets from running along the city wall, creating lots of gates.
- */
- ! if (interiorcell(nhbris(chosencell,nhbrid)))
- for (nextnhbrid = 0; nextnhbrid < 4; nextnhbrid++)
- if (nhbrexists(nhbris(chosencell,nhbrid),nextnhbrid))
- if (statlist[nhbris(nhbris(chosencell,nhbrid),nextnhbrid)].status
- --- 211,225 ----
- /*
- ** Only let an isolated cell become live if it is interior; stops
- ** streets from running along the city wall, creating lots of gates.
- + ** Don't make it live if it is next to an unused cell, either, since
- + ** it can never become a street cell.
- */
- ! if ( interiorcell(nhbris(chosencell,nhbrid))
- ! && (statlist[nhbris(nhbris(chosencell,nhbrid),0)].status != UNUSED)
- ! && (statlist[nhbris(nhbris(chosencell,nhbrid),1)].status != UNUSED)
- ! && (statlist[nhbris(nhbris(chosencell,nhbrid),2)].status != UNUSED)
- ! && (statlist[nhbris(nhbris(chosencell,nhbrid),3)].status != UNUSED)
- ! )
- for (nextnhbrid = 0; nextnhbrid < 4; nextnhbrid++)
- if (nhbrexists(nhbris(chosencell,nhbrid),nextnhbrid))
- if (statlist[nhbris(nhbris(chosencell,nhbrid),nextnhbrid)].status
- *** townpgmr.doc.old Fri Apr 19 22:55:34 1991
- --- townpgmr.doc Sat Apr 20 00:16:48 1991
- ***************
- *** 1,4 ****
- ! File townpgmr.doc, the programmers' documentation for townmaze.
-
-
- This file documents the C code; see file README for compile and
- --- 1,4 ----
- ! File townpgmr.doc, the programmers' documentation for townmaze Release 1.1.
-
-
- This file documents the C code; see file README for compile and
- ***************
- *** 387,393 ****
-
-
- -----------------------------------------------------------------------
- ! | getargs.c
- -----------------------------------------------------------------------
-
- This routine accomplishes step 1) above. Sigh again. Lattice C for
- --- 387,393 ----
-
-
- -----------------------------------------------------------------------
- ! | getargs.c -- getargs(argc,argv)
- -----------------------------------------------------------------------
-
- This routine accomplishes step 1) above. Sigh again. Lattice C for
- ***************
- *** 416,422 ****
- The check below the switch is about half of the sanity in the whole
- program:
-
- ! ((mazewidth%2) != 1) -- The maze width must be odd.
-
- ((mazeheight%2) != 1) -- The maze height must be odd.
-
- --- 416,423 ----
- The check below the switch is about half of the sanity in the whole
- program:
-
- ! (mazeheight < 11) -- The maze must be at least five cells wide to
- ! leave room for one interior row of buildings.
-
- ((mazeheight%2) != 1) -- The maze height must be odd.
-
- ***************
- *** 423,431 ****
- (mazewidth < 11) -- The maze must be at least five cells high to leave
- room for one interior row of buildings.
-
- ! (mazeheight < 11) -- The maze must be at least five cells wide to
- ! leave room for one interior row of buildings.
-
- (mazegates < 0) -- There must be at least zero gates.
-
- (mazegates > (2*((mazeheight - 6)/7) + 2*((mazewidth- 6)/7))) -- There
- --- 424,435 ----
- (mazewidth < 11) -- The maze must be at least five cells high to leave
- room for one interior row of buildings.
-
- ! ((mazewidth%2) != 1) -- The maze width must be odd.
-
- + The above four checks are order sensitive in the error messages they
- + produce, because C (at least the ones I have here) implements modulus
- + of a negative number wrong, so that ((-1)%2 != 1) comes out true.
- +
- (mazegates < 0) -- There must be at least zero gates.
-
- (mazegates > (2*((mazeheight - 6)/7) + 2*((mazewidth- 6)/7))) -- There
- ***************
- *** 445,450 ****
- --- 449,456 ----
-
- ((mazecourts + mazegates) < 1) -- There must be at least one street.
-
- + (mazeunused < 0) -- There must be at least zero unused cells.
- +
- (mazeunused > (((mazeheight - 1)/14)*((mazewidth - 1)/14))) -- Unused
- cells must have room for at least three squares between them,
- otherwise they can trap DEAD cells away from streets and won't fit when
- ***************
- *** 458,463 ****
- --- 464,478 ----
- occur. 999 is the highest value returned by the random roll modded
- against 1000, so 998 is the largest accpetable straightness parameter.
-
- + The above checks now bump an error counter, and if the sanity check
- + drops out for any reason, an appropriate message telling which parameter
- + was wrong, and why, is printed. Since the values read in OK, but were
- + just inappropriate, the header line optional below to stdout is forced
- + here to stderr to show the user what the program thinks s/he said.
- +
- + Similar error reporting is now in the switch statement cases for
- + unreadable parameters.
- +
- If all the parameters are right, the listsize (number of cell
- structures in statlist) is computed from the requested maze width and
- height. If the HEADER option is on (I always use it) a single line of
- ***************
- *** 465,470 ****
- --- 480,487 ----
- [All other output goes to the standard error unit.]
-
-
- +
- +
- -----------------------------------------------------------------------
- | interiorcell.c -- interiorcell(cellid)
- -----------------------------------------------------------------------
- ***************
- *** 598,604 ****
- enough to see that it was the last big logic bug in the program. If
- the neighbor is ISOLATED, it becomes LIVE or DEAD, as appropriate,
- except that border cells always become dead to keep the roads off the
- ! walls as mentioned previously.
-
- This change, however, might mean that the formerly ISOLATED cells LIVE
- neighbors, if any, no longer qualify as LIVE. So, each of those
- --- 615,623 ----
- enough to see that it was the last big logic bug in the program. If
- the neighbor is ISOLATED, it becomes LIVE or DEAD, as appropriate,
- except that border cells always become dead to keep the roads off the
- ! walls as mentioned previously, and neighbors of UNUSED cells never
- ! become LIVE (because they aren't eligible to become streets), but
- ! always go from ISOLATED to DEAD.
-
- This change, however, might mean that the formerly ISOLATED cells LIVE
- neighbors, if any, no longer qualify as LIVE. So, each of those
- *** townuser.doc.old Fri Apr 19 23:48:44 1991
- --- townuser.doc Sat Apr 20 00:16:16 1991
- ***************
- *** 1,9 ****
- ! Welcome, as it were, to townmaze.
-
- Just typing "townmaze" at the command line will do an example maze for
- you, once the program has been compiled and installed (see README).
-
- ! Typing "townmaze help" at the command line will get you a "usage"
- display about 22 lines high, describing each of the parameters and
- their limits.
-
- --- 1,10 ----
- ! Welcome, as it were, to townmaze release 1.1.
-
- Just typing "townmaze" at the command line will do an example maze for
- you, once the program has been compiled and installed (see README).
-
- ! Typing "townmaze help" at the command line will get you an error
- ! message (Read it fast on a 25 line screen!) and then a "usage"
- display about 22 lines high, describing each of the parameters and
- their limits.
-
- ***************
- *** 168,173 ****
- --- 169,181 ----
- you install the software in a computer game, to be able to use a level
- over and over without having to store its design explicitly in the
- game.
- +
- + As of release 1.1, townmaze does lots of error reporting on parameter
- + entry, before dumping the usage display. There is a file called
- + townmaze.test (a csh or AmigaOS script) which will test every error
- + message from the parameter reading routine. It's kind of tedious, but
- + you might want to run it once to make sure your installation is working
- + as it was intended to do.
-
- I hope you have fun with my toy.
-
-