[comp.sources.games] v01i085: xconq - multiplayer strategy game for X-windows, Part05/07

games-request@tekred.UUCP (07/10/87)

Submitted by: "Stanley T. Shebs" <shebs%orion@cs.utah.edu>
Comp.sources.games: Volume 1, Issue 85
Archive-name: xconq/Part05


#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 5 (of 7)."
# Contents:  do.c draw.c mkmap.h ww2.c xconq.c xmap.6
# Wrapped by billr@tekred on Thu Jul  9 17:45:46 1987
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f do.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"do.c\"
else
echo shar: Extracting \"do.c\" \(10886 characters\)
sed "s/^X//" >do.c <<'END_OF_do.c'
X/* Copyright (c) 1987  Stanley T. Shebs, University of Utah. */
X/* This program may be used, copied, modified, and redistributed freely */
X/* for noncommercial purposes, so long as this notice remains intact. */
X
X/* RCS $Header: do.c,v 1.8 87/06/08 21:44:58 shebs Exp $ */
X
X#include "xconq.h"
X
X/* Move in given direction a given distance - used for both single and */
X/* automatic multiple moves. */
X
Xdo_dir(dir, n)
Xint dir, n;
X{
X    switch (mode) {
X    case MOVE:
X	order_movedir(curunit, dir, n);
X	break;
X    case SURVEY:
X	move_survey(n * dirx[dir], n * diry[dir]);
X	break;
X    default:
X	case_panic("mode", mode);
X    }
X}
X
X/* Wander about randomly for a while. */
X
Xdo_random(n)
Xint n;
X{
X    curunit->orders.type = RANDOM;
X    curunit->orders.rept = n;
X}
X
X/* Wake *everything* at current location. */
X
Xdo_wakeup(n)
Xint n;
X{
X    City *city;
X    Unit *unit;
X
X    if ((city = city_at(curx, cury)) != NULL) {
X	for (unit = city->occupant; unit != NULL; unit = unit->nexthere) {
X	    wake_unit(unit);
X	}
X    } else if ((unit = unit_at(curx, cury)) != NULL) {
X	wake_unit(unit);
X    }
X}
X
X/* Wake up all of a player's units (helpful for intercepting runaways). */
X/* This should probably do a subset... */
X
Xdo_wakeall(n)
Xint n;
X{
X    Unit *unit;
X    
X    for_all_units(unit) {
X	if (alive(unit) && own(unit)) wakeup(unit);
X    }
X}
X
X/* Put unit to sleep for a while.  If we sleep it next to something that */
X/* might wake it up, then adjust goal so it won't wake up on next turn. */
X
Xdo_sentry(n)
Xint n;
X{
X    order_sentry(curunit, n);
X    if (would_wakeup(curunit)) curunit->goal = MISSION;
X}
X
X/* Set unit to move to a given location. */
X
Xdo_moveto(n)
Xint n;
X{
X    int x, y;
X
X    read_position("move to -", &x, &y);
X    order_moveto(curunit, x, y);
X}
X
X/* Set unit to attempt to follow a coast. */
X
Xdo_coast(n)
Xint n;
X{
X    int d;
X
X    if ((d = read_direction("Which way to go?")) > 0) {
X	curunit->orders.type = COAST;
X	curunit->orders.rept = n;
X	curunit->orders.parms[0] = 1;
X	curunit->orders.parms[1] = d;
X	curunit->goal = MISSION;
X    }
X}
X
X/* Auxiliary stuff used when searching for place to return to. */
X
XUnit *tmpunit;
X
Xfriendly_city(x, y)
Xint x, y;
X{
X    Unit *unit;
X    City *city;
X
X    if ((city = city_at(x, y)) != NULL && city->side == tmpunit->side)
X	return TRUE;
X    if ((unit = unit_at(x, y)) != NULL &&
X	unit->side == tmpunit->side && can_carry(unit, tmpunit))
X	return TRUE;
X    return FALSE;
X}
X
X/* Search for a friendly city within range and set course for it.  */
X/* Warn player and refuse to move if nothing close enough. */
X
Xdo_return(n)
Xint n;
X{
X    int x, y;
X
X    tmpunit = curunit;
X
X    if (search_area(curunit->x, curunit->y, curunit->supply,
X		    friendly_city, &x, &y)) {
X	order_moveto(curunit, x, y);
X	curunit->goal = REFUEL;
X    } else {
X	cmd_error("No destination in range!");
X    }
X}
X
X/* Give orders to build a base, but only if unit is capable. */
X
Xdo_construct(n)
Xint n;
X{
X    if (utypes[curunit->type].buildtime <= 0) {
X	cmd_error("%s units are not capable of construction", 
X		  unitnames[curunit->type]);
X    } else if (city_at(curx, cury)) {
X	cmd_error("Can't build a base inside a town!");
X    } else {
X	curunit->orders.type = BUILD;
X	curunit->orders.rept = utypes[curunit->type].buildtime;
X	/* be stubborn about it */
X	curunit->goal = MISSION;
X    }
X}
X
X/* don't move for remainder of turn, but be awake next turn. */
X
Xdo_sit(n)
Xint n;
X{
X    switch (mode) {
X    case MOVE:
X	do_sentry(1);
X	break;
X    case SURVEY:
X	break;
X    default:
X	case_panic("mode", mode);
X    }
X}
X
X/* Get rid of unneeded unit, penalizing if not in settled parts. */
X
Xdo_disperse(n)
Xint n;
X{
X    /* test should be for adjacent friendly city? */
X    if (!is_urban(curunit->x, curunit->y) &&
X	!is_adj_resupply(curunit->type, curunit->x, curunit->y)) {
X	notify(curside, "You abandon %s in the wilderness!",
X	       unit_handle(curside, curunit));
X	adjust_score(curunit->side, -2);
X    } else {
X	notify(curside, "%s goes home", unit_handle(curside, curunit));
X    }
X    kill_unit(curunit, DISBAND);
X}
X
X/* Load unit in city onto first available transport in city. */
X
Xdo_embark(n)
Xint n;
X{
X    Unit *unit2;
X    City *city;
X
X    if ((city = city_at(curx, cury)) != NULL) {
X	for (unit2 = city->occupant; unit2 != NULL; unit2 = unit2->nexthere) {
X	    if (can_carry(unit2, curunit)) {
X		leave_square(curunit);
X		embark_unit(unit2, curunit);
X		return;
X	    }
X	}
X    }
X    cmd_error("No transport here!");
X}
X
X/* Set orders to follow a leader unit. */
X
Xdo_follow(n)
Xint n;
X{
X    int x, y;
X    Unit *leader;
X
X    read_position("follow the unit at", &x, &y);
X    if ((leader = unit_at(x, y)) != NULL) {
X	curunit->orders.type = FOLLOW;
X	curunit->orders.parms[0] = (int) leader;
X	curunit->orders.rept = n;
X    } else {
X	cmd_error("No unit to follow!");
X    }
X}
X
X/* Take the current player out of the game while letting everybody else */
X/* continue on. */
X
Xdo_exit_self(n)
Xint n;
X{
X    if (confirm_choice(curside, "Do you really want to give up?")) {
X	notify_all("Those wimpy %s have sued for peace!",
X		   plural_form(curside->name));
X	gaveup = TRUE;
X	side_loses(curside);
X    }
X}
X
X/* Leave quickly when the boss walks by.  One person can kill a multi-player */
X/* game, which isn't too good. */
X
Xdo_exit(n)
Xint n;
X{
X    Unit *unit;
X
X    if (confirm_choice(curside,
X	    "Do you really want to kill the game for everybody?")) {
X	flush_dead_units();
X	for_all_units(unit) {
X	    kill_unit(unit, ENDOFWORLD);
X	}
X	exit_xconq();
X    }
X}
X
X/* The state saving/restoring code supports two versions of a save file, */
X/* differing only in whether the world map is included in the file or is */
X/* in a different place. */
X
X/* Stuff game state into a file.  By default, it goes into the current */
X/* directory. */
X
Xdo_save(n)
Xint n;
X{
X    bool separatemap = FALSE, gorydetails = TRUE;
X    Unit *unit;
X    City *city;
X    Side *side;
X    FILE *fp;
X
X    notify_all("Game being saved to %s ...", rawsavename);
X    if (strlen(rawmapname) != 0) separatemap = TRUE;
X    gorydetails = !Debug;
X    if ((fp = fopen(rawsavename, "w")) != NULL) {
X	fprintf(fp, "%c %d %d\n",
X		(separatemap ? 'S' : 'I'), gametime, gorydetails);
X	if (separatemap) {
X	    fprintf(fp, "%s\n", rawmapname);
X	} else {
X	    write_map(fp);
X	}
X	fprintf(fp, "Sides %d %d\n", numsides, numhosts);
X	for_all_sides(side) {
X	    save_side(side, fp, gorydetails);
X	}
X	fprintf(fp, "Cities %d\n", numcities);
X	for_all_cities(city) {
X	    save_city(city, fp, gorydetails);
X	}
X	/* ensure that passengers are saved after transports */
X	flush_dead_units();
X	sort_units();
X	sort_units();
X	fprintf(fp, "Units %d %d\n", numunits, nextid);
X	for_all_units(unit) {
X	    save_unit(unit, fp);
X	}
X	fclose(fp);
X	exit(0);
X    } else {
X	notify(curside, "Can't open save file `%s'", rawsavename);
X	beep(curside);
X    }
X}
X
X/* Dump out the world map sans cities. */
X
Xwrite_map(fp)
XFILE *fp;
X{
X    int x, y;
X
X    fprintf(fp, "M %d %d %d %d\n",
X	    worldwidth, worldheight, greenwich, equator);
X    for (y = 0; y < worldheight; ++y) {
X	for (x = 0; x < worldwidth; ++x) {
X	    fprintf(fp, "%c", terrchars[terrain(x, y)]);
X	}
X	fprintf(fp, "\n");
X    }
X}
X
X/* Redraw everything using the same code as when X needs a redraw. */
X
Xdo_redraw(n)
Xint n;
X{
X    redraw(curside);
X}
X
X/* Set standing orders for a unit of a given type that enters a given city. */
X
Xdo_standing(n)
Xint n;
X{
X    int type, otype, x, y;
X    Unit *leader;
X    City *city;
X
X    if ((city = city_at(curx, cury)) != NULL && own(city)) {
X	type = read_unit_type("Type of unit to get standing orders");
X	otype = read_order_type("Type of standing orders");
X	city->standing[type].type = otype;
X	switch (orderargs[otype]) {
X	case NOARG:
X	    break;
X	case DIR:
X	    city->standing[type].parms[0] = read_direction("direction");
X	    break;
X	case POS:
X	    read_position("destination", &x, &y);
X	    city->standing[type].parms[0] = x;
X	    city->standing[type].parms[1] = y;
X	    break;
X	case LEADER:
X	    read_position("leader", &x, &y);
X	    leader = unit_at(x, y);
X	    city->standing[type].parms[0] = (int) leader;
X	    break;
X	case WAYPOINTS:
X	    read_position("waypoint 1", &x, &y);
X	    city->standing[type].parms[0] = x;
X	    city->standing[type].parms[1] = y;
X	    read_position("waypoint 2", &x, &y);
X	    city->standing[type].parms[2] = x;
X	    city->standing[type].parms[3] = y;
X	    break;
X	default:
X	    case_panic("order argument type", orderargs[otype]);
X	}
X	city->standing[type].rept =
X	    read_number("repeat order how many times?", 100);
X    } else {
X	cmd_error("No city here to get orders!");
X    }
X}
X
X/* Survey mode allows player to look around (and change things) by moving */
X/* cursor.  The same command toggles in and out, so we need a case statement */
X/* Some "current state" type variables need to be preserved; at least the */
X/* current position and current unit of interest.  No stacking needed, since */
X/* can't survey recursively... */
X
Xdo_survey_mode(n)
Xint n;
X{
X    int oldx, oldy;
X    Unit *oldunit;
X
X    switch (mode) {
X    case MOVE:
X	mode = SURVEY;
X	show_mode(curside);
X	oldx = curx;  oldy = cury;  oldunit = curunit;
X	while (mode == SURVEY) {
X	    read_command();
X	}
X	erase_cursor(curside, curx, cury);
X	curx = oldx;  cury = oldy;  curunit = oldunit;
X	put_on_screen(curside, curx, cury);
X	break;
X    case SURVEY:
X	mode = MOVE;
X	show_mode(curside);
X	break;
X    default:
X	case_panic("mode", mode);
X    }
X}
X
X/* Change what a city is producing. */
X
Xdo_product(n)
Xint n;
X{
X    City *city;
X    
X    if ((city = city_at(curx, cury)) != NULL && own(city)) {
X	set_product(city, decide_product(city), FALSE);
X	show_city(city);
X    } else {
X	cmd_error("You're not on a city!");
X    }
X}
X
X/* Set a city to not produce anything (yes, this really is useful). */
X
Xdo_idle(n)
Xint n;
X{
X    City *city;
X    
X    if ((city = city_at(curx, cury)) != NULL && own(city)) {
X	set_product(city, NOTHING, FALSE);
X	city->schedule = n;
X	show_city(city);
X    } else {
X	cmd_error("You're not on a city!");
X    }
X}
X
X/* Send a short (1 line) message to another player. */
X
Xdo_message(n)
Xint n;
X{
X    char *msg;
X    Side *side;
X
X    for_all_sides(side) {
X	if (side_number(side) == n) {
X	    msg = read_message(side);
X	    if (strlen(msg) > 0) {
X		notify(side, "The %s say to you: %s",
X		       plural_form(curside->name), msg);
X		return;
X	    }
X	}
X    }
X    cmd_error("No side numbered %d ...", n);
X}
X
X/* Command to display the program version.  Looks wired in, but of course */
X/* this is not something that we want to be easily changeable! */
X
Xdo_version(n)
Xint n;
X{
X    notify_all(" ");
X    notify_all("XCONQ version %s", version);
X    notify_all("(c) Copyright 1987, Stanley T. Shebs, University of Utah");
X    notify_all(" ");
X}
X
Xdo_viewall(n)
Xint n;
X{
X    if (Debug) all_view_world();
X}
X
X/* Generic command error routine - beeps display etc. */
X
Xcmd_error(control, a1, a2, a3, a4, a5, a6)
Xchar *control, *a1, *a2, *a3, *a4, *a5, *a6;
X{
X    notify(curside, control, a1, a2, a3, a4, a5, a6);
X    beep(curside);
X}
END_OF_do.c
if test 10886 -ne `wc -c <do.c`; then
    echo shar: \"do.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f draw.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"draw.c\"
