[comp.sources.games] v08i032: conquer4 - middle earth multi-player game

billr@saab.CNA.TEK.COM (Bill Randle) (09/21/89)

Submitted-by: Adam Bryant <adb@bu-cs.bu.edu>
Posting-number: Volume 8, Issue 32
Archive-name: conquer4/Patch6a
Patch-To: conquer4: Volume 6, Issue 83-96

	[The latest (#6) conquer patches in four parts.	-br]

[[What is included in this patch:

     - A rehashing of the mail program
     - A possible fix for the 'moving to their Capitol' error
     - More display enhancements
     - The conqrast program to display map images on the sun.
     - A new poverty and inflation methodology.  [Warning!! Watch your budget!!]
     - MORE STUFF THAT I CAN'T QUITE REMEMBER NOW!!!!!

Instructions:
     1) MAKE A SUBDIRECTORY IN THE CONQUER SOURCE DIRECTORY
       [Suggest you call it conqrast...]
     2) UNSHAR ALL OF THE PARTS IN THIS DIRECTORY
     3) MOVE 'patchV4.6' TO THE CONQUER SOURCE DIRECTORY
     4) 'patch < patchV4.6' TO APPLY IT
     5) THE SUBDIRECTORY CONTAINS THE CODE TO THE CONQRAST PROGRAM

Hopefully this is enough to get everything going.

Once again, the more detailed fix list is in notes.v4.

adam
Adam Bryant                               ARPA:   adb@bu-cs.bu.edu
Conquer Hack'n'Slasher                    BITNET: adb@buenga
list: conquer-news-request@bu-cs.bu.edu   UUCP:   ...!harvard!bu-cs!adb]]

#!/bin/sh
# shar:	Shell Archiver  (v1.22)
#
# This is part 1 of a multipart archive                                    
# do not concatenate these parts, unpack them in order with /bin/sh        
#
#	Run the following text with /bin/sh to create:
#	  Makefile
#	  README
#	  conqrast.c
#	  conqrast.man
#	  error.c
#	  file.c
#	  file.h
#	  patchV4.6
#	  sunconqrast.h
#	  sunstuff.c
#	  util.c
#	  xconqrast.h
#	  xstuff.c
#
if test -r s2_seq_.tmp
then echo "Must unpack archives in sequence!"
     next=`cat s2_seq_.tmp`; echo "Please unpack part $next next"
     exit 1; fi
