[comp.sources.games.bugs] Conquer bug fixes

mcgillis@spp2.UUCP (Jack McGillis) (02/13/88)

This patch corrects the following problems:

	1) When a player tried to read messages that did not exist, the
	   messages:temp file was being retained.
	2) There are a number of file ownership problems.  We have solved
	   this by changing the program to setuid, "games" in our case.

Problems that we know about are:

	1) Messages are messed up.  Only one combatant gets a copy of the
	   message, this is frequently not the "right" player.  Nomad, for
	   example, always gets the message for a battle involving
	   nomads, even when the message is "addressed" to some other
	   country.  A fix would be to send messages to all players involved,
	   NPCs and rebels excluded.
	2) The rebel random event is causing problems.
		a) I have a country called "Filibustr". I got some rebels
		   whose name is also "Filibustr".  This effectively locked
                   me out of the game.  Fortunately god was able to fix it. 
		   The current 9-letter country name limit seems extreme.
		b) We have an NPC called "Warlak" that has been hit twice.
		   There are now two NPCs called "Warlak-re".  One is an
		   ally, the other declared war on me !  Looking at the
		   map you can't tell which is which !  This curse should
		   only be applied (at most) once to a country (or its
		   rebels).

Things that sound like good ideas:

	1) Base the coordinate system on the players capital (a la Empire).  
	   As it is now, you know exactly where you are in the world (and where
	   the other players are, because of news reports).
	2) Change the markers so that they are consistent.  Maybe something
	   like:
		Upper case  - nation marks
		Lower case  - sector designations
		Other       - terrain 
	3) Allow trade.  


*** Makefile	Fri Feb 12 11:54:41 1988
--- Makefile.old	Fri Feb 12 11:55:44 1988
***************
*** 1,8 ****
! #	MODIFICATION OF THIS FILE COMMITS THE MODIFIER TO FOLLOW THE
  #	THE LIMITED USE CONTRACT CONTAINED IN THE FILE "header.h"
- 
- #		This must be installed by "games" or by "root"
- 
  MAKE	= /bin/make
  CC	= /bin/cc
  CFLAGS	= -O
--- 1,5 ----
! #	MODIFICATION OF THIS FILE COMITS THE MODIFIER TO FOLLOW THE
  #	THE LIMITED USE CONTRACT CONTAINED IN THE FILE "header.h"
  MAKE	= /bin/make
  CC	= /bin/cc
  CFLAGS	= -O
***************
*** 23,32 ****
  #	Multiple games are now supported.  Each should have its own directory.
  DATA = /usr/local/games/lib/conquer
  
! OBJ= combat.o commands.o cexecute.o forms.o io.o main.o makeworld.o move.o \
!      newlogin.o update.o magic.o npc.o reports.o misc.o randevent.o 
! FILS=combat.c commands.c cexecute.c forms.c io.c main.c makeworld.c move.c \
!      newlogin.c update.c magic.c npc.c reports.c misc.c randevent.c 
  HEADERS=header.h data.h
  SUPT1=nations Makefile help README run man.page
  SUPT2=execute messages news
--- 20,27 ----
  #	Multiple games are now supported.  Each should have its own directory.
  DATA = /usr/local/games/lib/conquer
  
! OBJ=combat.o commands.o cexecute.o forms.o io.o main.o makeworld.o move.o newlogin.o update.o magic.o npc.o reports.o misc.o randevent.o 
! FILS=combat.c commands.c cexecute.c forms.c io.c main.c makeworld.c move.c newlogin.c update.c magic.c npc.c reports.c misc.c randevent.c 
  HEADERS=header.h data.h
  SUPT1=nations Makefile help README run man.page
  SUPT2=execute messages news
***************
*** 40,76 ****
  	@echo Note that this version expects each game to have a separate data 
  	@echo directory - please see documentation. Have Fun.
  
! $(OBJ): $(HEADERS)
  
  clobber:
! 	- $(RM) shar1 shar2 shar3 *.o conquer .data core
! 	- $(RM) $(DATA)/conq.* $(EXECUTABLE)/conquer 
  
  clean:
! 	- $(RM) shar1 shar2 shar3 *.o core
  
! install: all
! 	- etc/chown games conquer
! 	chmod 4755 conquer
! 	- mkdir $(EXECUTABLE)
! 	- mkdir $(DATA)
! 	install -s conquer $(EXECUTABLE)
! 	cp help $(DATA)
! 	cp nations $(DATA)
! 	cp run $(DATA)
! 	chmod 777 $(DATA)
  	conquer -d$(DATA) -m
  	chmod 0700 $(DATA)/run
  	chmod 0644 $(DATA)/help $(DATA)/news 
  
  lint:
! 	lint -hvac $(FILS) 
  
  docs:
  	sed -e "s/^END//g" help | pr
  
  cpio:
! 	- $(RM) core
  	find . -name '*[CrpsEech]' -print | cpio -ocBv > cpiosv
  
  shar:	$(FILS)
--- 35,78 ----
  	@echo Note that this version expects each game to have a separate data 
  	@echo directory - please see documentation. Have Fun.
  
! $(OBJ): data.h  
  
+ $(OBJ): header.h  
+ 
  clobber:
! 	$(RM) shar1 shar2 shar3 *.o conquer .data core
! 	$(RM) $(DATA)/conq.* $(EXECUTABLE)/conquer 
  
  clean:
! 	$(RM) shar1 shar2 shar3 *.o core
  
! install:
! 	-if test -d $(EXECUTABLE) ; \
! 	then echo "EXECUTABLE DIRECTORY OK" ; \
! 	else mkdir $(EXECUTABLE) ; \
! 	fi 
! 	-if test -d $(DATA) ; \
! 	then echo "DATA DIRECTORY OK" ; \
! 	else mkdir $(DATA) ; \
! 	fi 
! 	cp conquer $(EXECUTABLE)/conquer
! 	cp help $(DATA)/help
! 	cp nations $(DATA)/nations
! 	cp run $(DATA)/run
! 	touch $(DATA)/news
! 	chmod 0777 $(DATA)
  	conquer -d$(DATA) -m
  	chmod 0700 $(DATA)/run
  	chmod 0644 $(DATA)/help $(DATA)/news 
  
  lint:
! 	lint -u $(FILS) 
  
  docs:
  	sed -e "s/^END//g" help | pr
  
  cpio:
! 	$(RM) core
  	find . -name '*[CrpsEech]' -print | cpio -ocBv > cpiosv
  
  shar:	$(FILS)
***************
*** 86,95 ****
  	mv shar.out shar5
  
  rmshar:
! 	- $(RM) shar1
! 	- $(RM) shar2
! 	- $(RM) shar3
! 	- $(RM) shar4
! 	- $(RM) shar5
! 
! 
--- 88,95 ----
  	mv shar.out shar5
  
  rmshar:
! 	$(RM) shar1
! 	$(RM) shar2
! 	$(RM) shar3
! 	$(RM) shar4
! 	$(RM) shar5
*** commands.c	Tue Feb  9 15:48:13 1988
--- commands.c.old	Fri Feb 12 11:56:03 1988
***************
*** 519,527 ****
  /* then move temp to msgfile*/
  rmessage()
  {
- 
-         int  unlink () ;
- 
  	FILE *mesgfp;
  	FILE *fptemp;
  	int i;
--- 519,524 ----
***************
*** 545,551 ****
  
  	sprintf(mesgfile,"%s%d",msgfile,country);
  	if ((mesgfp=fopen(mesgfile,"r"))==NULL) {
- 	        (void) unlink (tempfile) ;
  		mvprintw(0,0,"no messages in %s, hit return",mesgfile);
  		refresh();
  		getch();
--- 542,547 ----
*** main.c	Tue Feb  9 17:51:09 1988
--- main.c.old	Fri Feb 12 11:56:15 1988
***************
*** 76,86 ****
  int argc;
  char **argv;
  {
- 
-         int geteuid () ;
-         int getuid () ;
-         int setuid () ;
- 
  	register int i;
  	char *name;
  	void srand();
--- 76,81 ----
***************
*** 190,196 ****
  		printscore();
  		exit(0);
  	} else if (xflag) {	/* update the game */
! 		uid=getuid();  /* use the *real* uid */
  		if ( uid != (getpwnam(LOGIN))->pw_uid ){
  			printf("sorry -- your uid is invalid for updating\n");
  			printf("you need to be logged in as %s\n",LOGIN);
--- 185,191 ----
  		printscore();
  		exit(0);
  	} else if (xflag) {	/* update the game */
! 		uid=geteuid();
  		if ( uid != (getpwnam(LOGIN))->pw_uid ){
  			printf("sorry -- your uid is invalid for updating\n");
  			printf("you need to be logged in as %s\n",LOGIN);
***************
*** 200,214 ****
  		writedata();
  		exit(1);
  	}
- 
- 
-         /*
-          *  Set the real uid to the effective.  This will avoid a
-          *  number of problems involving file protection if the
-          *  executable is setuid.
-          */
- 
-         (void) setuid (geteuid ()) ;
  
  	/* must be a normal interactive game */
  	armornvy=AORN;
--- 195,200 ----
-- 
   Jack McGillis
	...!trwrb!trwspp!spp2!mcgillis