else
echo shar: Extracting \"draw.c\" \(11613 characters\)
sed "s/^X//" >draw.c <<'END_OF_draw.c'
X/* Copyright (c) 1987  Stanley T. Shebs, University of Utah. */
X/* This program may be used, copied, modified, and redistributed freely */
X/* for noncommercial purposes, so long as this notice remains intact. */
X
X/* RCS $Header: draw.c,v 1.5 87/06/08 21:45:12 shebs Exp $ */
X
X#include "xconq.h"
X
X#define SQ 16
X
X/* Ensure that given location is visible.  We also flush the input because */
X/* any input relating to a different screen is probably worthless. */
X
Xput_on_screen(side, x, y)
XSide *side;
Xint x, y;
X{
X    if (active_display(side)) {
X	if (!in_middle(side->vcx, side->vcy, x, y)) {
X	    side->vcx = wrap(x);
X	    side->vcy = min(max(y, vhgt2), worldheight-vhgt2-1);
X	    if (side->lastvcx > 0) undraw_box(side);
X	    show_map(side);
X	}
X	draw_cursor(side, curx, cury);
X	flush_output();
X	flush_input();
X    }
X}
X
X/* Decide whether given location is visible relative to where the center */
X/* of the view is at. */
X
Xon_screen(vcx, vcy, x, y)
Xint vcx, vcy, x, y;
X{
X    if (!between(vcy-vhgt2, y, vcy+vhgt2)) return FALSE;
X    if (vcx + vwid2 >= worldwidth && x < vcx - vwid2) x += worldwidth;
X    if (vcx - vwid2 < 0 && x > vcx + vwid2) x -= worldwidth;
X    return between(vcx-vwid2, x, vcx+vwid2);
X}
X
X/* Decide whether given location is not too close to edge of screen. */
X/* We do this because it's a pain to move units when half the adjacent */
X/* places aren't even visible. */
X
Xin_middle(vcx, vcy, x, y)
Xint vcx, vcy, x, y;
X{
X    if (!between(vcy-vhgt2+1, y, vcy+vhgt2-1)) return FALSE;
X    if (vcx+vwid2 >= worldwidth && x < vcx-vwid2) x += worldwidth;
X    if (vcx-vwid2 < 0 && x > vcx+vwid2) x -= worldwidth;
X    return between(vcx-vwid2+2, x, vcx+vwid2-2);
X}
X
X/* Map world x coordinate into a pixel number in the window. */
X
Xxform_x(vcx, x)
Xint vcx, x;
X{
X    if (vcx-vwid2 < 0 && x > vcx+vwid2) x -= worldwidth;
X    if (vcx+vwid2 > worldwidth-1 && x < vcx-vwid2) x += worldwidth;
X    return SQ*(x - (vcx-vwid2));
X}
X
X/* Map world y coordinate into a pixel number in the window. */
X
Xxform_y(vcy, y)
Xint vcy, y;
X{
X    return SQ*((vcy+vhgt2) - y);
X}
X
X#ifdef XWINDOWS
X
X/* Redraw the map of the whole world.  We use blobs instead of icons, but */
X/* even so getting the colors right takes a little work. */
X
Xshow_world(side)
XSide *side;
X{
X    char view;
X    int x, y, color;
X    Side *side2;
X
X    if (active_display(side)) {
X	if (side->lastvcx > 0) undraw_box(side);
X	for (y = worldheight-1; y >= 0; --y) {
X	    for (x = 0; x < worldwidth; ++x) {
X		view = side_view(side, x, y);
X		if (view != UNSEEN) {
X		    if (view == EMPTY) {
X			color = side->sqcolor[terrain(x, y)];
X		    } else {
X			side2 = side_n(valign(view));
X			if (side2 == NULL)
X			    color = side->graycolor;
X			else if (side2 == side)
X			    color = side->bdcolor;
X			else
X			    color = side->enemycolor;
X		    }
X		    XPixSet(side->world,
X			    mapmag*x, mapmag*(worldheight-1-y), mapmag, mapmag,
X			    color);
X		}
X	    }
X	}
X	if (side->vcy > 0) draw_box(side);
X    }
X}
X
X/* Draw immediate area in more detail. */
X
Xshow_map(side)
XSide *side;
X{
X    int x, y, x1, y1, x2, y2, vcx, vcy;
X
X    if (active_display(side)) {
X	vcx = side->vcx;  vcy = side->vcy;
X	x1 = vcx - vwid2;  y1 = vcy - vhgt2;
X	x2 = vcx + vwid2;  y2 = vcy + vhgt2;
X	XClear(side->map);
X
X	for (y = y1; y <= y2; ++y) {
X	    for (x = x1; x <= x2; ++x) {
X		if (seen(side, wrap(x), y)) {
X		    draw_square(side, wrap(x), y);
X		}
X	    }
X	}
X	draw_box(side);
X
X	if (side->showcoords) {
X	    for (x = x1; x < x2; ++x) {
X		if ((x % 5) == 0) {
X		    sprintf(spbuf, "%d", x - greenwich);
X		    XText(side->map, xform_x(vcx, x), xform_y(vcy, y1),
X			  spbuf, strlen(spbuf), 
X			  side->msgfont, side->fgcolor, side->bgcolor);
X		}
X	    }
X	    for (y = y1; y < y2; ++y) {
X		if ((y % 5) == 0) {
X		    sprintf(spbuf, "%d", y - equator);
X		    XText(side->map, xform_x(vcx, x1), xform_y(vcy, y),
X			  spbuf, strlen(spbuf),
X			  side->msgfont, side->fgcolor, side->bgcolor);
X		}
X	    }
X	}
X    }
X}
X
X/* Draw an outline box on the world map.  Since we adopt the dubious trick */
X/* of inverting through all planes, we must be careful to undo before moving */
X
Xdraw_box(side)
XSide *side;
X{
X    invert_box(side, side->vcx, side->vcy);
X    side->lastvcx = side->vcx;
X    side->lastvcy = side->vcy;
X}
X
Xundraw_box(side)
XSide *side;
X{
X    invert_box(side, side->lastvcx, side->lastvcy);
X}
X
X/* Invert the outline box on the world map. */
X
Xinvert_box(side, vcx, vcy)
XSide *side;
Xint vcx, vcy;
X{
X    int x1, y1, x2, y2, sx1, sy1, sx2, sy2;
X
X    /* display check not necessary (?) */
X
X    x1 = vcx - vwid2;  y1 = vcy - vhgt2;
X    x2 = vcx + vwid2;  y2 = vcy + vhgt2;
X    sx1 = mapmag*x1;  sy1 = mapmag*(worldheight-y1);
X    sx2 = mapmag*x2;  sy2 = mapmag*(worldheight-y2);
X
X    XLine(side->world, sx1, sy1, sx2, sy1,
X	  1, 1, side->owncolor, GXinvert, AllPlanes);
X    XLine(side->world, sx2, sy1-1, sx2, sy2+1,
X	  1, 1, side->owncolor, GXinvert, AllPlanes);
X    XLine(side->world, sx2, sy2, sx1, sy2,
X	  1, 1, side->owncolor, GXinvert, AllPlanes);
X    XLine(side->world, sx1, sy2+1, sx1, sy1-1,
X	  1, 1, side->owncolor, GXinvert, AllPlanes);
X}
X
X/* Draw an individual detailed square.  This includes the background color */
X/* or pattern, a unit or city icon, and an id number if necessary. */
X/* This routine may be called in cases where the square is not on the main */
X/* screen;  if so, then the world map but not the local map is drawn on. */
X
Xdraw_square(side, x, y)
XSide *side;
Xint x, y;
X{
X    bool drawbig;
X    char view, str[2];
X    int color, sx, sy;
X    Side *side2;
X
X    /* checking active display not necessary here */
X
X    view = side_view(side, x, y);
X    color = side->sqcolor[terrain(x, y)];
X    if (view != EMPTY) {
X	if (vthing(view) == VCITY)
X	    str[0] = citychars[vtype(view)];
X	else
X	    str[0] = unitchars[vtype(view)];
X	side2 = side_n(valign(view));
X	if (side2 == NULL)
X	    color = side->graycolor;
X	else if (side2 == side)
X	    color = side->owncolor;
X	else
X	    color = side->enemycolor;
X    }
X    drawbig = on_screen(side->vcx, side->vcy, x, y);
X    if (side->fewcolors) {
X	if (drawbig) {
X	    sx = xform_x(side->vcx, x);  sy = xform_y(side->vcy, y);
X	    if (view == EMPTY) {
X		str[0] = terrchars[terrain(x, y)];
X		XText(side->map, sx, sy, str, 1, side->iconfont,
X		      BlackPixel, WhitePixel);
X	    } else {
X		XText(side->map, sx, sy, str, 1, side->iconfont,
X		      (side == side2 ? BlackPixel : WhitePixel),
X		      (side == side2 ? WhitePixel : BlackPixel));
X		if (side2 != NULL && side2 != side) {
X		    sprintf(str, "%d", side_number(side2));
X		    XTextMask(side->map, sx, sy, str, 1, side->iconfont,
X			      WhitePixel);
X		}
X	    }
X	}
X    } else {
X	if (drawbig) {
X	    sx = xform_x(side->vcx, x);  sy = xform_y(side->vcy, y);
X	    XPixSet(side->map, sx, sy, SQ, SQ, side->sqcolor[terrain(x, y)]);
X	    if (view != EMPTY) {
X		XTextMask(side->map, sx, sy, str, 1, side->iconfont, color);
X		if (numsides > 2 && side2 != NULL && side2 != side) {
X		    sprintf(str, "%d", side_number(side2));
X		    XTextMask(side->map, sx, sy, str, 1, side->iconfont,
X			      color);
X		}
X	    }
X	}
X	/* don't want black blobs on world map */
X        if (color == side->owncolor) color = side->bdcolor;
X        XPixSet(side->world,
X                mapmag*x, mapmag*(worldheight-1-y), mapmag, mapmag, color);
X    }
X    /* so other players see when something moves */
X    if (side != curside && curside != NULL) XFlush();
X}
X
X/* Draw an unseen square (for cursor erasing).  A gutted version of prev fn */
X
Xdraw_black_square(side, x, y)
XSide *side;
Xint x, y;
X{
X    bool drawbig;
X    int sx, sy;
X
X    drawbig = on_screen(side->vcx, side->vcy, x, y);
X    if (drawbig) {
X	sx = xform_x(side->vcx, x);  sy = xform_y(side->vcy, y);
X	XPixSet(side->map, sx, sy, SQ, SQ, side->bgcolor);
X    }
X}
X
X/* Draw a cursor indicating the current unit to be moved.  As an aide to */
X/* following the cursor around, flash some lines (only for human players of */
X/* course!).  If the option is set, then the mouse cursor will be moved too. */
X
Xdraw_cursor(side, x, y)
XSide *side;
Xint x, y;
X{
X    int sx, sy;
X
X    if (active_display(side)) {
X	if (humanside(side)) {
X	    sx = xform_x(side->vcx, x);  sy = xform_y(side->vcy, y);
X	    if (abs(x - side->lastx) > 2 || abs(y - side->lasty) > 2) {
X		XLine(side->map, sx-50, sy-50, sx+50, sy+50,
X		      1, 1, side->owncolor, GXinvert, AllPlanes);
X		XLine(side->map, sx-50, sy+50, sx+50, sy-50,
X		      1, 1, side->owncolor, GXinvert, AllPlanes);
X		XFlush();
X		XLine(side->map, sx-50, sy-50, sx+50, sy+50,
X		      1, 1, side->owncolor, GXinvert, AllPlanes);
X		XLine(side->map, sx-50, sy+50, sx+50, sy-50,
X		      1, 1, side->owncolor, GXinvert, AllPlanes);
X	    }
X	    /* monochrome should invert, but program draws cursor twice, */
X	    /* causing inverted image to go back to normal quickly */
X	    XPixFill(side->map, sx, sy, SQ, SQ,
X		     side->bgcolor, side->cmask, GXcopy, AllPlanes);
X	    XPixFill(side->map, sx, sy, SQ, SQ,
X		     side->fgcolor, side->ccurs, GXcopy, AllPlanes);
X	    side->lastx = x;  side->lasty = y;
X	}
X	if (side->warpmouse) {
X	    XWarpMouse(side->map, sx+SQ/2, sy+SQ/2);
X	}
X    }
X}
X
X/* Draw a picture of the unit in the same color as the cursor, to make */
X/* units in cities and on transports visible. */
X
Xdraw_occupier(side, type, x, y)
XSide *side;
Xint type, x, y;
X{
X    char str[2];
X    int sx, sy;
X
X    if (active_display(side)) {
X	sx = xform_x(side->vcx, x);  sy = xform_y(side->vcy, y);
X	str[0] = unitchars[type];
X	XTextMask(side->map, sx, sy, str, 1, side->iconfont, side->curscolor);
X    }
X}
X
X/* Get rid of cursor blob by redrawing the square. */
X
Xerase_cursor(side, x, y)
XSide *side;
Xint x, y;
X{
X    if (active_display(side)) {
X	if (x < 0 || x > worldwidth || y < 0 || y > worldheight) {
X	    printf("Burp.\n");
X	    abort();
X	}
X	if (humanside(side) && side->lasty > 0) {
X	    if (seen(side, x, y))
X		draw_square(side, side->lastx, side->lasty);
X	    else
X		draw_black_square(side, side->lastx, side->lasty);
X	}
X    }
X}
X
X/* Make a flashy display when The Bomb goes off.  Because of the time delays */
X/* we have to update both sides' displays more or less simultaneously. */
X
Xexplode_nuke(side1, side2, x, y)
XSide *side1, *side2;
Xint x, y;
X{
X    int i, sx1, sy1, sx2, sy2;
X
X    sx1 = xform_x(side1->vcx, x);  sy1 = xform_y(side1->vcy, y);
X    sx2 = xform_x(side2->vcx, x);  sy2 = xform_y(side2->vcy, y);
X	
X    if (active_display(side1)) {
X	XTileFill(side1->map, 0, 0, vwid*SQ, vhgt*SQ,
X		  WhitePixmap, 0, GXinvert, AllPlanes);
X	XFlush();
X    }
X    if (active_display(side2)) {
X	XTileFill(side2->map, 0, 0, vwid*SQ, vhgt*SQ,
X		  WhitePixmap, 0, GXinvert, AllPlanes);
X	XFlush();
X    }
X    if (active_display(side1)) {
X	XTileFill(side1->map, 0, 0, vwid*SQ, vhgt*SQ,
X		  WhitePixmap, 0, GXinvert, AllPlanes);
X	XFlush();
X    }
X    if (active_display(side2)) {
X	XTileFill(side2->map, 0, 0, vwid*SQ, vhgt*SQ,
X		  WhitePixmap, 0, GXinvert, AllPlanes);
X	XFlush();
X    }
X    for (i = 0; i < 3; ++i) {
X	if (active_display(side1)) {
X	    XPixFill(side1->map, sx1-4*i, sy1-8*i, 8*i+SQ, 8*i+SQ,
X		     side1->bgcolor, side1->bombpics[i], GXcopy, AllPlanes);
X	    XFlush();
X	}
X	if (active_display(side2)) {
X	    XPixFill(side2->map, sx2-4*i, sy2-8*i, 8*i+SQ, 8*i+SQ,
X		     side2->bgcolor, side2->bombpics[i], GXcopy, AllPlanes);
X	    XFlush();
X	}
X	sleep(1);
X    }
X    sleep(1);
X}
X
X/* Draw a picture of the unit in the help window so players can see what */
X/* it's supposed to look like.  Can assume display is active here. */
X
Xdraw_unit_pic(side, type, sx, sy)
XSide *side;
Xint type, sx, sy;
X{
X    char str[2];
X
X    str[0] = unitchars[type];
X    XText(side->help, sx, sy, str, 1, 
X	  side->iconfont, side->bgcolor, side->fgcolor);
X}
X
X#endif XWINDOWS
END_OF_draw.c
if test 11613 -ne `wc -c <draw.c`; then
    echo shar: \"draw.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f mkmap.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"mkmap.h\"