sed 's/^X//' << 'SHAR_EOF' > Makefile &&
X#
XSHELL=/bin/sh
XSHAR=/usr/local/bin/shar
XMAKE=/bin/make
X
X#
X# Will most likely have to edit the location of the
X# X Libraries.
X#
XLibs_sun= -lpixrect
XLibs_x= -L/usr/lib -lX
X
XWHICHconqrast: WHICHconqrast.o error.o WHICHstuff.o file.o util.o
X	cc $(CFLAGS) -o WHICHconqrast WHICHconqrast.o WHICHstuff.o file.o\
X			util.o error.o $(Libs_WHICH)
X
Xerror.o: error.c
Xfile.o: file.c
Xutil.o:util.c
X
XWHICHconqrast.o: conqrast.c WHICHconqrast.h file.h ../header.h
X	$(CC) $(CFLAGS) -c conqrast.c -DHEADERFILE=\"WHICHconqrast.h\"
X	mv conqrast.o WHICHconqrast.o
X
XWHICHstuff.o: WHICHstuff.c WHICHconqrast.h
X
Xlint.WHICH:
X	lint -abchx -DHEADERFILE=\"WHICHconqrast.h\" \
X		conqrast.c WHICHstuff.c error.c file.c util.c $(Libs_WHICH)
X
X### don't delete this line!
X
Xall: sunconqrast xconqrast
X
Xlint: lint.sun lint.x
X
Xlint.sun: makefile.sun 
X	$(MAKE) $(MFLAGS) -f makefile.sun lint.sun
X
Xlint.x: makefile.x 
X	$(MAKE) $(MFLAGS) -f makefile.x lint.x
X
Xsun sunconqrast: makefile.sun conqrast.c sunstuff.c sunconqrast.h file.c\
X			file.h util.c
X	$(MAKE) $(MFLAGS) -f makefile.sun sunconqrast
X
Xmakefile.sun : Makefile
X	sed -e '/^###/q' -e '/WHICH/s//sun/g' Makefile > makefile.sun
X
Xx xconqrast: makefile.x conqrast.c xstuff.c xconqrast.h file.c file.h util.c
X	$(MAKE) $(MFLAGS) -f makefile.x xconqrast
X
Xmakefile.x : Makefile
X	sed -e '/^###/q' -e '/WHICH/s//x/g' Makefile > makefile.x
X
Xshar.core: conqrast.c 
X	shar -c -v conqrast.c > shar.core
X
Xshar.sun: sunstuff.c sunconqrast.h
X	shar -c -v sunstuff.c sunconqrast.h > shar.sun
X
Xshar.x: xstuff.c xconqrast.h
X	shar -c -v xstuff.c xconqrast.h > shar.x
X
Xshar.general: Makefile README error.c file.c file.h util.c conqrast.man
X	shar -c -v Makefile README conqrast.man error.c file.c file.h util.c > shar.general
X
Xshar: shar.general shar.sun shar.x shar.core
X
Xcheckpoint:
X	cp Makefile README *.[ch] *.man old
X	/bin/rm *.diff newfiles difffiles
X
Xclean:
X	/bin/rm -f *.o *.diff patch shar.* *~ "#*" makefile.* newfiles difffiles
X
Xdiffs:
X	echo -n >patch
X	-for i in old/* ; do \
X		j=`basename $$i` ;\
X		if diff -c $$i $$j > $$j.diff ;\
X			then \
X			/bin/rm $$j.diff ;\
X		else \
X			cat  $$j.diff >> patch ;\
X			wc $$j.diff ;\
X		fi ;\
X	done
X
Xnewfiles:
X	echo -n > newfiles
X	-for i in *.[ch1] ; do\
X		if test -f old/$$i ; then\
X			: ;\
X		else \
X			echo $$i >> newfiles ;\
X		fi ;\
X	done
X
Xdifffiles: newfiles diffs
X	echo -n > difffiles
X	-for i in *.diff ; do\
X		j=`basename $$i .diff` ;\
X		echo -n $$j ;\
X		is=`wc $$i |colrm 9`;\
X		js=`wc $$j |colrm 9`;\
X		echo " " $$js $$is ;\
X		if test $$is -gt $$js ; then \
X			echo is very new! ;\
X			echo $$j >> newfiles ;\
X		else \
X			echo is changed ;\
X			echo $$i >> difffiles ;\
X		fi ;\
X	done
X
Xupdate: newfiles difffiles
X	-n=1;for i in `cat difffiles` `cat newfiles` ; do \
X		lines=`wc $$them $$i| tail -1 | colrm 9` ;\
X		echo $$them $$i $$lines ;\
X		if test $$lines -gt 800 ; then\
X			echo chop! ;\
X			$(SHAR) -c -v $$them > shar.$$n ;\
X			n=`expr $$n + 1` ;\
X			them="$$i" ;\
X		else \
X			them="$$them $$i" ;\
X		fi ;\
X	done ;\
X	$(SHAR) -c -v $$them > shar.$$n
X	/bin/rm newfiles difffiles
X
SHAR_EOF
chmod 0644 Makefile || echo "restore of Makefile fails"
sed 's/^X//' << 'SHAR_EOF' > README &&
X
XThis directory contains the code for conqrast, a program for
Xdisplaying nice maps of conquer games on sun consoles and, sometime in
Xthe future, on X windows displays.
X
XSee the manual page conqrast.1 for more details.
X
XBugs should probably be sent to me, Richard Caley.
X
X	rjc@uk.ac.ed.aipna
X
Xor permutations thereof that your local mailer demands.
X
SHAR_EOF
chmod 0644 README || echo "restore of README fails"
sed 's/^X//' << 'SHAR_EOF' > conqrast.c &&
X#include <stdio.h>
X#include <strings.h>
X#include "../header.h"
X#include "file.h"
X#include HEADERFILE
X
X/*********************************************************************
X*                                                                    *
X* This program draws a map of the conquer world on a bitmap system   *
X*                                                                    *
X* Written by Richard Caley July 1989 and hacked extensively          *
X* thereafter.                                                        *
X*                                                                    *
X* You may copy, distribute, modify or do what you will with this     *
X* code so long as this message remains in it and so long as you do   *
X* not charge for it, nor distribute the program without the source.  *
X*                                                                    *
X* There is a horrid hack for getpass - to make this read the         *
X* password from standard in one has to disconnect from the control   *
X* terminal. GAG! It should be possible to disconnect just the        *
X* conquer from the control terminal . . . someday.                   *
X*                                                                    *
X* See Readme for more details.                                       *
X*                                                                    *
X*********************************************************************/
X
X#define GAP (2)			/* fudge factor - space above
X				 * and below titles */
X
X#define total_height (height*mag+ (do_title?4*GAP+2*font_height(titlefont):0))
X				/* height of map and title bars */
X
X#define yoffset(place) ((place)+(do_title?font_height(titlefont)+GAP+GAP:0))
X				/* a y position */
X
X#define tracef if(trace) printf
X
Xchar *getpass();
Xvoid error(), ioerror();
Xchar *passwd=NULL;
Xchar *nation=NULL;
Xint turn;
Xint trace=0;
Xint bg=0;
Xchar conquer_version[100];
X
X#define conqrast_version "1.0"
X
X#ifndef conqrast_name
X#    define conqrast_name "Some conqrast" /* this is redefined in the header */
X#    define driver_version "unknown driver"
X#endif
X
X#define HEADER_TAG "Conquer Version" /* just before first line of map */
X#define HEADER_TAG_LENGTH (sizeof(HEADER_TAG)/sizeof(char)-1)
X
Xextern struct				/* maps from size of map to the font */
X				/* to use */
X    {				/* if size > mag use font */
X    int mag;
X    char *romanfont,*boldfont;
X    } fonts[];
X
Xstruct				/* Maps from terrain to brightness */
X    {
X    char c;			
X    int val;			/* must be between 0 and 255 */
X    } values[] =
X        {
X	' ', 256,
X	'~', 0,
X	'-', 64,
X	'%', 128,
X	'^', 192,
X	'#', 224,
X	'\0'
X	    };
X
Xchar *mapnames[] =
X    {
X    "This should never happen",
X    "Altitude",
X    "Vegetation",
X    "Nation",
X    "Designation"
X    };
X
X#define num_mapnames (sizeof(mapnames)/sizeof(char *))
X
X/*********************************************************************
X*                                                                    *
X* Font mapping information. Fonts used by the system have symbolic   *
X* names so they can be referred to on the commend line. font_table   *
X* records which fonts go with which name.                            *
X*                                                                    *
X*********************************************************************/
X
Xenum mapfont
X    {
X    f_nation,
X    f_designation,
X    f_title,
X    f_last
X	};
X
Xstruct 
X    {
X    char *name;
X    font romanfont;
X    font boldfont;
X    } font_table[(unsigned)f_last+1] =
X    {
X    {"nation"},
X    {"designation"},
X    {"title"},
X    {NULL}
X    };
X
X#define MAXDITHER 4		/* don't touch this */
X
Xshort dit[1<<MAXDITHER][1<<MAXDITHER];
X
X/*********************************************************************
X*                                                                    *
X* Sets the default fonts for the given size. If the font has already *
X* been specified ( ie is non-null ) leaves it alone.                 *
X*                                                                    *
X*********************************************************************/
X
Xvoid
Xset_default_fonts(mag,f)
X
Xint mag;
Xenum mapfont f;
X
X{
X    int i;
X
X    if (font_table[(unsigned)f].romanfont==NULL) /* if there was no font specified */
X	{
X	for(i=0;;i++)
X	    {			/* find one */
X	    if (fonts[i].mag >= mag )
X		break;
X	    else if (fonts[i].mag < mag )
X		{
X		if(bad_font(font_table[(unsigned)f].romanfont=
X			    font_named(fonts[i].romanfont)))
X		    error("Can't get font '%s' as %s font",
X			  fonts[i].romanfont,font_table[(unsigned)f].name);
X		if ( font_table[(unsigned)f].boldfont==NULL && fonts[i].boldfont !=NULL)
X		    if (bad_font(font_table[(unsigned)f].boldfont=
X				 font_named(fonts[i].boldfont)))
X			error("Can't get font '%s' as bold %s font",
X			      fonts[i].romanfont,font_table[(unsigned)f].name);
X		}
X	    }
X	if(font_table[(unsigned)f].romanfont==NULL)
X	    error("No font small enough for size %d %s",mag,font_table[(unsigned)f].name);
X	}
X    
X    }
X
X/*********************************************************************
X*                                                                    *
X* Set up a single font. if the name is in the table ( or is a prefix *
X* ) then insert the name into the font table. If the name begins     *
X* with 'b' then sets the bold font.                                  *
X*                                                                    *
X*********************************************************************/
X
Xvoid
Xset_a_font(name,fontname)
X
Xchar *name;
Xchar *fontname;
X
X{
X    int i,bold=0,l;
X    font thefont;
X
X    if( name[0]=='b')
X	{
X	name++;
X	bold=1;
X	}
X
X    l=strlen(name);
X
X    for (i=0;i< (int)f_last;i++)
X	if (!strncmp(name,font_table[i].name,l))
X	    break;
X
X    if ( i == (int)f_last)
X	error("Unknown font name '%s'",name);
X
X    thefont=font_named(fontname);
X
X    if ( bad_font(thefont) )
X	error("Can't get font '%s'",fontname);
X
X    if (bold)
X	font_table[i].boldfont=thefont;
X    else
X	font_table[i].romanfont=thefont;
X    }
X
X/*********************************************************************
X*                                                                    *
X* scan over the header of the map. Returns the number of the map, or *
X* 0 if the map is bad. If `pipe' is != 0 then the input is a pipe    *
X* and an eof implies a bad password.                                 *
X*                                                                    *
X* Tries to cope with DEBUG and none-DEBUG conquers                   *
X*                                                                    *
X*********************************************************************/
X
Xscan_header(f,pipe)
X
XFILE *f;
Xint pipe;
X
X{
X    char line[1024];
X    char which[100];
X    static char who[100];
X    int mapid;
X
X    while ( fgets(line,1024,f) != NULL)	/* scan to top of map */
X	{
X	if (!strncmp(line,HEADER_TAG,HEADER_TAG_LENGTH))
X	    break;
X	}
X
X    if (feof(f))
X	{
X	if(pipe)
X	    error("Password incorrect");
X	else
X	    error("Unexpected end of map file");
X	}
X
X    if (sscanf(line,"Conquer Version %[0-9.] : %s Map %*s %*s %s on Turn %d",conquer_version,which,who,&turn)!=4)
X	error("Bad title line (wrong version?) '%s'",line);
X
X    for(mapid=1;mapid < num_mapnames;mapid++)
X	if(!strcmp(mapnames[mapid],which))
X	    break;
X
X    if ( mapid==num_mapnames)
X	mapid= 0;
X    else if ( trace && !pipe)
X	printf("Found %s map\n", which);
X
X    if(!strcmp(who,"World"))
X	nation="god";
X    else
X	nation=who;
X
X    tracef("Nation is %s\n",nation);
X
X    return mapid;
X    }
X
X/*********************************************************************
X*                                                                    *
X* Find maps in a file and store away a file pointer and offset for   *
X* each                                                               *
X*                                                                    *
X*********************************************************************/
X
Xvoid
Xprocess_map_file(name)
X
Xchar *name;
X
X{
X    int which;
X    FILE *f;
X    char line[1024];
X
X    tracef("Searching file %s\n",name);
X
X    if ((f=fopen(name,"r"))==NULL)
X	ioerror("Can't open map file '%s'",name);
X
X    while(1)
X	{
X	long top;
X
X	which=scan_header(f,0);
X    
X	if(which==0)
X	    error("Bad map file '%s'",name);
X
X	myopen(which,f);
X	top=ftell(f);
X	while(fgets(line,1024,f)!=NULL)
X	    {
X	    if (!strncmp(line,HEADER_TAG,HEADER_TAG_LENGTH))
X		break;
X	    top=ftell(f);
X	    }
X
X	if(feof(f))
X	    break;
X
X	fseek(f,top,0);
X	}
X    }
X
X/*********************************************************************
X*                                                                    *
X* Get a map. If the map was not in one of the files on the command   *
X* line it runs conquer -p to get it.                                 *
X*                                                                    *
X*     Which selects the map.                                         *
X*     Args are passed to conqrun.                                    *
X*     Tmpname is the name of a temporary file to use. This is        *
X*         deleted in this routine so you can reuse the name.         *
X*                                                                    *
X*     All except `which' are ignored if the user has given a map     *
X*     file of the correct type as an argumant.                       *
X*                                                                    *
X*********************************************************************/
X
Xint
Xget_map_file(which,args,tmpname)
X
Xint which;
Xchar *args;
Xchar *tmpname;
X
X{
X    char command[100];
X    FILE *tmp;
X
X    if ( ! myisopen(which))
X	{
X	if (nation==NULL)
X	    {
X	    tracef("Assuming god\n");
X
X	    nation="god";
X	    }
X
X	tracef("Asking conquer for %s map\n",mapnames[which]);
X
X	if (passwd==NULL)
X	    {
X	    passwd=getpass("Enter conquer password: ");
X	    }
X
X	tracef("Disconnecting ( HACK! ) bye bye\n");
X
X	disconnect();		/* disconnect from controling tty */
X	                        /* ( hack for getpass ) */
X
X	if (bg)			/* go into background if asked */
X	    {
X	    tracef("Going into background\n");
X
X	    background();
X	    }
X
X	sprintf(command,"conquer -p %s > %s 2>/dev/null",args,tmpname);
X	
X	if((tmp=popen(command,"w"))==NULL)
X	    ioerror("can't run conquer");
X	
X	if (fprintf(tmp,"%s\n%s\n%c\n",nation,passwd, which+'0')==EOF)
X	    error("Couldn't get map. Conquer may be updating.\n");
X	
X	pclose(tmp);
X	
X	if((tmp=fopen(tmpname,"r"))==NULL)
X	    ioerror("can't open %s",tmpname);
X	
X	unlink(tmpname);		/* delete it */
X
X	(void)scan_header(tmp,1);
X	myopen(which,tmp);
X	}
X
X    return which;
X    }
X
X/*ARGSUSED*/
Xmain(argc,argv)
X
Xint argc;
Xchar *argv[];
X
X{
X    char line[1024];
X    char desline[1024];
X    char tmpname[20];
X    char args[100];
X    char *screen_name=get_default_screen_name();
X    screen_type screen=NULL;
X    int  mapfile;
X    int destmapfile;
X    int mag=11;
X    bitmap pr;
X    int width,height;
X    extern char *myname;
X    int x,y,i,j,val;
X    char c;
X    char *mapname=NULL;
X    char *world=NULL;
X    int do_nations=0,barbarians=0,markbarbs=0;
X    int all=0,live=0,altitude=1;
X    int desig=0;
X    int do_title=1;
X    font titlefont;
X    int boldtitle=0;		/* indicates that the title font should be
X				   emboldened - ie `titlefont' is roman and
X				   so _we_ must do the bold */
X
X
X    myname=argv[0];
X
X    strcpy(args,"");
X
X    while(*(++argv)!=NULL)
X	if (!strncmp(*argv,"-o",2))
X	    {
X	    mapname= *(++argv);
X	    if ( is_screenname(mapname))
X		{
X		screen_name=mapname;
X		mapname=NULL;
X		}
X	    }
X	else if (!strcmp(*argv,"-l"))
X	    live++;
X	else if (!strcmp(*argv,"-D"))
X	    sprintf(args,"%s -d %s",args,world= *(++argv));
X	else if (!strcmp(*argv,"-N"))
X	    nation= *(++argv);
X	else if (!strcmp(*argv,"-bg"))
X	    bg++;
X	else if (!strcmp(*argv,"-a"))
X	    altitude=0;
X	else if (!strcmp(*argv,"-f"))
X	    {
X	    char *which= *(++argv), *fontname= *(++argv);
X	    set_a_font(which,fontname);
X	    }
X	else if (!strncmp(*argv,"-b",2))
X	    {
X	    barbarians++;
X	    if ( (*argv)[2]=='a')
X		markbarbs++;
X	    }
X	else if (!strcmp(*argv,"-m"))
X	    mag=atoi(*(++argv));
X	else if (!strncmp(*argv,"-c",2))
X	    {
X	    c=(*argv)[2];
X	    for (i=0;;i++)
X		{
X		if (values[i].c =='\0')
X		    error("Unknown contour '%c'",c);
X		else if ( values[i].c == c)
X		    {
X		    values[i].val=atoi(*(++argv));
X		    break;
X		    }
X		}
X	    }
X	else if (!strncmp(*argv,"-n",2))
X	    {
X	    do_nations++;
X	    if ( (*argv)[2]=='a')
X		++all;
X	    }
X	else if (!strncmp(*argv,"-d",2))
X	    {
X	    desig++;
X	    }
X	else if (!strcmp(*argv,"-h"))
X	    help_message(myname);
X	else if (!strcmp(*argv,"-t"))
X	    do_title=0;
X	else if (!strcmp(*argv,"-v"))
X	    trace++;
X	else if ( (*argv)[0]=='-')
X	    {
X	    printf("Unknown option '%s'\n",*argv);
X	    help_message(myname);
X	    }
X        else
X	    process_map_file(*argv);
X
X    if (do_nations)		/* if we have to put in nations */
X	set_default_fonts(mag,f_nation);
X
X    if (desig)
X	{
X	if (all)
X	    error("Only one of -d and -na allowed!");
X
X	set_default_fonts(mag,f_designation);
X	}
X
X    if (do_title)
X	{
X	set_default_fonts(mag+2,f_title);
X	if ( (titlefont=font_table[(unsigned)f_title].boldfont)==NULL)
X	    {
X	    boldtitle=1;
X	    titlefont=font_table[(unsigned)f_title].romanfont;
X	    }
X
X	}
X
X    screen=screen_named(screen_name);
X
X    sprintf(tmpname,"/tmp/conq%d",getpid());
X
X    mapfile=get_map_file(altitude?1:3, /* get a map */
X			 args,tmpname);
X
X    if(mygets(line,1024,mapfile)==NULL)
X	error("empty map!");
X
X    width=strlen(line)-1;	/* count height and width */
X
X    for(height=1;mygets(line,1024,mapfile)!=NULL;height++)
X	if(!strncmp(line,HEADER_TAG,HEADER_TAG_LENGTH)||
X	   !strncmp(line,"reading",7))
X	    break;
X
X    tracef("Size %d X %d, image %d X %d\n",width,height,width*mag,height*mag);
X
X    initialise_bitmaps();
X
X    if(live)			/* if live do it on the screen */
X	{
X	if ((pr=get_screen_bitmap(screen))==NULL)
X	    ioerror("Can't open screen %s",screen_name);
X	}
X    else			/* otherwise in memory */
X	pr=create_bitmap(width*mag,total_height);
X
X    myrewind(mapfile);
X
X    if (altitude)		/* if needed do altitude */
X	{
X	int xx,yy;
X	tracef("Drawing topography\n");
X
X	build_dither_matrix(MAXDITHER);
X
X	yy=yoffset(0);
X	for(y=0;y<height;y++,yy+=mag)
X	    {
X	    if (mygets(line,1024,mapfile)==NULL)
X		error("unexpected end of file!");
X	
X	    for(xx=x=0;x<width;x++,xx+=mag)
X		{
X		val= -1;
X		for(i=0;values[i].c!='\0';i++)
X		    if ( values[i].c==line[x] )
X			val=values[i].val;
X	    
X		if ( val<0 )
X		    {		/* non fatal, I like it that way */
X		    printf("unknown character %c\n",line[x]);
X		    continue;
X		    }
X	    
X		for(i=0;i<mag;i++)
X		    for(j=0;j<mag;j++)
X			{
X			set_bit(pr,xx+i,yy+j,dit[(xx+i)%16][(yy+j)%16] >=val?1:0);
X			}
X		}
X	    }
X    
X	myclose(mapfile);
X	}
X
X    if(do_nations||desig)	/* nations */
X	{
X	font nf, bnf;
X	font df;
X	int xx,yy;
X	char des,
X	current='\0';		/* keeps track of which nation we are in */
X	char last[1024];	/* ditto vertically for each column */
X
X	tracef("Drawing nations\n");
X
X	if (do_nations)
X	    {
X	    nf = font_table[(unsigned)f_nation].romanfont;
X	    bnf = font_table[(unsigned)f_nation].boldfont;
X	    }
X
X	if (desig)
X	    {
X	    df = font_table[(unsigned)f_designation].romanfont;
X	    }
X
X	if (altitude)		/* if no altitude this was gotten to */
X	    /* count the size */
X	    mapfile=get_map_file(3,args,tmpname);
X
X	destmapfile=get_map_file(4,args,tmpname);
X
X	yy=yoffset(mag);
X	for(y=0;y<height;y++,yy+=mag)
X	    {
X	    if(mygets(line,1024,mapfile)==NULL)
X		error("unexpected end of file in nation map");
X	    if(mygets(desline,1024,destmapfile)==NULL)
X		error("unexpected end of file in designation map");
X
X	    current='\0';	       
X	    for(x=0;x<width;x++)
X		{
X		c=line[x];
X		des=desline[x];
X
X		if (index("~-%#^",c)!=NULL) /* if no-one owns */
X		    c=' ';
X		else if ( !barbarians && c == '*' ) /* if barbarian or lizard */
X		    c=' ';
X
X		xx=x*mag;
X	    
X		if (do_nations && c !=current )	/* crossing a vertical border */
X		    {
X		    draw_line(pr,xx-1,yy,xx-1,yy-mag,BLACK);
X		    draw_line(pr,xx,yy,xx,yy-mag,WHITE);
X		    draw_line(pr,xx+1,yy,xx+1,yy-mag,BLACK);
X		    current=c;
X		    }
X
X		if ( do_nations & last[x] != c)	/* horizontal border above */
X		    {
X		    draw_line(pr,xx,yy-mag,xx+mag,yy-mag,WHITE);
X		    draw_line(pr,xx,yy-mag+1,xx+mag,yy-mag+1,BLACK);
X		    draw_line(pr,xx,yy-mag-1,xx+mag,yy-mag-1,BLACK);
X		    last[x]=c;
X		    }
X		
X		/*
X		 * The following is convoluted to get the right things bold
X		 * I think it copes with all cases 
X		 */
X
X		if ( do_nations && des == 'C' )
X		    {
X		    if (all||desig)
X			{
X			if (bnf)
X			    put_txt(pr,xx,yy,bnf,c,0);
X			else
X			    put_txt(pr,xx,yy,nf,c,1);
X			}
X		    else
X			put_txt(pr,xx,yy,nf,c,0);
X		    }
X		else if (do_nations && all && c != ' ' && ( c != '*' || markbarbs ) )
X		    put_txt(pr,xx,yy,nf,c,0);
X		else if (desig && des != '-')
X		    put_txt(pr,xx,yy,df,des,0);
X		}
X	    }
X	    
X	    
X	myclose(mapfile);
X	myclose(destmapfile);
X	}
X
X				/* line down right */
X    draw_line(pr,mag*width-1,yoffset(0),mag*width-1,yoffset(mag*height),BLACK);
X    draw_line(pr,mag*width-2,yoffset(0),mag*width-2,yoffset(mag*height),WHITE);
X    draw_line(pr,mag*width-3,yoffset(0),mag*width-3,yoffset(mag*height),BLACK);
X				/* left */
X    draw_line(pr,0,yoffset(0),0,yoffset(mag*height),BLACK);
X    draw_line(pr,1,yoffset(0),1,yoffset(mag*height),WHITE);
X    draw_line(pr,2,yoffset(0),2,yoffset(mag*height),BLACK);
X				/* top */
X    draw_line(pr,0,yoffset(0),mag*width,yoffset(0),BLACK);
X    draw_line(pr,0,yoffset(1),mag*width,yoffset(1),WHITE);
X    draw_line(pr,0,yoffset(2),mag*width,yoffset(2),BLACK);
X				/* bottom */
X    draw_line(pr,0,yoffset(mag*height-1),mag*width,yoffset(mag*height-1),BLACK);
X    draw_line(pr,0,yoffset(mag*height-2),mag*width,yoffset(mag*height-2),WHITE);
X    draw_line(pr,0,yoffset(mag*height-3),mag*width,yoffset(mag*height-3),BLACK);
X
X    if (do_title)
X	{
X	sprintf(line,"Conquer Version %s",conquer_version);
X	put_txt(pr,mag,
X		font_baseline(titlefont)+GAP+1,titlefont,'\0',boldtitle,line);
X
X	sprintf(line,"%s Version %s/%s",conqrast_name,conqrast_version,driver_version);
X	put_txt(pr,width*mag-strlen(line)*font_width(titlefont)-GAP-GAP,
X		font_baseline(titlefont)+GAP+1,titlefont,'\0',boldtitle,line);
X
X	if ( nation==NULL || !strcmp(nation,"god"))
X	    sprintf(line,"Conquer World Map For Turn %d",turn);
X	else
X	    sprintf(line,"Conquer Map For Nation %s On Turn %d",nation,turn);
X
X	put_txt(pr,(width*mag-strlen(line)*font_width(titlefont))/2,
X		height*mag+GAP+font_height(titlefont)+GAP+
X		GAP+font_baseline(titlefont),titlefont,'\0',boldtitle,line);
X	}
X
X    if (mapname !=NULL)		/* told to save in file */
X	{
X	write_bitmap(pr,mapname,width*mag,total_height);
X	destroy_bitmap(pr);
X	}
X    else if (!live)		/* not drawn already */
X	{
X	display_bitmap(pr,0,0,width*mag,total_height);
X	destroy_bitmap(pr);
X	}
X    else
X	destroy_bitmap(pr);
X
X    finish_bitmaps();
X
X    tracef("done\n");
X
X    }
X
X/*********************************************************************
X*                                                                    *
X* put the character c at (xx, yy) in pr, using font pf. Highlight    *
X* means bold ( not very good at the moment, anyone want to improve   *
X* it? ).                                                             *
X*                                                                    *
X* This works by first blacking out an area around the character and  *
X* then printing the character.                                       *
X*                                                                    *
X* Bolding is done by smearing ( yeuch ).                             *
X*                                                                    *
X* If c is the null character then str is a string to display in the  *
X* same way.                                                          *
X*                                                                    *
X*********************************************************************/
X/*VARARGS6*/
Xput_txt(pr,xx,yy,pf,c,highlight,str)
X
Xbitmap pr;
Xint xx,yy;
Xfont pf;
Xchar c;
Xint highlight;
Xchar *str;
X
X{
X    int i,j,size;
X    static char st[2];
X    int x,y;
X
X    if ( c !='\0' )
X	{
X	st[0]=c;
X	st[1]='\0';
X	str=st;
X	}
X
X    if (highlight)
X	size=1;
X    else
X	size=0;
X
X    xx+= 2;
X    yy-= 2;
X
X    for(i=0,x=xx-1; i<3+size; i++,x++)
X	for(j=0,y=yy+1; j<3+size; j++,y--)
X	    bitmap_text(pr,x,y,DRAW_BLACK,pf,str);
X
X
X    for(i=0,x=xx;i<1+size;i++,x++)
X	for(j=0,y=yy;j<1+size;j++,y--)
X	    bitmap_text(pr,x,y,DRAW_WHITE,pf,str);
X
X    }
X
SHAR_EOF
chmod 0644 conqrast.c || echo "restore of conqrast.c fails"
sed 's/^X//' << 'SHAR_EOF' > conqrast.man &&
X.TH CONQRAST 1 "17th August 1989" "CONQUER"
X.SH NAME
Xconqrast \- Displaying and saving maps for conquer
X.SH SYNOPSIS
X.B sunconqrast
X[argumants] [mapfile]...
X.br
X.B xconqrast
X[arguments] [mapfile]...
X.SH NOTE
X.I
Xxconqrast does not work yet. If you want it, do it . . .
X.SH DESCRIPTION
X.I Conqrast
Xis a program which sits on top of conquer and displays maps on bitmap
Xdevices. Two versions exist at the moment
X.I sunconqrast
Xdisplay on a sun workstation screen and saves in sun rasterfile
Xformat;
X.I xconqrast
Xdisplays in the root window of and X Windows display and stores in X
Xbitmap format.
X.PP
XThe map which is drawn is either supplied as a command line argument
Xor is obtained by running conquer. In the latter case, the nation and
Xgame are supplied with the \fB-N\fR and \fB-D\fR arguments described
Xbelow, the nation name will be taken from any map files supplied or,
Xby default, is "god".
X.SH OPTIONS
XArguments are as follows
X.IP "\fB-o\fR \fIfilename\fR"
XSave the resulting image in \fIfilename\fR rather than
Xdisplaying it on the screen.
X
X.IP "\fB-o\fR \fIdisplay\fR"
XUse the display \fIdisplay\fR rather than the default.
X\fISunconqrast\fR defaults to "/def/fb" and recognised
Xscreen names by the leading "/dev/" while
Xxconqrast defaults to "unix:0" and recognises screeen
Xnames by the colon. This will probaby be needed if you are
Xrunning on a system with multiple screens etc.
X
X.IP "\fB-l\fR"  
XProduce the image "live". That is on the screen as it
Xis built rather than in memory. Unsafe since you can
Xcorrupt the image as as it is drawn, but prety.
X
X.IP "\fB-D\fR \fIdir\fR"
XUse the conquer game in directory \fIdir\fR.
X
X.IP "\fB-N\fR \fIname\fR"
XMake map for nation \fInation\fR.
X
X.IP "\fB-m\fR \fInumber\fR"
XMagnify the image \fInumber\fR times. The default
Xmagnification is 11.
X
X.IP"\fB-n\fR" 
XDraw in the national boundries and label the capitals
Xwith the symbol of the nation.
X
X.IP "\fB-na\fR"
XDraw in national boundries and label _all_ the sectors
Xwith who owns them. This is useful for when a game has
Xbeen going a while and the nations do not form nice
Xconnected regions, so isolated fragments of nations
Xare hard to identify. Capitals are identified by being
Xlabeled in bold. 
X
X.IP "\fB-d\fR"
XDisplay the designations of sectors. This can be
Xcombined with -n to draw in the nation boundries and
Xlabel the capitals with the nations character. In this
Xcase the capital is displayed bold to distinguish, for
Xexample, nation 'f's capital from a farm.
X
X.IP "\fB-b\fR"
XDraw in the boundries of barbarian ( ie savages,
Xnomad, lizard, or pirate ) owned lands. Only
Xuseful when used with -n or -na.
X
X.IP "\fB-ba\fR" 
XLike \fB-b\fR but labels the barbarian lands with stars.
X
X.IP "\fB-a\fR"  
XDo \fInot\fR draw in the altitudes. This is not useful for
Xactually drawing nice maps, but since drawing in
Xaltitude information is slow, it speeds up
Xexperimentation with different fonts for the nation
Xlabels. 
X
X.IP "\fB-c\fIc\fR \fInumber\fR"
XDraw altitudes of type \fIc\fR with brightness \fInumber\fR.
X\fIc\fR is one of "~-%#^" as used by conquer. \fInumber\fR is
Xbetween 0 and 256 with 0 being black and 256 white.
X
X.IP "\fB-t\fR"  
XDo not title the map. This is necesary when there is
Xno font small enough.
X
X.IP "\fB-f\fR \fItype\fR \fIfont\fR"
XUse font \fIfont\fR for things of type \fItype\fR.
XPossible types are
X.RS
X.IP "title"     
XFor the title.
X.IP "nation"    
XFor the nation/capital labels.
X.IP "designation" 
XFor the designations.
X.RE
Xor any of the above with `b' prepended ( eg. "btitle"
X) to set the bold version. If no fonts are specified,
Xconqrast will choose for you.
X
X.IP "\fB-v\fR"  
XPrint out notes on what is being done. 
X.PP
XThe \fImapfiles\fR should be as produced by 
X.IP
Xconquer -p > mapfile'
X.PP
XIf you do not supply a mapfile which is needed to produce the map you
Xrequest ( altitude unless `\fB-a\fR'; nation and designation for `-n';
Xdesignation for `\fB-d\fR' ) \fIconqrast\fR will prompt you for the nation's
Xpassword and attempt to run 
X.IP
Xconquer -p -n\fIname\fR
X.PP
Xto get the map it wants.
X
XMore than one map may be put into a single file as shown in the example below. 
X
X.SH EXAMPLE
X.IP
X.br
X% \fBconquer -p -nTolland >mapfile\fR
X.br
Xconquer Version 4.4: Copyright (c) 1988 by Edward M Barlow
X.br
X
X.br
XWhat is your Nation's Password: 
X.br
X
X.br
XFor convenience, this output is to stderr,
X.br
Xwhile the maps will be sent to stdout.
X.br
X
X.br
XThe valid options are,
X.br
X1) altitudes
X.br
X2) vegetations
X.br
X3) nations
X.br
X4) designations
X.br
X
X.br
XWhat type of map? \fB1\fR
X.br
X
X.br
Xdoing print of altitude
X.br
X% \fBconquer -p -nTolland >> mapfile\fR
X.br
Xconquer Version 4.4: Copyright (c) 1988 by Edward M Barlow
X.br
X
X.br
XWhat is your Nation's Password: 
X.br
X
X.br
XFor convenience, this output is to stderr,
X.br
Xwhile the maps will be sent to stdout.
X.br
X
X.br
XThe valid options are,
X.br
X1) altitudes
X.br
X2) vegetations
X.br
X3) nations
X.br
X4) designations
X.br
X
X.br
XWhat type of map? \fB3\fR
X.br
X
X.br
Xdoing print of nations
X.br
X% \fBsunconqrast -n -m 11 mapfile\fR
X.br
XEnter conquer password: 
X.br
X
Xnotice how it prompts for your password when it
Xfinds it needs the designation map which was not given in the file.
X
X.SH PROBLEMS
X
X.I
Xxconqrast
Xdoes not work yet! not even slightly. Don't even think of it.
X
XThe method used to produce bold when there is no bold font is
Xrather poor.
X
Xno fonts for small maps ( < mag 9 ) on my machine so that is
Xthe minimum. If you want a smaller one have a look in
X/usr/lib/fonts/fixedwidthfonts on your machine or create your
Xown. In the latter case, you could send it to me too . . .
X
XThe way -o works makes it impossible to draw live on a
Xnon-standard screen then dump to a file. Doesn't seem to be
Xlikely to cause anyone too many problems ( famous last words!
X).
X
X
X.SH "THINGS TO DO"
X
Xcreate a set nice fonts ( different sizes ) for designations
Xso that they can be represented by a symbol rather than by a
Xletter. 
X
Xdisconnect the conquer process from the terminal rathert then
Xsunconqrast.
X
Xbetter help message.
X
X.SH SEE ALSO
Xconquer(6) rasterfile(5) screenload(1) bitmap(1x)
X.SH AUTHER
XRichard Caley
SHAR_EOF
chmod 0644 conqrast.man || echo "restore of conqrast.man fails"
sed 's/^X//' << 'SHAR_EOF' > error.c &&
X#include <stdio.h>
X
Xint errno;
Xchar *sys_errlist[];
X
Xchar *myname="Someone";
X
X/*VARARGS1*/
Xvoid
Xioerror(str,arg1,arg2,arg3)
X
Xchar *str;
Xint arg1, arg2, arg3;
X
X{
Xfprintf(stderr,"%s: ",myname);
Xfprintf(stderr,str,arg1,arg2,arg3);
Xfprintf(stderr," - %s\n",sys_errlist[errno]);
Xexit(1);
X}
X
X/*VARARGS1*/
Xvoid
Xerror(str,arg1,arg2,arg3)
X
Xchar *str;
Xint arg1, arg2, arg3;
X
X{
Xfprintf(stderr,"%s: ",myname);
Xfprintf(stderr,str,arg1,arg2,arg3);
Xfputc('\n',stderr);
Xexit(1);
X}
X
SHAR_EOF
chmod 0644 error.c || echo "restore of error.c fails"
sed 's/^X//' << 'SHAR_EOF' > file.c &&
X#include <stdio.h>
X#include "file.h"
X
X/*********************************************************************
X*                                                                    *
X* All the my* routines mimic stdio routines but manipulate struct    *
X* file's The point is that we can read from and otherwise manipulate *
X* more than one place in a file ( for more than one map ).           *
X*                                                                    *
X*********************************************************************/
X
X/*********************************************************************
X*                                                                    *
X* struct file's play the roll of FILE *'s                            *
X*                                                                    *
X*********************************************************************/
X
X#define MAX_FILES 10
X
Xstatic struct file 
X    {
X    FILE *fd;			/* which file */
X    long offset,		/* where are we reading from now */
X         top;			/* where is the notional start */
X    } file_table[MAX_FILES];
X    
X
Xvoid
Xmyopen(which,file)
X
Xint which;
XFILE *file;
X
X{
Xfile_table[which].fd=file;
Xfile_table[which].offset=file_table[which].top=ftell(file);
X}
X
Xmyisopen(which)
X
Xint which;
X
X{
Xreturn file_table[which].fd != NULL;
X}
X
Xchar *
Xmygets(buffer,num,which)
X
Xchar *buffer;
Xint num;
Xint which;
X{
X    fseek(file_table[which].fd,file_table[which].offset,0);
X
X    buffer=fgets(buffer,num,file_table[which].fd);
X
X    file_table[which].offset=ftell(file_table[which].fd);
X
X    return buffer;
X    }
X
Xvoid
Xmyrewind(which)
X
Xint which;
X
X{
X    fseek(file_table[which].fd,file_table[which].top,0);
X    file_table[which].offset=file_table[which].top;
X    }
X
Xvoid
Xmyclose(which)
X
Xint which;
X
X{
X    int i;
X
X    for(i=0;i<MAX_FILES;i++)
X	if ( i != which && file_table[i].fd == file_table[which].fd)
X	    {
X	    file_table[which].fd=NULL;
X	    return;
X	    }
X
X    fclose(file_table[which].fd);
X    }
X
SHAR_EOF
chmod 0644 file.c || echo "restore of file.c fails"
sed 's/^X//' << 'SHAR_EOF' > file.h &&
X/*********************************************************************
X*                                                                    *
X* file manipulations                                                 *
X*                                                                    *
X*********************************************************************/
X
Xvoid myopen();
Xint isopen();
Xchar *mygets();
Xvoid myrewind();
Xvoid myclose();
X
SHAR_EOF
chmod 0644 file.h || echo "restore of file.h fails"
sed 's/^X//' << 'SHAR_EOF' > patchV4.6 &&
X*** onotes.v4	Wed Sep 20 21:40:57 1989
X--- notes.v4	Wed Sep 20 21:41:22 1989
X***************
X*** 185,194 ****
X  133. added fix to make sure '-p' command checks void properly. [D. Caplinger]
X  134. inserted a check for allowing extra clear when redrawing.
X  135. renamed all of the conqps source files to 'psmap'.
X  
X  -------------------------------------------------------------------------
X! | 2.0 POSSIBLE SHORT-TERM ENHANCEMENTS/FIXES FOR CONQUER V4             |
X  -------------------------------------------------------------------------
X  o make land capture only occur during update.
X  o some problems due to two nations capturing same land.  should fix by above.
X  o some problems with MINER not providing initial stats on first turn after
X--- 185,273 ----
X  133. added fix to make sure '-p' command checks void properly. [D. Caplinger]
X  134. inserted a check for allowing extra clear when redrawing.
X  135. renamed all of the conqps source files to 'psmap'.
X+ ===4.0 patch number five released => 4.5 ===========================
X+ 136. changed situations of string printing mvprintw's to mvaddstr's.
X+ 137. moved a 'makebottom()' from 'm'ove command to parse routine.
X+ 138. npc.c (1339): added a check for ntn[country].tciv > 0 [T. Kivinen]
X+ 139. reset both roads_this_turn and terror_adj in login change. [T. Kivinen]
X+ 140. fixed overflow on wealth calculations [K. Bera]
X+ 141. adjusted flee() code for incremental people adjustment [K. Bera]
X+ 142. added patch to include XENIX header file in update.c [J. Bayer]
X+ 143. fixed passing of a parameter in god_magk() call.
X+ 144. fixed highlight function call three places in move.c.
X+ 145. fixed prep function call in move.c and io.c.
X+ 146. fixed get_display_for function call in display.c.
X+ 147. adjusted txt1 to clarify attractiveness calculation. {9 per jewels
X+ 	was written as 9 / jewels.  Changed it to 9 * jewels.} [T. Kivenen]
X+ 148. implemented the command 'X' to center screen around a nations capitol.
X+ 149. implemented the command 'x' to center screen around given sector.
X+ 150. in god mode, the 'X' command jumps between active nations' capitols.
X+ 151. centered screen about captitol during initial login.
X+ 152. gave god the ability to move civilians using 'Z' {#ifdef OGOD}.
X+ 153. altered calcuation of both poverty and inflation and added to txt5.
X+ 154. changed F_OK to 00 in update.c.
X+ 155. rewrote the isinstr() function in psmap.c to avoid the use of index().
X+ 156. implemented tests throughout find_avg_sector() for zero division.
X+ 157. changed astr,dstr to floats in combat.c (198).  [Bob Earl]
X+ 158. added use of indicator instead of using MGKNUM in combat.c. [T. Kivinen]
X+ 159. added extra check in land_reachp() for movecost < 0.  [Dean Brooks]
X+ 160. removed MOVECOST from 'd'isplay command.
X+ 161. altered bottom display of move() after error messages.
X+ 162. added makebottom() to civilian movement, was accidently removed(?)
X+ 163. big adjustment to mining_ability and wealth:
X+ 	-if it is lowered, it decreases by only a quarter of the difference.
X+ 164. fixed typo and checking of placed in terraform() [Dean Brooks]
X+ 165. added in dgod_make flag to indicate if the demi-god is remaking.
X+ 166. added setting of spell points to zero in zeroworld().
X+ 167. renamed dgod_make to remake and made demi-god be default for any remake.
X+ 168. changed the clear(); in change() to move(0,0); clrtobot();
X+ 169. added move(0,0), etc. to fleetrpt() and armyrpt().
X+ 170. moved the makebottom(); to parse after the EXT_CMD entry.
X+ 171. added move(0,0), etc. to fleetrpt() and armyrpt().
X+ 172. added move(0,0), etc. to trade() in trade.c.
X+ 173. made major adjustments to the mailing routines mailopen() mailclose().
X+ 174. rewrote the mail interface to be a little more robust.
X+ 175. the mail writing and reading routines now prevent most conflicts.
X+ 176. made the mail writer a little spiffier.
X+ 177. fixed a bug in detection of leader death and recreation in update.c.
X+ 178. no longer charge BREAKJIHAD for breaking one-sided treaties.
X+ 179. added in fix to ruin redesignation when DERVISH or DESTROYER.
X+ 180. allow redesignation of ruin to a non-city type at REBUILDCOST cost.
X+ 181. altered the god_mgk() display routine a little.
X+ 182. added in a limit of 16% to charity creeping for democracy.
X+ 183. added a check for a line with a period on it to end mail.
X  
X  -------------------------------------------------------------------------
X! | 2.0 POSSIBLE SHORT-TERM ENHANCEMENTS/FIXES FOR CONQUER V5             |
X  -------------------------------------------------------------------------
X+ o new functions:
X+ 	- status_value() = returns base values of attack.defend,etc.
X+ 	- sect_movecost() = returns move cost for given unit in given sector.
X+ o adding to grouped soldiers with ZERO movement should not change status.
X+ o changes to zombies:
X+ 	- should need less food.
X+ 	- some should decay each turn. [5% or so]
X+ 	- drafting zombies should decrease popularity. [just killed people!]
X+ 	- zombie formation could be a factor of nation being in battle not
X+ 	  neccesarily having zombies in battle.  OR limit number of zombies
X+           created to be half or third size of zombie armies, since zombies
X+           are needed to create other zombies.
X+ o new display options:
X+ 	- highlight units who haven't moved since start of turn.
X+ o multiple leaders in a unit?  [then experience is not able to be
X+ 	added in later.]
X+ o limit spell points via knowledge, or cause lose based on knowledge factor.
X+ o might scroll screen without moving sector.  [What keys?  Needed?]
X+ o implement automatic updates through use of checking what nations have
X+ 	moved.
X+ o additional extended commands:  [ESC prefix]
X+ 	'r' = Renumber an army.  [new army structure could facilitate]
X+ 	'j' = Jump to location of given army number.
X+ o additional commands:
X+ 	'O' = go to previous army.
X+ o implement interface for 'Z' command.  [Movement locator]
X+ o email to real diety. [hmmm... needed or not?  I would actually vote
X+ 	for allowing mail to both the diety and the demi-god. -adb]
X  o make land capture only occur during update.
X  o some problems due to two nations capturing same land.  should fix by above.
X  o some problems with MINER not providing initial stats on first turn after
X*** oheader.h	Wed Sep 20 21:40:55 1989
X--- header.h	Wed Sep 20 21:41:22 1989
X***************
X*** 162,167 ****
X--- 162,168 ----
X  				   for cities				*/
X  #define FORTCOST	1000L	/* cost to build a fort point		*/
X  #define STOCKCOST	3000L	/* cost to build a stockade		*/
X+ #define REBUILDCOST	3000L	/* cost to remove a ruin		*/
X  #define WARSHPCOST	20000L	/* cost to build one light warship	*/
X  #define MERSHPCOST	25000L	/* cost to build one light merchant	*/
X  #define GALSHPCOST	25000L	/* cost to build one light galley	*/
X*** odata.h	Wed Sep 20 21:40:54 1989
X--- data.h	Wed Sep 20 21:41:23 1989
X***************
X*** 18,23 ****
X--- 18,28 ----
X  #define	FALSE		0
X  #endif
X  
X+ /* definitions for mail sending */
X+ #define	DONEMAIL	(-3)
X+ #define	NEWSMAIL	(-2)
X+ #define	ABORTMAIL	(-1)
X+ 
X  /* definitions for screen redrawing */
X  #define	DONE	0
X  #define	PART	1
X***************
X*** 498,503 ****
X--- 503,509 ----
X  #define XNAGAL		30
X  #define XNAHOLD		31
X  #define NPOP		32
X+ #define XSACIV3	33
X  
X  #define	BRIBENATION fprintf(fm,"L_NGOLD\t%d\t%d\t%ld\t0\t%d\t%s\n",XBRIBE,country,bribecost,nation,"null");
X  #define	DESTROY fprintf(fexe,"DESTROY\t%d\t%d\t%hd\t0\t0\t%s\n",DESTRY,save,country,"null")
X***************
X*** 523,528 ****
X--- 529,535 ----
X  #define	SADJDES2	fprintf(fexe,"S_ADES\t%d\t%hd\t0\t%d\t%d\t%c\n",XSADES,country,x,y,sct[x][y].designation)
X  #define	SADJCIV2 fprintf(fexe,"S_ACIV\t%d\t%hd\t%ld\t%d\t%d\t%s\n",XSACIV,country,sct[i][j].people,i,j,"null")
X  #define	SADJCIV	fprintf(fexe,"S_ACIV\t%d\t%hd\t%ld\t%d\t%d\t%s\n",XSACIV,country,sct[xcurs+xoffset][ycurs+yoffset].people,xcurs+xoffset,ycurs+yoffset,"null")
X+ #define	SADJCIV3 fprintf(fexe,"S_ACIV3\t%d\t%hd\t%ld\t%d\t%d\t%s\n",XSACIV3,country,people_to_add,i,j,"null")
X  #define	INCFORT fprintf(fexe,"SIFORT\t%d\t%hd\t0\t%d\t%d\t%s\n",XSIFORT,country,xcurs+xoffset,ycurs+yoffset,"null")
X  #define	SADJOWN	fprintf(fexe,"S_AOWN\t%d\t%hd\t0\t%d\t%d\t%s\n",XSAOWN,country,xcurs+xoffset,ycurs+yoffset,"null")
X  #define	EADJDIP(a,b)	fprintf(fexe,"E_ADJ\t%d\t%hd\t%d\t%d\t0\t%s\n",EDADJ,a,b,ntn[a].dstatus[b],"null")
X***************
X*** 612,618 ****
X  
X  extern int	move_file(), land_2reachp(), land_reachp(), canbeseen();
X  extern int	water_reachp(), markok(), is_habitable(), parse();
X! extern int	units_in_sector(), num_powers(), tofood();
X  extern int	get_god(), flightcost(), todigit(), getclass(), startcost();
X  extern int	water_2reachp(),tg_ok(), readmap(), avian();
X  extern int	cbonus(), armymove(),takeover(),getnewname();
X--- 619,625 ----
X  
X  extern int	move_file(), land_2reachp(), land_reachp(), canbeseen();
X  extern int	water_reachp(), markok(), is_habitable(), parse();
X! extern int	units_in_sector(), num_powers(), tofood(), mailopen();
X  extern int	get_god(), flightcost(), todigit(), getclass(), startcost();
X  extern int	water_2reachp(),tg_ok(), readmap(), avian();
X  extern int	cbonus(), armymove(),takeover(),getnewname();
X***************
X*** 628,634 ****
X  extern struct	s_sector *rand_sector();
X  extern void	subgships(),submships(),subwships(),getspace(),sackem();
X  extern void	sleep(), whatcansee(), reset_god(), get_nname(), camp_info();
X! extern void	main(), makebottom(), makeside(), check_mail();
X  extern void	checkout(),copyscreen(),bye(),credits(),init_hasseen();
X  extern void	combinearmies(),change_status(),reducearmy(),splitarmy();
X  extern void	errormsg(), clear_bottom(), addgroup(),ext_cmd();
X--- 635,641 ----
X  extern struct	s_sector *rand_sector();
X  extern void	subgships(),submships(),subwships(),getspace(),sackem();
X  extern void	sleep(), whatcansee(), reset_god(), get_nname(), camp_info();
X! extern void	main(), makebottom(), makeside(), check_mail(), centermap();
X  extern void	checkout(),copyscreen(),bye(),credits(),init_hasseen();
X  extern void	combinearmies(),change_status(),reducearmy(),splitarmy();
X  extern void	errormsg(), clear_bottom(), addgroup(),ext_cmd();
X***************
X*** 635,642 ****
X  extern void	randomevent(), wdisaster(), weather(), deplete();
X  extern void	verify_ntn(), verify_sct(), verifydata(), prep();
X  extern void	errorbar(), newbye(), newreset(), newmsg(), newerror();
X! extern void	newinit();
X! extern void	destroy(), updmove(), spreadsheet(), mailopen(), mailclose();
X  extern void	updexecs(), updcapture(), updsectors();
X  extern void	updmil(), updcomodities(), updleader();
X  extern void	nationrun(), n_atpeace(), n_trespass(), n_people();
X--- 642,649 ----
X  extern void	randomevent(), wdisaster(), weather(), deplete();
X  extern void	verify_ntn(), verify_sct(), verifydata(), prep();
X  extern void	errorbar(), newbye(), newreset(), newmsg(), newerror();
X! extern void	newinit(), jump_to();
X! extern void	destroy(), updmove(), spreadsheet(), mailclose();
X  extern void	updexecs(), updcapture(), updsectors();
X  extern void	updmil(), updcomodities(), updleader();
X  extern void	nationrun(), n_atpeace(), n_trespass(), n_people();
X***************
X*** 653,659 ****
X  extern void	mymove(),navalcbt(),newdip(),newdisplay(),newlogin();
X  extern void	newspaper(),npcredes(),offmap(),place(),populate();
X  extern void	printele(),printnat(),printscore(),printveg();
X! extern void	pr_ntns(),produce();
X  extern void	readdata(),redesignate(),redomil(),reduce(),rmessage(),score();
X  extern void	see(),showscore(),update();
X  extern void	wmessage(),writedata(),getdstatus(),exit();
X--- 660,666 ----
X  extern void	mymove(),navalcbt(),newdip(),newdisplay(),newlogin();
X  extern void	newspaper(),npcredes(),offmap(),place(),populate();
X  extern void	printele(),printnat(),printscore(),printveg();
X! extern void	pr_ntns(),pr_desg(),produce();
X  extern void	readdata(),redesignate(),redomil(),reduce(),rmessage(),score();
X  extern void	see(),showscore(),update();
X  extern void	wmessage(),writedata(),getdstatus(),exit();
X*** oadmin.c	Wed Sep 20 21:40:53 1989
X--- admin.c	Wed Sep 20 21:41:23 1989
X***************
X*** 39,44 ****
X--- 39,47 ----
X  short	country=0;
X  struct	s_nation	*curntn;
X  extern char datadir[];
X+ #ifdef REMAKE
X+ int	remake=FALSE;
X+ #endif /*REMAKE*/
X  
X  FILE *fexe, *fopen();
X  
X***************
X*** 53,59 ****
X  	void srand();
X  	int getopt();
X  	long time();
X! 	/* mflag = makeworld, a=add player, x=execute, p=print */
X  	/* rflag = make world from read in files */
X  	int mflag, aflag, xflag, rflag;
X  	char string[FILELTH];
X--- 56,62 ----
X  	void srand();
X  	int getopt();
X  	long time();
X! 	/* mflag = make world, a=add player, x=execute, p=print */
X  	/* rflag = make world from read in files */
X  	int mflag, aflag, xflag, rflag;
X  	char string[FILELTH];
X***************
X*** 201,206 ****
X--- 204,212 ----
X  				printf(".\n");
X  				exit(FAIL);
X  			}
X+ #ifdef REMAKE
X+ 			remake=TRUE;
X+ #endif /*REMAKE*/
X  			printf("************* WARNING!!!! *******************\n\n");
X  			printf("    There is already a game in progress.\n\n");
X  			printf("*********************************************\n\n");
X***************
X*** 485,494 ****
X  		temp=1000*curntn->score/WORLDSCORE + 1000*curntn->tmil/WORLDMIL;
X  		curntn->power = min(temp/5,MAXTGVAL);
X  
X  		temp = curntn->tgold;
X  		if(temp<0) temp=0;
X! 		temp = 1000*temp/WORLDGOLD + 1000*curntn->jewels/WORLDJEWELS + 1000*curntn->metals/WORLDMETAL + cityfolk*5/3 + townfolk*5/6;
X! 		curntn->wealth = min( temp/10,MAXTGVAL );
X  
X  		if( TURN!= 1) {
X  		curntn->reputation += rand()%8-3;
X--- 491,505 ----
X  		temp=1000*curntn->score/WORLDSCORE + 1000*curntn->tmil/WORLDMIL;
X  		curntn->power = min(temp/5,MAXTGVAL);
X  
X+ 		/* calculate national wealth */
X  		temp = curntn->tgold;
X  		if(temp<0) temp=0;
X! 		temp = (long)(1000.0*temp/WORLDGOLD + 1000.0*curntn->jewels/WORLDJEWELS + 1000.0*curntn->metals/WORLDMETAL) + cityfolk*5/3 + townfolk*5/6;
X! 		if (temp >= curntn->wealth) {
X! 			curntn->wealth = min( temp/10,MAXTGVAL );
X! 		} else {
X! 			curntn->wealth -= (curntn->wealth - temp)/4;
SHAR_EOF
echo "End of part 1, continue with part 2"
echo "2" > s2_seq_.tmp
exit 0