Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!ukma!rutgers!mit-eddie!uw-beaver!tektronix!tekgen!tekred!games-request
From: games-request@tekred.TEK.COM
Newsgroups: comp.sources.games
Subject: v01i087: xconq - multiplayer strategy game for X-windows, Part07/07
Message-ID: <1389@tekred.TEK.COM>
Date: Thu, 9-Jul-87 20:58:36 EDT
Article-I.D.: tekred.1389
Posted: Thu Jul 9 20:58:36 1987
Date-Received: Sun, 12-Jul-87 08:45:07 EDT
Sender: billr@tekred.TEK.COM
Lines: 1153
Approved: billr@tekred.TEK.COM
Submitted by: "Stanley T. Shebs"
Comp.sources.games: Volume 1, Issue 87
Archive-name: xconq/Part07
#! /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 1800.u <<'END_OF_1800.u'
Xbegin 644 1800.onx
XM&````/`'$``!````?@#X#P``"P`!`!``__\`````````````````````````
XM````````````````````````````````````````````````````````````
XM`````/]__W_4Z@`````````````!@0`````!`0``````````````````````
XM````````````````````````````````````````````````````````````
XM``````````````````````````````````````````!551`(````````````
XM````````````````````````````````````````````````````````````
XM````````B8#__P``````````````````````````````````````````````
XM````````````````````````````````````````````@V"!0*UI````````
XM``````)!`````(*"````(`!``'``<`!0`'``8```````````````````````
XM```$`````,``````````````````````````````````````````````````
XM`````````````````````"``$`@`````````````````````````````````
XM```````````````````````````````````````````````"4`/`````````
XM````````````````````````````````````````````````````````````
XM``````````````````````"%4(%`5K<`````````````!"'_#P``?'P```!0
XM`$``0`!``%``$``0``````````````````````````0``.``P```````````
XM````(`````````````````````````!`````````````````````````````
XM=548&```````````````````````````````````````````````````````
XM`````````````````````````%0%`\``````````````````````````````
XM````````````````````````````````````````````````````````````
XM`(E(@4"]W0`````````````($0```````````%``0`!P`&``<`!P`'``````
XM````````````````````!```^`-`$`````!````````4````````````````
XM`````````.`("`````````````````````````#X@#@\````````````````
XM````````````````````````````````````````````````````````````
XM`````5$#P```````````````````````````````````````````````````
XM````````````````````````````````````````D42!0'=W````````````
XM`!`)`_\``!`0@`$`4`!``!``0`!``$``4``````````````````````````.
XM``#X`\`[`````.`$``````X!````````````````````````0`Q0````````
XM`````````````````/W3.#P`````````````````````````````````````
XM``````````````````````````````````````````!4"0/`````````````
XM````````````````````````````````````````````````````````````
XM``````````````````"A0H%`W=T`````````````(`4`````*"A@!@`@`$``
XM<`!P`$``<``@``````````````````````````X``.P&P#P`````0`X`````
XMK@````````````````````````#T"6`"````````````````````````S\`%\`4`!A`&(`8P!D`&4`9@!G`&@`:0!J`&L`;`!M`&X`;P!@`'$`<@!S`'
X80`=0!V`'<`>`!Y`'H`>P!\`'T`?@!_`'
X`
Xend
END_OF_1800.u
if test 6011 -ne `wc -c <1800.u`; then
echo shar: \"1800.u\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f Makefile -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"Makefile\"
else
echo shar: Extracting \"Makefile\" \(2916 characters\)
sed "s/^X//" >Makefile <<'END_OF_Makefile'
X# Copyright (c) 1986 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: Makefile,v 1.5 87/06/07 20:09:32 shebs Exp $
X
XSYSTEM = HPUX
X
XDESTDIR = /usr/games
X
XLIBDIR = $(DESTDIR)/lib/xconq
X
XMANDIR = /usr/local/man/man6
X
XXFONTPATH = /usr/new/lib/X/font
X
X# This name sets the default period for xconq. WWII is most familiar and
X# popular.
X
XPERIODOBJ = ww2.o
X
XOBJ = xconq.o init.o do.o mplay.o move.o atk.o side.o city.o unit.o order.o \
X util.o X.o input.o draw.o output.o help.o
X
XLIBS = -lX
X
XCFLAGS = -O -D$(SYSTEM)
X# -DXCONQDIR="$(DESTDIR)" -DXCONQLIB="$(LIBDIR)"
X
Xall: xconq xconq.doc mkmap xmap
X
X# The standard game
X
Xxconq: $(OBJ) $(PERIODOBJ)
X cc -o xconq $(CFLAGS) $(OBJ) $(PERIODOBJ) $(LIBS)
X
X# For connoiseurs
X
Xgxconq: $(OBJ) greek.o
X cc -o gxconq $(CFLAGS) $(OBJ) greek.o $(LIBS)
X
Xnxconq: $(OBJ) napoleon.o
X cc -o nxconq $(CFLAGS) $(OBJ) napoleon.o $(LIBS)
X
X# Dependencies on include files
X
X$(OBJ): xconq.h config.h
X
Xxconq.o: version.h
X
XX.o: bitmaps.h
X
Xside.o: side.h
X
X# Support things
X
Xxconq.doc: xconq.nr
X nroff -ms xconq.nr >xconq.doc
X
Xmkmap: mkmap.c mkmap.h
X cc -o mkmap $(CFLAGS) mkmap.c
X
Xxmap: xmap.c
X cc -o xmap $(CFLAGS) xmap.c -lX
X
X# Installation requires programs in $(DESTDIR) and a library directory.
X
Xinstall:
X cp xconq mkmap xmap $(DESTDIR)
X cp lib/* $(LIBDIR)
X cp *.onx $(XFONTPATH)
X cp *.6 $(MANDIR)
X
Xclean:
X rm -f xconq gxconq nxconq mkmap xmap *.o *.xconq
X
X# Pretty output for your favorite fancy printer
X
XTROFFER = psroff
XPRINTER = 4eps
X
Xpaper:
X $(TROFFER) -man -P$(PRINTER) *.6
X $(TROFFER) -ms -P$(PRINTER) xconq.nr
X
X# Local hack to put all the stuff onto a machine that does rdist via crontab.
X# This is very useful in a workstation environment.
X
XDISTER = /n/jensen
X
Xrinstall:
X ( netunam $(DISTER) shebs: ; \
X bsdcp -p xconq mkmap xmap xconq.doc $(DISTER)$(DESTDIR); \
X bsdcp -p lib/*.onx lib/xconq.news $(DISTER)$(LIBDIR); \
X bsdcp -p lib/*.map lib/*.scn $(DISTER)$(LIBDIR); \
X bsdcp -p *.6 $(DISTER)$(MANDIR); )
X
X# How the shar files were made. This is complicated by the need to
X# transmit X fonts and by the 90% compression that happens to the maps,
X# reducing 200K to 20K...
X
Xshar:
X uuencode ww2.onx ww2.u
X uuencode greek.onx greek.u
X uuencode 1800.onx 1800.u
X shar ReadMe Makefile Xdefaults *.6 *.nr >shar.1
X shar [A-Za-c]*.[ch] >shar.2
X shar [d-l]*.[ch] >shar.3
X shar [m-m]*.[ch] >shar.4
X shar [n-w]*.[ch] >shar.5
X shar [x-z]*.[ch] >shar.6
X shar lib/split lib/rejoin lib/*.map lib/*.scn >preshar.7
X compress preshar.7
X uuencode preshar.7.Z preshar.7.u
X shar *.u >shar.7
X
X# Use this to take care of the details that shar doesn't.
X
Xunshar:
X uudecode ww2.u
X uudecode greek.u
X uudecode 1800.u
X mkdir lib
X mv *.onx lib
X uudecode preshar.7.u
X uncompress preshar.7.Z
X sh preshar.7
X
END_OF_Makefile
if test 2916 -ne `wc -c Xdefaults <<'END_OF_Xdefaults'
X# This is an example of stuff to go in .Xdefaults, in particular it
X# illustrates yet another way to get fonts to work right. Just include
X# the full pathname of the font. This will also work if you are experimenting
X# and don't want to recompile the program just to get a font from elsewhere.
X
Xxconq.SideName: Rockjock
Xxconq.BodyFont: timrom12
Xxconq.IconFont: /u/shebs/games/xconq/lib/ww2.onx
X
Xnxconq.IconFont: /u/shebs/games/xconq/lib/1800.onx
Xgxconq.IconFont: /u/shebs/games/xconq/lib/greek.onx
X
END_OF_Xdefaults
if test 527 -ne `wc -c config.h <<'END_OF_config.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: config.h,v 1.7 87/06/07 20:09:29 shebs Exp $ */
X
X/* This file has a great many things that can be fiddled with; generally, */
X/* the more interesting things to tweak are closer to the front of the file. */
X/* There are a lot of limits on statically-allocated type things as well, */
X/* some of these can be changed freely, while others have some connection to */
X/* the body of code. The second category is identified where it occurs. */
X
X/* We use Unix system calls here and there. */
X
X#define UNIX
X
X/* The game is thoroughly wired to X, but there are some token ifdefs... */
X
X#define XWINDOWS
X
X/* The particular Unix type is defined in the Makefile. */
X
X/* #define HPUX */ /* for HP 9000 series [235]00 (SYSV + BSD) */
X
X/* #define BSD */ /* for Berkeley Unix everywhere */
X
X/* #define SYSV */ /* Darth Vader Unix */
X
X/* Little incompatibilities... */
X
X#ifdef HPUX
X#define index strchr
X#endif HPUX
X
X#ifdef BSD
X#endif BSD
X
X#ifdef SYSV
X#define index strchr
X#endif SYSV
X
X/* This is where the map generator should be (also xconq proper, but it */
X/* doesn't care where it executes from!) */
X
X#ifndef XCONQDIR
X#define XCONQDIR "/usr/games"
X#endif
X
X/* This is where predefined maps and scenarios can be found. */
X
X#ifndef XCONQLIB
X#define XCONQLIB "/usr/games/lib/xconq"
X#endif
X
X/* The newsfile should live in the lib directory. */
X
X#define NEWSFILE "xconq.news"
X
X/* The name of the savefile. It should be in the current directory. */
X
X#define SAVEFILE "save.xconq"
X
X/* This file gets the parameter listing for the period in use. */
X
X#define PARMSFILE "parms.xconq"
X
X/* This file gets the game statistics when it's all over. */
X
X#define STATSFILE "stats.xconq"
X
X/* The name of the map generator program. */
X
X#define MAPMAKERNAME "mkmap"
X
X/* Absolute maximum size of the world (attempts to malloc the world failed */
X/* mysteriously). The numbers are just big enough for a map of the earth. */
X
X#define MAXWIDTH 360
X
X#define MAXHEIGHT 160
X
X/* Default random map sizes. Adjust these to taste - 65x65 is a moderate */
X/* length game, 35x35 is short, 360x120 is L-O-N-G */
X
X#define DEFAULTWIDTH 60
X
X#define DEFAULTHEIGHT 35
X
X/* Absolute maximum number of sides that can play. This limit can only be */
X/* extended by changing the representation of views of players. */
X
X#define MAXSIDES 7
X
X/* Absolute maximum number of kinds of units. (same restriction as above) */
X
X#define MAXUTYPES 16
X
X/* Number of units and cities that can be active at one time. Limit is */
X/* because of array usage, but also handy for keeping production reasonable. */
X
X#define MAXUNITS 500
X
X#define MAXCITIES 400
X
X/* Number of characters allocated for names of cities. The space should */
X/* be malloced instead I guess... */
X
X#define MAXCITYBUF 8000
X
X/* Number of turns allowed before game is forcibly terminated. */
X
X#define MAXTIME 10000
X
X/* Number of messages displayed at one time. 10 is a max unless you use */
X/* tiny fonts or smaller viewing areas or screens more than 768 pixels high. */
X
X#define MAXNOTES 10
X
X/* All names, phrases, and messages must be able to fit in statically */
X/* alloced buffers of this size. Take heed if you fiddle with font sizes... */
X
X#define BUFSIZE 120
X
X/* If defined, randomly generated maps will be deleted automatically. */
X/* Otherwise, they are available, and good ones can be saved for replay. */
X
X#define REMOVEMAP
X
X/* If defined, towns produce more slowly than cities. More realistics, */
X/* but game drags a bit. */
X
X/* #define SLOWTOWNS */
X
X/* If defined, players get only so many inputs per turn, counted by */
X/* keystrokes + mouse clicks. This is the default; the "-c" flag toggles. */
X
X#define USECOUNTER TRUE
X
X/* If defined, a real-time counter is used. "-t" toggles this default. */
X
X#define USETIMER FALSE
X
X/* If defined, a statistics file is written at the end of the game. */
X/* The numbers therein are only for serious gamers. */
X
X#define STATISTICS
X
X/* If defined, we get access via "-D" to all kinds of extra output. */
X
X#define DEBUGGING
X
X/* If defined, some additional hook-type features become available. */
X/* Intended for persons adding new maps, scenarios, and periods. */
X
X#define EXPERIMENTING
END_OF_config.h
if test 4383 -ne `wc -c greek.c <<'END_OF_greek.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: greek.c,v 1.1 87/05/22 14:32:20 shebs Exp $ */
X
X#include "xconq.h"
X
Xchar periodname[] = "Ancient Greece ca 350 BC";
X
Xchar fontname[] = "greek";
X
X/* Number of types of units + 1 */
X
Xint numutypes = 8;
X
Xint assaulter = 1;
X
Xint ttransport = 5;
X
XUtype utypes[] =
X{ { 'P', "peltast",
X "light infantry - fast-moving but weak",
X 0, 2, 1, 0, 4, 1, 4, 4, 0,
X { 0, 0, 2, 1, 2, 1, 0 },
X { 0, 0, 1, 1, 0, 0, 0 },
X { 0, 0, 1, 1, 0, 0, 0 },
X { 40, 30, 50, 40, 20, 10, 10, 30 }, 1, 0, 0,
X { 0, 2, 2, 2 }, { 0, 50, 10, 5 }, { 0, 20, 40, 60 },
X { 0, 0, 0, 0, 0, 0, 0, 0 }, 3, 0 },
X { 'H', "hoplite",
X "heavy infantry - destructive",
X 0, 1, 1, 0, 5, 2, 8, 8, 0,
X { 0, 0, 2, 1, 1, 1, 0 },
X { 0, 0, 1, 1, 0, 0, 0 },
X { 0, 0, 1, 1, 0, 0, 0 },
X { 50, 40, 50, 50, 30, 20, 20, 50 }, 2, 1, 0,
X { 0, 2, 2, 2 }, { 0, 70, 20, 10 }, { 0, 10, 30, 40 },
X { 0, 0, 0, 0, 0, 0, 0, 0 }, 3, 0 },
X { 'A', "archer",
X "archers and slingers",
X 0, 1, 1, 0, 5, 1, 10, 12, 0,
X { 0, 0, 1, 0, 1, 0, 0 },
X { 0, 0, 1, 1, 0, 0, 0 },
X { 0, 0, 1, 1, 0, 0, 0 },
X { 30, 20, 30, 30, 20, 20, 60, 30 }, 1, 0, 0,
X { 0, 1, 1, 1 }, { 0, 2, 1, 1 }, { 0, 20, 40, 60 },
X { 0, 0, 0, 0, 0, 0, 0, 0 }, 5, 1 },
X { 'C', "cavalry",
X "very fast and some shock effect but expensive",
X 0, 4, 1, 0, 2, 1, 10, 12, 0,
X { 0, 0, 4, 2, 4, 0, 0 },
X { 0, 0, 1, 1, 0, 0, 0 },
X { 0, 0, 1, 0, 0, 0, 0 },
X { 60, 30, 50, 50, 30, 20, 50, 60 }, 2, 3, 0,
X { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 20, 40, 60 },
X { 0, 0, 0, 0, 0, 0, 0, 0 }, -1, 0 },
X { 'B', "bireme",
X "small ship with two decks of oars",
X 0, 2, 1, 0, 15, 3, 10, 12, 0,
X { 2, 2, 0, 0, 0, 0, 0 },
X { 0, 0, 0, 0, 0, 0, 0 },
X { 0, 0, 1, 1, 0, 0, 0 },
X { 20, 10, 20, 20, 40, 30, 10, 20 }, 1, 0, 0,
X { 0, 1, 1, 1 }, { 0, 1, 1, 0 }, { 0, 20, 50, 70 },
X { 2, 2, 0, 0, 0, 0, 0, 0 }, 2, 1 },
X { 'T', "trireme",
X "Three decks of oars - all-around ship",
X 0, 2, 1, 0, 20, 5, 20, 22, 0,
X { 2, 2, 0, 0, 0, 0, 0 },
X { 0, 0, 0, 0, 0, 0, 0 },
X { 0, 0, 1, 1, 0, 0, 0 },
X { 10, 10, 10, 10, 30, 50, 10, 30 }, 1, 0, 0,
X { 0, 1, 1, 1 }, { 0, 3, 2, 1 }, { 0, 10, 40, 60 },
X { 3, 3, 1, 2, 0, 0, 0, 1 }, 1, 1 },
X { 'E', "elephant",
X "the tanks of the ancient world",
X 0, 2, 1, 0, 4, 1, 60, 40, 0,
X { 0, 0, 2, 1, 2, 0, 0 },
X { 0, 0, 1, 1, 0, 0, 0 },
X { 0, 0, 0, 0, 0, 0, 0 },
X { 50, 50, 50, 50, 10, 10, 50 }, 2, 0, 0,
X { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 20, 40, 60 },
X { 0, 0, 0, 0, 0, 0, 0, 1 }, -1, 0 },
X { 'S', "siege engine",
X "good for bashing cities",
X 0, 1, 1, 0, 4, 1, 30, 30, 0,
X { 0, 0, 1, 0, 0, 0, 0 },
X { 0, 0, 1, 1, 0, 0, 0 },
X { 0, 0, 0, 0, 0, 0, 0 },
X { 10, 10, 10, 10, 10, 10, 10, 5 }, 1, 0, 0,
X { 0, 1, 1, 1 }, { 0, 2, 3, 4 }, { 0, 10, 20, 30 },
X { 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 { '/', "camp",
X "place to rest up",
X 10, 2, 90, 100, 120, { 5, 5, 10 } },
X { '*', "polis",
X "produces, but easily captured and may revolt",
X 20, 2, 30, 400, 600, { 10, 10, 10 } },
X { '@', "megalopolis",
X "large city, hard to capture",
X 40, 1, 10, 2000, 3000, { 20, 20, 20 } }
X};
END_OF_greek.c
if test 3503 -ne `wc -c napoleon.c <<'END_OF_napoleon.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: napoleon.c,v 1.2 87/05/26 14:17:45 shebs Exp $ */
X
X#include "xconq.h"
X
Xchar periodname[] = "Napoleonic era ca 1800";
X
Xchar fontname[] = "1800";
X
Xint numutypes = 7;
X
Xint assaulter = 0;
X
Xint ttransport = 3;
X
XUtype utypes[] =
X{ { 'I', "infantry",
X "the backbone of the army",
X 0, 1, 1, 0, 4, 1, 4, 4, 0,
X { 0, 0, 1, 1, 1, 1, 0 },
X { 0, 0, 1, 1, 0, 0, 0 },
X { 0, 0, 1, 0, 0, 0, 0 },
X { 40, 30, 70, 20, 10, 5, 60 }, 1, 0, 0,
X { 0, 2, 2, 2 }, { 0, 50, 30, 10 }, { 0, 10, 20, 30 },
X { 0, 0, 0, 0, 0, 0, 0 }, 2, 1 },
X { 'C', "cavalry",
X "zips around for shock effect",
X 0, 5, 1, 0, 10, 1, 10, 10, 0,
X { 0, 0, 5, 2, 5, 1, 0 },
X { 0, 0, 1, 1, 0, 1, 0 },
X { 0, 0, 1, 1, 0, 1, 0 },
X { 50, 40, 70, 10, 5, 1, 20 }, 2, 1, 0,
X { 0, 2, 2, 2 }, { 0, 20, 10, 5 }, { 0, 20, 40, 60 },
X { 0, 0, 0, 0, 0, 0, 0 }, 10, 1 },
X { 'A', "artillery",
X "doesn't move much but pounds on infantry",
X 0, 1, 1, 0, 4, 1, 10, 12, 0,
X { 0, 0, 1, 1, 1, 0, 0 },
X { 0, 0, 1, 1, 1, 0, 0 },
X { 0, 0, 1, 0, 0, 0, 0 },
X { 60, 60, 30, 50, 50, 40, 10 }, 2, 0, 1,
X { 0, 1, 1, 1 }, { 0, 1, 2, 2 }, { 0, 10, 20, 30 },
X { 0, 0, 0, 0, 0, 0, 0 }, 0, 0 },
X { 'T', "transport",
X "ungainly boats",
X 1, 2, 1, 0, 300, 2, 15, 15, 0,
X { 2, 2, 0, 0, 0, 0, 0 },
X { 0, 0, 0, 0, 0, 0, 0 },
X { 0, 0, 1, 0, 0, 0, 0 },
X { 20, 30, 10, 20, 10, 10, 5 }, 1, 0, 0,
X { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 },
X { 5, 2, 1, 0, 0, 0, 0 }, 0, 0 },
X { 'F', "frigate",
X "fast but small ship",
X 1, 6, 1, 0, 300, 3, 20, 25, 0,
X { 5, 2, 0, 0, 0, 0, 0 },
X { 0, 0, 0, 0, 0, 0, 0 },
X { 0, 0, 1, 1, 0, 0, 0 },
X { 50, 40, 25, 60, 50, 50, 10 }, 1, 1, 5,
X { 0, 2, 1, 1 }, { 0, 30, 1, 1 }, { 0, 10, 30, 50 },
X { 1, 0, 0, 0, 0, 0, 0 }, 0, 0 },
X { 'S', "fleet",
X "Ship of the line",
X 1, 4, 1, 0, 400, 6, 30, 40, 0,
X { 3, 0, 0, 0, 0, 0, 0 },
X { 0, 0, 0, 0, 0, 0, 0 },
X { 0, 0, 1, 1, 0, 0, 0 },
X { 50, 50, 30, 80, 40, 50, 10 }, 2, 1, 5,
X { 0, 1, 1, 1 }, { 0, 2, 2, 2 }, { 0, 10, 30, 50 },
X { 2, 1, 0, 0, 0, 0, 0 }, 0, 0 },
X { 'B', "balloon",
X "rather fragile",
X 2, 5, 1, 0, 10, 1, 40, 50, 0,
X { 5, 5, 5, 5, 5, 0, 0 },
X { 0, 0, 1, 0, 0, 0, 0 },
X { 0, 0, 0, 0, 0, 0, 0 },
X { 10, 10, 10, 10, 10, 10, 1 }, 1, 2, 0,
X { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 },
X { 0, 0, 0, 0, 0, 0, 0 }, 0, 0 }
X};
X
Xint numctypes = 4;
X
XCtype ctypes[] =
X{ { '-', "countryside",
X "nothing there",
X 0, 0, 0, 0, 0, { 0, 0, 0 } },
X { '/', "camp",
X "place to rest up",
X 10, 2, 90, 100, 120, { 1, 5, 10 } },
X { '*', "city",
X "produces, but easily captured and may revolt",
X 20, 2, 30, 400, 600, { 2, 10, 10 } },
X { '@', "capital",
X "large city, hard to capture",
X 40, 1, 10, 2000, 3000, { 2, 20, 20 } }
X};
END_OF_napoleon.c
if test 3021 -ne `wc -c order.c <<'END_OF_order.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: order.c,v 1.2 87/05/22 14:51:49 shebs Exp $ */
X
X#include "xconq.h"
X
Xchar orderchars[] = ORDERCHARS; /* characters naming kinds of orders */
Xchar *ordernames[] = ORDERNAMES; /* full names of orders */
Xchar *orderargnames[] = ORDERARGNAMES; /* name of type of order parms */
Xchar *dirnames[] = DIRNAMES; /* short names of directions */
X
Xint orderargs[] = ORDERARGS; /* types of parameters for each order */
X
X/* General routine to wake up a unit and all its cargo. */
X
Xwake_unit(unit)
XUnit *unit;
X{
X Unit *carg;
X
X wakeup(unit);
X
X for (carg = unit->cargo; carg != NULL; carg = carg->nexthere) {
X wakeup(carg);
X }
X}
X
X/* Wake up only the unit itself and reset the goal. */
X
Xwakeup(unit)
XUnit *unit;
X{
X unit->orders.type = AWAKE;
X unit->orders.rept = 0;
X unit->goal = NORMAL;
X}
X
X/* Give a unit sentry orders. */
X
Xorder_sentry(unit, n)
XUnit *unit;
Xint n;
X{
X unit->orders.type = SENTRY;
X unit->orders.rept = n;
X}
X
X/* Fill in the given unit with direction-moving orders. */
X
Xorder_movedir(unit, dir, n)
XUnit *unit;
Xint dir, n;
X{
X unit->orders.type = MOVEDIR;
X unit->orders.parms[0] = dir;
X unit->orders.rept = n;
X}
X
X/* General routine to fill in the Move To orders. */
X
Xorder_moveto(unit, x, y)
XUnit *unit;
Xint x, y;
X{
X unit->orders.type = MOVETO;
X unit->orders.parms[0] = x;
X unit->orders.parms[1] = y;
X /* nonsensical to repeat */
X unit->orders.rept = 1;
X}
X
X/* Display orders in some coherent fashion. Use the information about the */
X/* types of order parameters to decide how to display them. */
X
Xchar orderbuf[BUFSIZE];
X
Xchar *
Xorder_desig(orders)
XOrder orders;
X{
X char argbuf[BUFSIZE];
X
X switch (orderargs[orders.type]) {
X case NOARG:
X sprintf(argbuf, "");
X break;
X case DIR:
X sprintf(argbuf, "%s ", dirnames[orders.parms[0]]);
X break;
X case POS:
X sprintf(argbuf, "%d,%d ", orders.parms[0], orders.parms[1]);
X break;
X case ORIENT:
X case LEADER:
X case WAYPOINTS:
X break;
X default:
X case_panic("order arg type", orderargs[orders.type]);
X }
X if (orders.rept > 1)
X sprintf(orderbuf, "%s %s(%d)",
X ordernames[orders.type], argbuf, orders.rept);
X else
X sprintf(orderbuf, "%s %s",
X ordernames[orders.type], argbuf);
X return orderbuf;
X}
END_OF_order.c
if test 2464 -ne `wc -c side.h <<'END_OF_side.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: side.h,v 1.2 87/05/21 17:29:58 shebs Exp $ */
X
X/* Names of players' sides are assigned randomly from here if not preset */
X/* by a starting city. We go with 30 to provide variety without being */
X/* too elaborate. Tweak this file to get other sets (sports teams, science */
X/* fiction derivs, whatever) */
X
X#define MAXSIDENAMES 30
X
Xchar *sidenames[MAXSIDENAMES] = {
X
X /* Hacker language */
X/* "Wimp", "Luser", "Wizard", "Frobber", "Foo", "Bogonian",
X "Tweaker", "Bozo", "Boffo", "Geek", "Gweeper", "Chomper",
X "Nerd", "Bagbiter", "Barfer", "Bug", "Cretin", "Wieny",
X "Daemon", "Twiddler", "Hacker", "Handwaver", "Munger", "Turkey",
X "Flamer", "Wheel", "Winner", "DEC", "IBM", "Jock"
X*/
X /* Contemporary nations */
X "American", "Canadian", "Mexican", "Sandinista", "Cuban", "Chilean",
X "Brazilian", "Argentinian", "Spanish", "British", "French", "German",
X "Italian", "Swiss", "Swedish", "Turk", "Israeli", "Arab",
X "Iranian", "Indian", "Tibetan", "Mongolian", "Soviet", "Korean",
X "African", "Libyan", "Indian", "Indonesian", "Australian", "Polynesian"
X
X /* Towns of the ancient Greeks */
X/* "Athenian", "Spartan", "Corinthian", "Theban", "Megaran",
X "Miletan", "Messenian", "Syracusan", "Argive", "Ephesian",
X "Lemnian", "Ambraciot", "Phokian", "Chian", "Delian",
X "Geloan", "Carian", "Lokrian", "Melian", "Phliasian",
X "Samian", "Thurian", "Tegean", "Dolopian", "Edonian",
X "Olynthian", "Elean", "Lucanian", "Kytheran", "Skionian"
X*/
X
X};
END_OF_side.h
if test 1728 -ne `wc -c ww2.u <<'END_OF_ww2.u'
Xbegin 644 ww2.onx
XM&````/`'$``!````?@#X#P``"P`!`!``__\`````````````````````````
XM````````````````````````````````````````````````````````````
XM`````/]__W_4Z@`````````````!@0`````!`0``````````````````````
XM````````````````````````````````````````````````````````````
XM``````````````````````````````````````````!551`(````````````
XM````````````````````````````````````````````````````````````
XM````````B8#__P``````````````````````````````````````````````
XM````````````````````````````````````````````@V"!0*UI````````
XM``````)!`````(*"`!,`(`!``'``<`!0`'``8```````````````````````
XM`,`!```````"````````0```````````````````````````````````````
XM`````````````````````"``$`@`````````````````````````````````
XM```````````````````````````````````````````````"4`/`````````
XM````````````````````````````````````````````````````````````
XM``````````````````````"%4(%`5K<`````````````!"'_#P``?'P`"P!0
XM`$``0`!``%``$``0````````````````````````3@$`````(`````````!@
XM````(```````````````````````````````````````````````````````
XM=548&```````````````````````````````````````````````````````
XM`````````````````````````%0%`\``````````````````````````````
XM````````````````````````````````````````````````````````````
XM`(E(@4"]W0`````````````($0`````````'`%``0`!P`&``<`!P`'``````
XM``````````````````#*`0`````$````````!G`````4````````````````
XM``````````````````````````````````````#X@#@\````````````````
XM````````````````````````````````````````````````````````````
XM`````5$#P```````````````````````````````````````````````````
XM````````````````````````````````````````D42!0'=W````````````
XM`!`)`_\``!`0``,`4`!``!``0`!``$``4````````````````````````$X'
XM``!``"```````/@#8`````X!````````````````````````````````````
XM`````````````````/W3.#P`````````````````````````````````````
XM``````````````````````````````````````````!4"0/`````````````
XM````````````````````````````````````````````````````````````
XM``````````````````"A0H%`W=T```````````@`(`4`````*"@`!P`@`$``
XM<`!P`$``<``@````````````````````````R@4``$("````````_@=P0```
XMK@`````````````P````````````````````````````````````````S\`%\`4`!A`&(`8P!D`&4`9@!G`&@`:0!J`&L`;`!M`&X`;P!@`'$`<@!S`'
X80`=0!V`'<`>`!Y`'H`>P!\`'T`?@!_`'
X`
Xend
END_OF_ww2.u
if test 6010 -ne `wc -c xmap.c <<'END_OF_xmap.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: xmap.c,v 1.3 87/06/06 20:57:03 shebs Exp $ */
X
X/* This is a mini-utility to display a map in a window by itself. */
X/* It takes the map from stdin (to interface with mkmap better) and */
X/* pops a window up at a fixed location. No redraw provision or other */
X/* X fancies. */
X
X#include
X#include
X
X#ifndef BSD
X#define index strchr
X#endif BSD
X
X#define NUMTERRS 10
X
X#define TERRTYPES "#*@.+^~%,_"
X
X#define TERRCOLORS { "black", "maroon", "red", "sky blue", "green", \
X "sienna", "yellow", "forest green", "cyan", "white" }
X
Xchar *terrtypes = TERRTYPES;
X
Xchar *terrcolors[] = TERRCOLORS;
X
Xint sqcolor[NUMTERRS];
X
Xchar *getenv();
X
Xint width, height, greenwich, equator, scale, pxsize;
X
XWindow win;
X
Xmain(argc, argv)
Xint argc;
Xchar *argv[];
X{
X char maptype, *display;
X int i;
X Color def;
X
X display = getenv("DISPLAY");
X if (argc > 1) {
X display = argv[1];
X }
X if (XOpenDisplay(display) == 0) {
X fprintf(stderr, "Can't create a window on %s\n", display);
X exit(1);
X }
X for (i = 0; i < NUMTERRS; ++i) {
X XParseColor(terrcolors[i], &def);
X XGetHardwareColor(&def);
X sqcolor[i] = def.pixel;
X }
X scanf("%c %d %d %d %d %d\n",
X &maptype, &width, &height, &greenwich, &equator, &scale);
X ++width;
X pxsize = 2;
X if (width < 200 && height < 200) pxsize *= 2;
X if (width < 100 && height < 100) pxsize *= 2;
X
X win = XCreateWindow(RootWindow, 50, 50, (width-1)*pxsize, height*pxsize, 1,
X WhitePixmap, BlackPixmap);
X XMapWindow(win);
X XClear(win);
X
X if (maptype == 'M') {
X display_map();
X } else if (maptype == 'R') {
X display_relief();
X } else {
X fprintf(stderr, "Unknown map type '%c'\n", maptype);
X exit(1);
X }
X XFlush();
X pause(); /* Window evaporates when program exits, so keep running */
X}
X
X/* Display a map as seen by game players, using same colors */
X
Xdisplay_map()
X{
X char ch;
X int x, y, color;
X
X for (y = height-1; y >= 0; --y) {
X for (x = 0; x < width; ++x) {
X scanf("%c", &ch);
X color = sqcolor[index(terrtypes, ch) - (int) terrtypes];
X XPixSet(win, x*pxsize, (height-1-y)*pxsize, pxsize, pxsize, color);
X }
X scanf("\n");
X }
X}
X
X/* A map may also take the form of a relief map, in which case a more */
X/* extensive color map is set up. */
X/* This routine really needs to be robustified with respect to numbers */
X/* of colors etc */
X
Xdisplay_relief()
X{
X int i, j, x, y, elev, water, color;
X int sealevel, mtnlevel, icelevel;
X int desertlevel, forestlevel, numconts, numwconts;
X int contours[100], wcontours[100];
X int planes, pixels[200], scale;
X Color colors[200];
X
X scanf("%d %d %d %d %d %d %d\n",
X &sealevel, &mtnlevel, &icelevel, &desertlevel, &forestlevel,
X &numconts, &numwconts);
X for (i = 0; i < numconts; ++i)
X scanf("%d", &contours[i]);
X scanf("\n");
X for (i = 0; i < numwconts; ++i)
X scanf("%d", &wcontours[i]);
X scanf("\n");
X --width;
X
X if (DisplayCells() < 64) {
X fprintf(stderr, "Need 40 colors to draw a relief map!\n");
X exit(1);
X }
X XGetColorCells(0, 40, 0, &planes, pixels);
X for (i = 0; i < 20; ++i) {
X colors[i].pixel = pixels[i];
X colors[i].red = (10 * i) * 256;
X colors[i].green = (10 * i) * 256;
X colors[i].blue = (70 + (10 * i)) * 256;
X }
X for (i = 20; i < 40; ++i) {
X colors[i].pixel = pixels[i];
X colors[i].red = (65535 / 20) * (i-20) / 2;
X colors[i].green = (65535 / 20) * (20 - ((i-20)/2));
X colors[i].blue = 0;
X }
X XStoreColors(40, colors);
X for (y = height-1; y >= 0; --y) {
X for (x = 0; x < width; ++x) {
X scanf("%d %d", &elev, &water);
X color = 39;
X if (elev <= 63) color = elev - 21;
X if (elev <= 42) color = 19;
X if (elev <= 40) color = elev / 2;
X XPixSet(win, x*pxsize, (height-1-y)*pxsize, pxsize, pxsize,
X pixels[color]);
X }
X }
X}
X
X
END_OF_xmap.c
if test 4024 -ne `wc -c