else
echo shar: Extracting \"mkmap.h\" \(11195 characters\)
sed "s/^X//" >mkmap.h <<'END_OF_mkmap.h'
X/* Copyright (c) 1987  Stanley T. Shebs, University of Utah. */
X/* This program may be used, copied, modified, and redistributed freely */
X/* for noncommercial purposes, so long as this notice remains intact. */
X
X/* RCS $Header: mkmap.h,v 1.2 87/05/21 18:07:23 shebs Exp $ */
X
X/* In order for map generation to work right, we need the exact number of */
X/* names present.  A pain, but that's what we get for using C ... */
X
X#define MAXCITYNAMES 664
X 
X/* The following names are derived from the Rand-McNally International Atlas */
X/* and from their US road atlas. */
X 
Xchar *citynames[] = { 
X	/* Soviet Union */ 
X	"Uglegorsk", "Taganrog", "Kuzemino", "Igodovo", 
X	"Izhevsk", "Leninskoye", "Zvenigorod", "Faustovo", 
X	"Tokma", "Bolotnoje", "Pudino", "Predivinsk", 
X	"Gotoputovo", "Stupino", 
X	/* Japan */ 
X	"Toyooka", "Kobayashi", "Kamiyahagi", "Fukude", 
X	/* China */ 
X	"Dandong", "Xingtai", "Xiaojiagang", "Wushu", 
X	"Wutangjie", "Qingfeng", "Dushikou", "Huilong", 
X	"Linyi", "Miaoyang", "Xinbo", "Bugt", 
X	/* Indochina */ 
X	"Tan-an", "Ban\\ Khlong\\ Kua", "Bo\\ Phloi", "Thot-not",
X	"Herbertabad", "Mong\\ Pawn", "Roi\\ Et",
X	/* Indonesia */ 
X	"Butong", "Lubukbertubung", "Moutong", "Gimpu", 
X	"Waingapu", "Sindangbarang", "Kualakapuas", "Bongka", 
X	"Salimbatu", "Bonggaw", "Baing", "Grokgak", 
X	/* India */ 
X	"Bap", "Meerut", "Harda", "Garwa", 
X	"Digboi", "Kurnool", "Nirmal", "Coondapoor", 
X	"Tetulbaria", "Maheshwar", "Paramagudi", "Bhakkar", 
X	"Mungaoli", "Shorapur", "Channapatna", "Chilaw", 
X	/* Middle East and Central Asia */ 
X	"Bajandalaj", "Cogt-Ovoo", "Un't", "Ich-Uul", 
X	"Yazd", "Samarkand", "Mashhad", "Chah\\ Bahar", 
X	"Jubbah", "Al-'Awsajiyah", "Kifri", "Kashgar", 
X	"Chundzha", "Ushtobe", "Dzaamar", "Wadi\\ Musa", 
X	"Bogustan", "Gakuch", 
X	/* Africa */ 
X	"Pibor\\ Post", "Umm\\ Digulgulaya", "Umm\\ Shalil", "Buzaymah", 
X	"Gedo", "North\\ Horr", "Todenyang", "Madadi", 
X	"Ngetera", "Ouadda", "Mazoula", "Tiglit", 
X	"Gummi", "Gbarnga", "Burutu", "Bafwabalinga", 
X	"Goonda", "Ankoroka", "Vryburg", "Matuba", 
X	"Bakouma", "El\\ Idrissia", "Agadir", "Nungwe", 
X	"Bunianga", "Ngali", "Nguiroungou", "Otukpa", 
X	"Hell-Ville", "Morafenobe", "Tongobory", "Farafangana", 
X	"Mungbere", "Haco", "Barbar", 
X	/* Australia */ 
X	"Nookawarra", "Bunbury", "Buckleboo", "Breeza\\ Plains", 
X	"Mistake\\ Creek", "Boolaloo", "Yarloop", "Dubbo", 
X	"Bushy\\ Park", "Old\\ Cork", "Cessnock", "Wagga\\ Wagga", 
X	"Mungar\\ Junction", "Koolywirtie", "Wonthaggi",
X	"Oatlands", "Bindebango",
X	/* New Guinea */ 
X	"Kwatisore", "Finschhafen", "Yobi", "Rumahtinggih", 
X	/* USA */ 
X	/* AL */ 
X	"New\\ Hope", "Hackleburg", 
X	/* AK */ 
X	"Kaktovik", "Fort\\ Yukon", 
X	/* AZ */ 
X	"Benson", "Gila\\ Bend", "Turkey\\ Flat", "Tuba\\ City",  
X	"Wide\\ Ruins", 
X	/* AR */ 
X	"Metalton", "Oil\\ Trough", "Hackett",
X	/* CA */ 
X	"Burnt\\ Ranch", "Calexico", "Eel\\ Rock", "Gilroy", 
X	"Joshua\\ Tree", "Milpitas", "Mormon\\ Bar", "Pumpkin\\ Center", 
X	"Death\\ Valley\\ Junction", "Toms\\ Place", "Pinole", "Petaluma", 
X	"Scotts\\ Valley", "Whiskeytown", "Leucadia", "Lompoc",
X	"Granada\\ Hills",
X	/* CO */ 
X	"Las\\ Animas", "Silver\\ Plume", 
X	/* CT */ 
X	"Upper\\ Stepney", "Moosup", "Danbury",
X	/* FL */ 
X	"Yeehaw\\ Junction", "Big\\ Pine\\ Key", "Panacea", "Wewahitchka", 
X	"Estiffanulga", 
X	/* GA */ 
X	"Dixie\\ Union", "Fowlstown", "Dacula", "Americus", 
X	/* HW */ 
X	"Laupahoehoe", 
X	/* ID */ 
X	"Malad\\ City", "Kootenai", 
X	/* IL */ 
X	"Farmer\\ City", "Aroma\\ Park", "Goreville", "Illiopolis",  
X	"Mascoutah", "Metamora", "Metropolis", "New\\ Boston",  
X	"Pontoon\\ Beach", "Romeoville", "Teutopolis",  
X	/* IN */ 
X	"Etan\\ Green", "French\\ Lick", "Loogootee", "Needmore",  
X	"Ogden\\ Dunes", "Oolitic", "Star\\ City",  
X	/* IA */ 
X	"Coon\\ Rapids", "Correctionville", "Grundy\\ Center",
X	"Lost\\ Nation", "Ossian", "Sac\\ City",  
X	/* KA */ 
X	"Countryside", "Mankato", "Pretty\\ Prairie",  "Greeley",
X	"Grouse\\ Creek",
X	/* KY */ 
X	"Big\\ Clifty", "Cloverport", "Druid\\ Hills", "Fancy\\ Farm", 
X	"Hardburly", "Hardshell", "Horse\\ Cave", "Pleasureville", 
X	"Science\\ Hill", "Sublimity\\ City", "Watergap", 
X	/* LA */ 
X	"Bayou\\ Goula", "Cut\\ Off", "Hackberry", "Lutcher", 
X	"Waggaman", 
X	/* ME */ 
X	"Veazie", "Madawaska", 
X	/* MD */ 
X	"Bestgate", "College\\ Park", "Frostburg", "Pocomoke\\ City", 
X	"Port\\ Deposit", "Pumphrey", "Tammany\\ Manor", "Weems\\ Creek", 
X	"Whiskey\\ Bottom", "Hack\\ Point",
X	/* MA */ 
X	"Assinippi", "Buzzards\\ Bay", "Dorothy\\ Pond", "Hopkinton", 
X	"Housatonic", "Pigeon\\ Cove", "Swampscott", "Gloucester",
X	"Hyannis Port",
X	/* MI */ 
X	"Bad\\ Axe", "Brown\\ City", "Cassopolis", "New\\ Buffalo", 
X	"Petoskey", "Ishpeming", "Ypsilanti", "Saugatuck", 
X	/* Michigan UP (from Sandra Loosemore) */ 
X	"Skanee", "Bruce\\ Crossing", "Baraga", "Germfask", 
X	"Assinins", "Tapiola", "Gaastra", "Bete\\ Grise", 
X	/* MN */ 
X	"Ada", "Blue\\ Earth", "Brainerd", "Eden\\ Valley",  
X	"Lino\\ Lakes", "New\\ Prague", "Sleepy\\ Eye", "Waconia",  
X	/* MS */ 
X	"Bogue\\ Chitto", "Buckatunna", "Guntown", "Picayune", 
X	"Red\\ Lick", "Senatobia", "Tie\\ Plant", "Yazoo\\ City",  
X	/* MO */ 
X	"Bourbon", "Doe\\ Run", "Hayti", "Humansville", 
X	"Lutesville", "Moberly", "New\\ Madrid", "Peculiar", 
X	"Sappington", "Vandalia",  
X	/* MT */ 
X	"Big\\ Sandy", "Hungry\\ Horse", "Kalispell",  "East\\ Missoula",
X	/* NB */ 
X	"Hershey", "Loup\\ City", "Minatare", "Wahoo",  "Grainfield",
X	/* NV */ 
X	"Winnemucca", "Tonopah", "Jackpot",  
X	/* NH */ 
X	"Littleton", "Winnisquam",  
X	/* NJ */ 
X	"Cheesequake", "Freewood\\ Acres", "Forked\\ River", "Hoboken", 
X	"Maple\\ Shade", "New\\ Egypt", "Parsippany", "Ship\\ Bottom",  
X	"Succasunna",  
X	/* NM */ 
X	"Adobe\\ Acres", "Cloudcroft", "Los\\ Padillos", "Ojo\\ Caliente", 
X	"Ruidoso", "Toadlena",  
X	/* NY */ 
X	"Angola\\ on\\ the\\ Lake", "Aquebogue", "Muttontown", "Hicksville", 
X	"Hoosick\\ Falls", "Painted\\ Post", "Peekskill", "Portville",  
X	"Ronkonkoma", "Wappingers\\ Falls", "Sparrow\\ Bush", "Swan\\ Lake",
X	"Podunk", "Chili\\ Center",
X	/* NC */ 
X	"Altamahaw", "Biltmore\\ Forest", "Boger\\ City", "Granite\\ Quarry",  
X	"High\\ Shoals", "Lake\\ Toxaway", "Scotland\\ Neck", "Hiddenite", 
X	"Kill\\ Devil\\ Hills", "Mocksville", "Yadkinville", "Nags\\ Head", 
X	"Rural\\ Hall",  
X	/* ND */ 
X	"Cannon\\ Ball", "Hoople", "Zap",  
X	/* OH */ 
X	"Academia", "Arcanum", "Blacklick\\ Estates", "Blue\\ Ball",  
X	"Crooksville", "Dry\\ Run", "Flushing", "Gratis",  
X	"Lithopolis", "Mingo\\ Junction", "Newton\\ Falls",
X	"New\\ Straitsville", 
X	"Painesville", "Pepper\\ Pike", "Possum\\ Woods", "Sahara\\ Sands",  
X	/* OK */ 
X	"Bowlegs", "Broken\\ Arrow", "Fort\\ Supply", "Drumright", 
X	"Dill\\ City", "Okay", "Hooker",  
X	/* OR */ 
X	"Condon", "Happy\\ Valley", "Drain", "Junction\\ City", 
X	"Molalla", "Philomath", "Tillamook",  
X	/* PA */ 
X	"Atlasburg", "Beaver\\ Meadows", "Birdsboro", "Daisytown", 
X	"Fairless\\ Hills", "Fairchance", "Kutztown", "Erdenheim", 
X	"Hyndman", "Pringle", "Scalp\\ Level", "Slickville", 
X	"Zelienople", "Sugar\\ Notch", "Toughkenamon", "Throop", 
X	"Tire\\ Hill", "Wormleysburg", "Oleopolis",
X	/* RI */ 
X	"Woonsocket", 
X	/* SC */ 
X	"Due\\ West", "Ninety\\ Six", "Travelers\\ Rest", "Ware\\ Shoals",  
X	/* SD */ 
X	"Deadwood", "Lower\\ Brule", "New\\ Underwood", "Pickstown", 
X	"Plankinton", "Tea", "Yankton",  
X	/* TN */ 
X	"Berry's\\ Chapel", "Bulls\\ Gap", "Cornersville", "Counce", 
X	"Gilt\\ Edge", "Grimsley", "Malesus", "Soddy-Daisy",  
X	/* TX */ 
X	"Bastrop", "New\\ Braunfels", "Harlingen", "Dimock", 
X	"Devils\\ Elbow", "North\\ Zulch", "Llano", "Fort\\ Recovery", 
X	"Arp", "Bovina", "Cut\\ and\\ Shoot", "College\\ Station", 
X	"Grurer", "Iraan", "Leming", "Harlingen", 
X	"Muleshoe", "Munday", "Kermit", "La\\ Grange", 
X	"Ropesville", "Wink", "Yoakum", "Sourlake",  
X	/* UT */ 
X	"Delta", "Moab*Moabite", "Nephi*Nephite", "Loa", 
X	"Moroni*Moron", "Orem", "Tooele", "Sigurd", 
X	/* VT */ 
X	"Bellows\\ Falls", "Chester\\ Depot", "Winooski",  
X	/* VA */ 
X	"Accotink", "Ben\\ Hur", "Ferry\\ Farms", "Disputanta", 
X	"Dooms", "Sleepy\\ Hollow", "Max\\ Meadows", "Goochland", 
X	"Rural\\ Retreat", "Sandston", "Stanleytown", "Willis\\ Wharf", 
X	"Stuarts\\ Draft", 
X	/* WA */ 
X	"Black\\ Diamond", "Carnation", "Cle\\ Elum", "Cosmopolis", 
X	"Darrington", "Enumclaw", "Forks", "Goose\\ Prairie", 
X	"Navy\\ Yard\\ City", "La\\ Push", "Soap\\ Lake", "Walla\\ Walla", 
X	"Sedro\\ Woolley", "Pe\\ Ell", "Ruston",  
X	/* WV */ 
X	"Barrackville", "Pocatalico", "Fort\\ Gay", "Big\\ Chimney", 
X	"Nutter\\ Fort", "Hometown", "Nitro", "Triadelphia", 
X	"Star\\ City",  
X	/* WI */ 
X	"Combined\\ Lock", "Coon\\ Valley", "Black\\ Earth", "New\\ Holstein", 
X	"Little\\ Chute", "Wisconsin\\ Dells", "Random\\ Lake", "Sheboygan", 
X	"Nauwatosa",  
X	/* WY */ 
X	"East\\ Thermopolis", "Fort\\ Washakie", "Paradise\\ Valley", 
X	/* Canada */ 
X	"Sexsmith", "Squamish", "Fort\\ Qu'Appelle", "Flin\\ Flon", 
X	"Moose\\ Jaw", "Grand-Mere", "Great\\ Village", "Pugwash", 
X	"Chiliwack", "Cranbery\\ Portage",  
X	"Moosonee", "Joe\\ Batt's\\ Arm", 
X	"St.-Polycarpe", "Crabtree\\ Mills", "Copper\\ Cliff", "Uxbridge", 
X	"Penetanguishene", "Boger\\ City", "Drumheller", 
X	"Port\\ Blandford", 
X	"Hamtramck",
X	"Hackensack", "North\\ Middleboro", "Fannettsburg", 
X	"Corkscrew", "Boynton\\ Beach", 
X	"Belchertown",
X	/* South America */ 
X	"Huatabampo", "Zapotiltic", "Ipiranga", "Perseverancia", 
X	"Bilwaskarma", "Aguadulce", "Albert\\ Town", "Fuente\\ de\\ Oro", 
X	"Pedras\\ de\\ Fogo", "Maxaranguape", "Comodoro\\ Rivadavia",
X	"Coribe", "Rossell\\ y\\ Rius", "General\\ Alvear",
X	"Ushaia", "Los\\ Antiguos", "Puerto\\ Alegre", "Quevedo", 
X	/* Eastern Europe */ 
X	"Kannonkoski", "Uusikaupunki", "Ulfborg", "Wloszczowa", 
X	"Drohiczyn", "Vrchlabi", "Oroshaza", "Klagenfurt", 
X	"Pisz", "Krokowa", "Partizanske", "Ozd", 
X	"Jimbolia", "Peshkopi", "Galaxidhion", "Naxos", 
X	/* Western Europe */
X	"Thingvellir", "Honningsvag", "Vikna", "Jokkmokk",
X	"Rimbo", "Kukkola", "Viitasaari", "Ballybunion",
X	"Banagher", "Carncastle", "Diepholz", "Sangerhausen",
X	"Mosbach", "Butzbach", "Goslar", "Studenka",
X	"Slavonice", "Gouda", "Dokkum", "Oss",
X	"Lisp", "Knokke", "Bialy", "Bor",
X	"Hel", "Puck",
X	"Guderup", "Grindsted", "Store\\ Andst", "Odder", 
X	"Vrigstad", "Trollhaetten", "Kinsarvik", "Grimstad", 
X	"Biedenkopf", "Bad\\ Bramstedt", "Dinkelsbuehl", "Hoogezand", 
X	"Schoensee", "Fuerstenfeldbruck", "Pfaffenhausen", "Namlos", 
X	"Consdorf", "Cloppenburg", "Bad\\ Muskau", "Exing",
X	"Bad\\ Hall",
X	"Bois-d'Arcy", "Presles-en-Brie", "Silly-le-Long", "Saint-Witz", 
X	"Limoux", "Crozon", "Guilvinec", "Poggibonsi", 
X	"Pignans", "La\\ Tour-du-Pin", "Roquefort", "Saint-Quentin", 
X	"Bobbio", "Viareggio", "Siderno", "Cortona", 
X	"Pedrogao\\ Grande", "Villarcayo", "Alosno", "La\\ Bisbal", 
X	/* UK */ 
X	"Fawkham\\ Green", "Cold\\ Norton", "Potten\\ End", "Battlesbridge", 
X	"Ysbyty\\ Ystwyth", "Llanbrynmair", "St\\ Keverne", "Foxholes", 
X	"Whitby", "Sutton-on-Sea", "Tweedmouth", "Wrexham", "Bletchley",
X	"Kirkwall", "Blair\\ Atholl", "Inchbare", "Blackwaterfoot", 
X	"Ramsgate", "Llantwit\\ Major", "Minehead", "Buckfastleigh", 
X	"Pocklington", "Robin\\ Hood's\\ Bay", "West\\ Kilbride",
X        "Inchnadamph", "North\\ Tolsta", "Oykel Bridge",
X	"Pangbourne", "Moreton-in-Marsh", "Wye", "Congresbury" 
X}; 
END_OF_mkmap.h
if test 11195 -ne `wc -c <mkmap.h`; then
    echo shar: \"mkmap.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f ww2.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"ww2.c\"
else
echo shar: Extracting \"ww2.c\" \(4514 characters\)
sed "s/^X//" >ww2.c <<'END_OF_ww2.c'
X/* Copyright (c) 1987  Stanley T. Shebs, University of Utah. */
X/* This program may be used, copied, modified, and redistributed freely */
X/* for noncommercial purposes, so long as this notice remains intact. */
X
X/* RCS $Header: ww2.c,v 1.2 87/05/22 16:51:25 shebs Exp $ */
X
X#include "xconq.h"
X
Xchar periodname[] = "WW II ca 1945";
X
Xchar fontname[] = "ww2";
X
X/* number of types of units + 1 */
X
Xint numutypes = 10;
X
Xint assaulter = 0;
X
Xint ttransport = 6;
X
X/* The details are more WWII than mid-80s, and there are a few distortions */
X/* even for that period.  Game balance is a wonderful thing... */
X
XUtype utypes[] =
X{ { 'I', "infantry",
X    "slow-moving but easy to produce, captures cities",
X    0, 1, 1, 0, 6, 1, 4, 5, 0,
X    { 0, 0, 1, 1, 1, 1, 0 },
X    { 0, 0, 1, 1, 0, 0, 0 },
X    { 0, 0, 0, 0, 0, 0, 0 },
X    { 50, 40, 20, 15, 20, 20, 30, 20, 9, 100 }, 1, 0, 0,
X    { 0, 2, 2, 2 }, { 0, 70, 50, 20 }, { 0, 10, 30, 50 },
X    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }, 3, 1 },
X  { 'A', "armor",
X    "zips along in open country, captures cities",
X    0, 2, 1, 0, 10, 1, 7, 8, 0,
X    { 0, 0, 2, 0, 2, 0, 0 },
X    { 0, 0, 1, 0, 0, 0, 0 },
X    { 0, 0, 0, 0, 0, 0, 0 },
X    { 60, 50, 30, 30, 30, 20, 30, 20, 20, 100 }, 1, 1, 0,
X    { 0, 2, 2, 2 }, { 0, 90, 60, 25 }, { 0, 10, 20, 40 },
X    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }, 5, 1 },
X  { 'F', "fighter",
X    "fast, good for recon, limited range",
X    2, 9, 1, 0, 18, 1, 8, 10, 0,
X    { 9, 9, 9, 9, 9, 9, 9 },
X    { 0, 0, 0, 0, 0, 0, 0 },
X    { 0, 0, 0, 0, 0, 0, 0 },
X    { 15, 25, 60, 70, 20, 30, 20, 50, 40, 100 }, 1, 4, 3,
X    { 0, 1, 1, 1 }, { 0, 1, 1, 1 }, { 0, 30, 50, 70 },
X    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, -1, 0 },
X  { 'G', "bomber",
X    "not as fast, longer range, beats on cities",
X    2, 6, 1, 0, 36, 2, 16, 20, 0,
X    { 6, 6, 6, 6, 6, 6, 6 },
X    { 0, 0, 0, 0, 0, 0, 0 },
X    { 0, 0, 0, 0, 0, 0, 0 },
X    { 20, 20, 10, 10, 30, 50, 50, 70, 60, 100 }, 2, 3, 3,
X    { 0, 1, 1, 1}, { 0, 2, 2, 3 }, { 0, 20, 30, 50 },
X    { 1, 0, 0, 0, 0, 0, 0, 0, 0, 2 }, -1, 0 },
X  { 'D', "destroyer",
X    "effective against subs, quickly built",
X    1, 3, 1, 0, 100, 3, 10, 20, 0,
X    { 3, 1, 0, 0, 0, 0, 0 },
X    { 0, 0, 0, 0, 0, 0, 0 },
X    { 0, 0, 1, 0, 0, 0, 0 },
X    { 5, 5, 10, 5, 60, 70, 60, 40, 20, 100 }, 1, 3, 1,
X    { 0, 1, 1, 1 }, { 0, 1, 1, 1 }, { 0, 10, 30, 60 },
X    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }, -1, 0 },
X  { 'S', "submarine",
X    "quickly built, good for sinking ships",
X    1, 3, 1, 0, 100, 2, 15, 25, 1,
X    { 3, 1, 0, 0, 0, 0, 0 },
X    { 0, 0, 0, 0, 0, 0, 0 },
X    { 0, 0, 0, 0, 0, 0, 0 },
X    { 0, 0, 10, 5, 40, 30, 60, 40, 50, 100 }, 3, 3, 10,
X    { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 },
X    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }, -1, 0 },
X  { 'T', "troop transport",
X    "carries ground units but slower",
X    1, 2, 1, 0, 200, 3, 10, 10, 0,
X    { 2, 1, 0, 0, 0, 0, 0 },
X    { 0, 0, 0, 0, 0, 0, 0 },
X    { 0, 0, 1, 0, 0, 0, 0 },
X    { 20, 5, 10, 5, 50, 50, 50, 30, 9, 100 }, 1, 3, 1,
X    { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 },
X    { 5, 3, 0, 0, 0, 0, 0, 0, 0, 0 }, -1, 0 },
X  { 'C', "carrier",
X    "carries fighters, fast and durable",
X    1, 4, 1, 0, 200, 4, 30, 30, 0,
X    { 4, 0, 0, 0, 0, 0, 0 },
X    { 0, 0, 0, 0, 0, 0, 0 },
X    { 0, 0, 1, 0, 0, 0, 0 },
X    { 30, 20, 40, 10, 30, 30, 40, 20, 20, 100 }, 1, 2, 1,
X    { 0, 1, 1, 1 }, { 0, 2, 2, 2 }, { 0, 20, 40, 60 },
X    { 0, 0, 8, 1, 0, 0, 0, 0, 0, 2 }, -1, 0 },
X  { 'B', "battleship",
X    "indestructible, effective against cities",
X    1, 4, 1, 0, 200, 8, 40, 60, 0,
X    { 4, 0, 0, 0, 0, 0, 0 },
X    { 0, 0, 0, 0, 0, 0, 0 },
X    { 0, 0, 1, 0, 0, 0, 0 },
X    { 50, 50, 50, 20, 70, 50, 90, 50, 90, 100 }, 2, 1, 1,
X    { 0, 1, 1, 1 }, { 0, 2, 3, 4 }, { 0, 10, 30, 50 },
X    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }, -1, 0 },
X  { 'N', "atomic bomb",
X    "destroys things utterly",
X    0, 1, 1, 0, 2, 1, 20, 80, 1,
X    { 0, 0, 1, 0, 0, 0, 0 },
X    { 0, 0, 0, 0, 0, 0, 0 },
X    { 0, 0, 0, 0, 0, 0, 0 },
X    { 90, 90, 5, 5, 90, 90, 90, 90, 90, 1 }, 50, 0, 0,
X    { 0, 1, 1, 1 }, { 0, 50, 50, 50 }, { 0, 100, 100, 100 },
X    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, -1, 0 }
X};
X
Xint numctypes = 4;
X
XCtype ctypes[] = 
X{ { '-', "countryside",
X    "nothing there",
X    0, 0, 0, 0, 0, { 0, 0, 0 } },
X  { '/', "base",
X    "airstrip + port, but no production",
X    10, 2, 90, 100, 120, { 1, 5, 10 } },
X  { '*', "town",
X    "produces, but easily captured and may revolt",
X    20, 2, 80, 400, 600, { 2, 10, 10 } },
X  { '@', "city",
X    "metropolis, hard to capture",
X    40, 1, 70, 2000, 3000, { 2, 20, 20 } }
X};
END_OF_ww2.c
if test 4514 -ne `wc -c <ww2.c`; then
    echo shar: \"ww2.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f xconq.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"xconq.c\"
else
echo shar: Extracting \"xconq.c\" \(11982 characters\)
sed "s/^X//" >xconq.c <<'END_OF_xconq.c'
X/* Copyright (c) 1987  Stanley T. Shebs, University of Utah. */
X/* This program may be used, copied, modified, and redistributed freely */
X/* for noncommercial purposes, so long as this notice remains intact. */
X
X/* RCS $Header: xconq.c,v 1.5 87/06/08 21:45:02 shebs Exp $ */
X
X#include "xconq.h"
X
X/* This contains the version string, which should be altered whenever the */
X/* program is changed. */
X
X#include "version.h"
X
X/* Definitions of generic global variables. */
X
Xbool countedout;        /* True when player ran out of inputs to do */
Xbool timedout;          /* True when realtime clock ran out */
Xbool beepedplayer;      /* True if player has been beeped at start of turn */
Xbool humans[MAXSIDES];  /* Flags for which players are human or machine */
Xbool usecount, usetimer, worldseen;  /* Command line flags */
Xbool gaveup;            /* True when current player resigns */
Xbool debug = FALSE;     /* The debugging flag itself. */
X
Xchar version[] = VERSION;      /* version string */
Xchar terrchars[] = TERRCHARS;  /* string with terrains repns for I/O */
Xchar programname[BUFSIZE];     /* Name of this program */
Xchar rawmapname[BUFSIZE];      /* Name of map as input on cmd line */
Xchar mapname[BUFSIZE];         /* Full pathname of a map */
Xchar rawsavename[BUFSIZE];     /* Name of save file/scenario as input */
Xchar savename[BUFSIZE];        /* Name of saved file */
Xchar spbuf[BUFSIZE];           /* Main printing buffer */
Xchar spbuf2[BUFSIZE];          /* Auxiliary sprintf buffer */
Xchar *hosts[MAXSIDES];         /* Names of displays for each side */
Xchar *terrnames[] = TERRNAMES; /* Array of names of terrain types */
X
Xextern char periodname[], fontname[];  /* Defined in period file */
X
Xint numgivens;             /* number of sides given on cmd line */
Xint numhosts;              /* number of sides with displays attached */
Xint numinaction;           /* number of sides that haven't lost */
Xint avgstrat;              /* The strategy machine side is likely to use */
Xint gametime;              /* Absolute time from beginning of game */
Xint mode;                  /* Operating mode for the game */
Xint worldwidth, worldheight;  /* Dimensions of the world */
Xint greenwich, equator;    /* Coordinates of point that will be (0,0) */
Xint scale;                 /* Size of map square in km */
Xint countdown;             /* Number of seconds remaining in turn. */
Xint numinputs;             /* Number of inputs remaining in turn. */
X
X/* The map of the world is statically allocated because I couldn't */
X/* get malloc to do it right. */
X
XSquare world[MAXWIDTH][MAXHEIGHT];
X
X/* Our timer interrupt handler does not update the screen because X code is */
X/* not re-entrant.  Timer works, but no warning as to when time is up! */
X
Xcount_down()
X{
X    if (countdown-- <= 0) timedout = TRUE;
X/*     show_countdown(curside);  */
X#ifdef UNIX
X    alarm(1);
X    signal(SIGALRM, count_down);
X#endif UNIX
X}
X
X/* Where it all begins... */
X
Xmain(argc, argv)
Xint argc;
Xchar *argv[];
X{
X    bool eopt = FALSE;
X    char ch, cmd[BUFSIZE], keys[BUFSIZE];
X    int width, height, i, numenemies;
X    Side *side;
X
X    strcpy(programname, argv[0]);
X    /* init any vars that might be set by command-line options */
X    sprintf(rawmapname, "");
X    sprintf(rawsavename, "%s", SAVEFILE);
X    avgstrat = SEARCHOUT;
X    width = DEFAULTWIDTH;  height = DEFAULTHEIGHT;
X    usecount = USECOUNTER;
X    usetimer = USETIMER;
X    worldseen = FALSE;
X    numgivens = numhosts = 0;
X    /* assume local machine is one of the players */
X    add_player(TRUE, getenv("DISPLAY"));
X
X    for (i = 1; i < argc; ++i) {
X	if ((argv[i])[0] == '-') {
X	    ch = (argv[i])[1];
X	    if (Debug) printf("%c\n", ch);
X	    switch (ch) {
X	    case 'A':
X		if (i+1 >= argc) usage_error();
X		add_player(FALSE, argv[++i]);
X		break;
X	    case 'c':
X		usecount = !usecount;
X		break;
X	    case 'e':
X		if (i+1 >= argc) usage_error();
X		/* add in the requested number of machine players */
X		eopt = TRUE;
X		numenemies = atoi(argv[++i]);
X		while (numenemies-- > 0) {
X		    add_player(FALSE, NULL);
X		}
X		break;
X	    case 'm':
X		if (i+1 >= argc) usage_error();
X		sprintf(rawmapname, "%s", argv[++i]);
X		break;
X	    case 'M':	
X		if (i+2 >= argc) usage_error();
X		width = atoi(argv[++i]);
X		height = atoi(argv[++i]);
X		break;
X	    case 'r':
X		/* if first arg, undoes the default player */
X		numgivens = numhosts = 0;
X		break;
X	    case 's':
X		if (i+1 >= argc) usage_error();
X		sprintf(rawsavename, "%s", argv[++i]);
X		break;
X	    case 't':
X		usetimer = !usetimer;
X		break;
X	    case 'v':
X		worldseen = TRUE;
X		break;
X#ifdef DEBUGGING
X	    case 'S':
X		avgstrat = atoi(argv[i]+2);
X		break;
X	    case 'D':
X		debug = TRUE;
X		break;
X#endif DEBUGGING
X	    default:
X		usage_error();
X	    }
X	} else {
X	    /* we have a host name */
X	    add_player(TRUE, argv[i]);
X	}
X    }
X    /* Put in a single opponent if no -e supplied */
X    if (!eopt) add_player(FALSE, NULL);
X    /* Build full pathnames to a library directory */
X    make_lib_pathname(rawmapname, "map", mapname);
X    make_lib_pathname(rawsavename, "scn", savename);
X    if (usetimer) {
X#ifdef UNIX
X	alarm(1);
X	signal(SIGALRM, count_down);
X#endif UNIX
X    }
X    if (Debug) printf("%d sides, map is `%s'\n", numgivens, mapname);
X
X    printf("              Welcome to XCONQ version %s\n\n\n", version);
X    printf("The historical period is %s.\n", periodname);
X    maybe_dump_news();
X
X    init_vars();
X    init_random();
X    init_sides();
X    init_cities();
X    init_units();
X    if (!restore_game()) {
X	numsides = numgivens;
X	if (strlen(rawmapname) == 0) {
X	    printf("Please wait six days while I create the world...\n");
X#ifdef UNIX
X	    strcpy(mapname, temp_name());
X	    sprintf(keys, "%d", numgivens);
X	    sprintf(cmd, "%s/%s %d %d %s >%s",
X		    XCONQDIR, MAPMAKERNAME, width, height, keys, mapname);
X	    system(cmd);
X#else
X	    /* one possibility is to slip mkmap code directly in here */
X#endif
X	}
X	init_game();
X#ifdef REMOVEMAPS
X	unlink(mapname);
X#endif REMOVEMAPS
X    }
X    if (worldseen) all_view_world();
X#ifdef UNIX
X    signal(SIGINT, SIG_IGN);
X#endif UNIX
X    open_displays();
X    for (side = sidelist; side != NULL; side = side->next) {
X	if (active_display(side)) {
X	    init_curxy(side);
X	    redraw(side);
X	}
X    }
X    do_version(0);
X    play();
X    exit_xconq();
X}
X
X/* Don't try to recover from garbage command, just complain and leave. */
X
Xusage_error()
X{
X    fprintf(stderr, "Usage: xconq [-crtv] [-m name] [-M wid hgt] [-s name]\n");
X    fprintf(stderr, "             [ players ]\n");
X    fprintf(stderr, "Players: {host:display | -A host:display | -e number}\n");
X    exit(1);
X}
X
X/* Add a player into the array of players, making sure of no overflow. */
X
Xadd_player(hosted, host)
Xbool hosted;
Xchar *host;
X{
X    hosts[numgivens] = host;
X    humans[numgivens] = hosted;
X    numgivens++;
X    if (hosted) numhosts++;
X    if (numgivens > MAXSIDES) {
X	fprintf(stderr, "At most %d sides allowed!\n", MAXSIDES);
X	fprintf(stderr, "%s player %s is one too many - bye!\n",
X		(hosted ? "Human" : "Machine"), (host ? host : ""));
X	exit(1);
X    }
X}
X
X/* The main loop that cycles through each unit's orders and each         */
X/* city's production schedule.  In the meantime, we attempt to determine */
X/* whether our hero has conclusively won or lost.                        */
X/* Any side loses if it has no cities and no units capable of capturing  */
X/* any (large) cities. */
X
Xplay()
X{
X    bool won = FALSE, lost;
X    Unit *unit;
X    City *city;
X    Side *side;
X    
X    while (!won && gametime < MAXTIME) {
X	++gametime;
X	for_all_cities(city) {
X	    make_repairs(city);
X	}
X	for_all_sides(side) {
X	    show_time(side);
X	    show_state(side);
X	    adjust_morale(side, -5);
X	}
X	/* This is where curside is set */
X	for_all_sides(curside) {
X	    if (!curside->lost) {
X		lost = TRUE;
X		gaveup = FALSE;
X		for_all_sides(side) {
X		    show_curside(side);
X		}
X		setup_counts(curside);
X		for_all_cities(city) {
X		    if (own(city)) {
X			if (city->size > BASE) lost = FALSE;
X			produce(city);
X		    }
X		}
X		for_all_units(unit) {
X		    if (alive(unit) && own(unit) && !gaveup) {
X			if (could_capture(unit->type, CITY)) lost = FALSE;
X			xorders(unit);
X		    }
X		}
X		for_all_sides(side) {
X		    unshow_curside(side);
X		}
X		if (side_maybe_revolts(curside)) lost = TRUE;
X		if (lost || gaveup) side_loses(curside);
X	    }
X	}
X	maybe_end_game();
X	flush_dead_units();
X	sort_units();
X    }
X    if (gametime >= MAXTIME) notify_all("You all were assassinated!");
X}
X
X/* Do random things associated with playing limits. */
X
Xsetup_counts(side)
XSide *side;
X{
X    beepedplayer = FALSE;
X    flush_input();
X    countedout = timedout = FALSE;
X    if (usecount) {
X	numinputs = 15 + gametime/10;
X    }
X    if (usetimer) {
X	countdown = 15;
X	show_countdown(side);
X    }
X}
X
X/* Test conditions for a revolution and assassination of player. */
X
Xside_maybe_revolts(side)
XSide *side;
X{
X    if (curside->morale < 1000 && probability((1000 - curside->morale) / 10)) {
X	notify_all("The %s have assassinated their dictator!",
X		   plural_form(curside->name));
X	return TRUE;
X    } else {
X	return FALSE;
X    }
X}
X
X/* Be rude to losers and tot up their pittances of points. */
X
Xside_loses(side)
XSide *side;
X{
X    Unit *unit;
X    City *city;
X    Side *side2;
X
X    for_all_cities(city) {
X	if (city->side == side) {
X	    adjust_score(side, 10);
X	    city_revolts(city);
X	}
X    }
X    for_all_units(unit) {
X	if (alive(unit) && unit->side == side) {
X	    adjust_score(side, 1);
X	    kill_unit(unit, SURRENDER);
X	}
X    }
X    notify(side, "You lost, sucker!");
X    notify(side, "Your final score was %d", side->score);
X    wait_to_exit(side);
X    close_display(side);
X    side->lost = TRUE;
X    for_all_sides(side2) {
X	show_all_sides(side2);
X    }
X}
X
X/* Perform various tests to see if the game has really ended. */
X
Xmaybe_end_game()
X{
X    int left = 0, hostsleft = 0;
X    Unit *unit;
X    City *city;
X    Side *side, *winner;
X
X    for_all_sides(side) {
X	if (!side->lost) {
X	    winner = side;
X	    left++;
X	    if (side->host != NULL) hostsleft++;
X	}
X    }
X    if (left == 1 && numsides > 1) {
X	adjust_score(winner, 1000 * (numsides - 1));
X	notify(winner, "You have prevailed over your enemies!");
X	wait_to_exit(winner);
X	/* Need to kill off units to finish up statistics */
X	for_all_units(unit) {
X	    if (alive(unit)) {
X		if (unit->side == winner) {
X		    adjust_score(winner, 10);
X		    kill_unit(unit, VICTOR);
X		} else {
X		    kill_unit(unit, SURRENDER);
X		}
X	    }
X	}
X	/* do something with the cities */
X	for_all_cities(city) {
X	}
X	if (winner->humanp) {
X	    printf("\nThe %s (on %s) win!!\n\n",
X		   plural_form(winner->name), winner->host);
X	} else {
X	    printf("\nThe %s (machine) win!!\n\n", plural_form(winner->name));
X	}
X	exit_xconq();
X    } else if (left == 0) {
X	printf("\nEverybody lost!\n\n");
X	exit_xconq();
X    } else if (hostsleft == 0) {
X	printf("\nThe machines beat the humans!!!\n\n");
X	exit_xconq();
X    }
X}
X
X/* Leave screen up so everybody can study it. */
X
Xwait_to_exit(side)
XSide *side;
X{
X    char ch;
X    int x, y;
X
X    if (humanside(side) && active_display(side)) {
X	sprintf(side->promptbuf, "[Hit any character to exit]");
X	show_prompt(side);
X	curside = side;
X	get_input(&ch, &x, &y);
X    }
X}
X
X/* This is to find out how everybody did. */
X
Xprint_statistics()
X{
X    Side *side;
X    FILE *fp;
X
X    for_all_sides(side) {
X	printf("The %-15s %-15s Score: %5d\n",
X	       plural_form(side->name),
X	       (side->host ? side->host : "---"), side->score);
X    }
X#ifdef STATISTICS
X    if ((fp = fopen(STATSFILE, "w")) != NULL) {
X	for_all_sides(side) {
X	    print_side_results(fp, side);
X	    print_city_results(fp, side);
X	    print_unit_results(fp, side);
X	    if (side->next != NULL) fprintf(fp, "\f\n");
X	}
X	fclose(fp);
X    } else {
X	fprintf(stderr, "Can't open statistics file '%s'\n", STATSFILE);
X    }
X#endif STATISTICS
X}
X
X/* This routine should be called before any sort of normal exit. */
X
Xexit_xconq()
X{
X    close_displays();
X#ifdef STATISTICS
X    print_statistics();
X#endif STATISTICS
X    exit(0);
X}
END_OF_xconq.c
if test 11982 -ne `wc -c <xconq.c`; then
    echo shar: \"xconq.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f xmap.6 -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"xmap.6\"
else
echo shar: Extracting \"xmap.6\" \(743 characters\)
sed "s/^X//" >xmap.6 <<'END_OF_xmap.6'
X.TH XMAP 6 Utah
X.SH NAME
Xxmap - display world map in a window
X.SH SYNOPSIS
X.B xmap
X[ host:number ]
X.SH DESCRIPTION
X.I Xmap
Xtakes standard input in a map format (as generated by mkmap(6)) and
Xdisplays it in an X window.  The window is opened on the default display
Xor on the given display
X.I host:number.
XIt is capable of displaying both the normal game maps and relief maps;
Xthe choice is determined by the first character in the map data.
X.SH AUTHOR
XStan Shebs (shebs@cs.utah.edu)
X.SH "SEE ALSO"
Xmkmap(6)
X.SH DIAGNOSTICS
XWill bomb out if the map type (first character in file) is not recognized.
XRelief maps need at least 40 colors.
XAnything else is strictly X's fault.
X.SH BUGS
XWindow appears at a fixed location, and will never be redrawn.
END_OF_xmap.6
if test 743 -ne `wc -c <xmap.6`; then
    echo shar: \"xmap.6\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of archive 5 \(of 7\).
cp /dev/null ark5isdone
MISSING=""
for I in 1 2 3 4 5 6 7 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 7 archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0