[comp.sources.bugs] Ogre patchs

jpochma@polyslo.UUCP (John H Pochmara) (07/29/87)

	These are patches to take care of the _doprint problem that
people have run into with ogre.

	John Pochmara

--- 
    ...!lll-crg --->!csustan -\                      | "A career is great, 
..!trwrb!csla34 --<            >->!polyslo!jpochma   | But you can't run your
      ...!ihnp4 --->!csun ----/                      | fingers through its 
                                                     | hair" -Graffiti 4/13/83

-=-=-=-=-=-=-=-= CUT HERE -=-=-=-=-=-=-=-=-=-=-=-= CUT HERE -=-=-=-=-=-=-=-=-=-=
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	attack.c.pat
#	init.c.pat
#	map.c.pat
#	ogre.h.pat
#	ogre.pat
#	ogrecom.c.pat
#	ogrestat.c.pat
#	resolve.c.pat
# This archive created: Wed Jul 29 08:24:51 1987
export PATH; PATH=/bin:$PATH
echo shar: extracting "'attack.c.pat'" '(1978 characters)'
if test -f 'attack.c.pat'
then
	echo shar: will not over-write existing file "'attack.c.pat'"
else
sed 's/^	X//' << \SHAR_EOF > 'attack.c.pat'
	X*** attack.c	Wed Jul 29 08:20:42 1987
	X--- attack.c.new	Wed Jul 29 08:19:08 1987
	X***************
	X*** 167,173
	X  
	X          case MAIN:
	X  
	X!             display_xy(18, 40, "%d/%d (%s)", allocated.main_bats, DEF_MAIN,
	X                  odd_str(allocated.main_bats, DEF_MAIN));
	X              break;
	X  
	X
	X--- 167,173 -----
	X  
	X          case MAIN:
	X  
	X!             DISPLAY_XY3(18, 40, "%d/%d (%s)", allocated.main_bats, DEF_MAIN,
	X                  odd_str(allocated.main_bats, DEF_MAIN));
	X              break;
	X  
	X***************
	X*** 173,179
	X  
	X          case SECONDARY:
	X  
	X!             display_xy(19, 40, "%d/%d (%s)", allocated.sec_bats, DEF_SECONDARY,
	X                  odd_str(allocated.sec_bats, DEF_SECONDARY));
	X              break;
	X  
	X
	X--- 173,179 -----
	X  
	X          case SECONDARY:
	X  
	X!             DISPLAY_XY3(19, 40, "%d/%d (%s)", allocated.sec_bats, DEF_SECONDARY,
	X                  odd_str(allocated.sec_bats, DEF_SECONDARY));
	X              break;
	X  
	X***************
	X*** 179,185
	X  
	X          case MISSILE:
	X  
	X!             display_xy(20, 40, "%s", odd_str(allocated.missiles, DEF_MISSILES));
	X              break;
	X  
	X          case AP:
	X
	X--- 179,185 -----
	X  
	X          case MISSILE:
	X  
	X!             DISPLAY_XY1(20, 40, "%s", odd_str(allocated.missiles, DEF_MISSILES));
	X              break;
	X  
	X          case AP:
	X***************
	X*** 184,190
	X  
	X          case AP:
	X  
	X!             display_xy(21, 40, "%s", odd_str(allocated.ap, DEF_AP));
	X              break;
	X  
	X          case TREAD:
	X
	X--- 184,190 -----
	X  
	X          case AP:
	X  
	X!             DISPLAY_XY1(21, 40, "%s", odd_str(allocated.ap, DEF_AP));
	X              break;
	X  
	X          case TREAD:
	X***************
	X*** 188,194
	X              break;
	X  
	X          case TREAD:
	X!             display_xy(22, 40, "1/1 (%d)", allocated.treads);
	X              break;
	X  
	X      }
	X
	X--- 188,194 -----
	X              break;
	X  
	X          case TREAD:
	X!             DISPLAY_XY1(22, 40, "1/1 (%d)", allocated.treads);
	X              break;
	X  
	X      }
SHAR_EOF
if test 1978 -ne "`wc -c < 'attack.c.pat'`"
then
	echo shar: error transmitting "'attack.c.pat'" '(should have been 1978 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'init.c.pat'" '(1078 characters)'
if test -f 'init.c.pat'
then
	echo shar: will not over-write existing file "'init.c.pat'"
else
sed 's/^	X//' << \SHAR_EOF > 'init.c.pat'
	X*** init.c	Wed Jul 29 08:20:45 1987
	X--- init.c.new	Wed Jul 29 08:19:08 1987
	X***************
	X*** 31,37
	X      cp_set = FALSE;
	X  
	X      while(armor_points > 0 || infantry_points > 0 || !cp_set) {
	X!         display(16, "left to place: %d armor, %d infantry%s",
	X              armor_points, infantry_points,
	X              (cp_set) ? "." : ", CP");
	X          getunit();
	X
	X--- 31,37 -----
	X      cp_set = FALSE;
	X  
	X      while(armor_points > 0 || infantry_points > 0 || !cp_set) {
	X!         DISPLAY3(16, "left to place: %d armor, %d infantry%s",
	X              armor_points, infantry_points,
	X              (cp_set) ? "." : ", CP");
	X          getunit();
	X***************
	X*** 222,228
	X              unit[i].defend = 0;
	X  	    j = 200 ;
	X  	    while (j > armor_points || j > 2 || j < 0) {
	X! 		display(17, "Movement points for CP? ", 0) ;
	X  		j = readchar() ;
	X  		j -= '0' ;
	X  		}
	X
	X--- 222,228 -----
	X              unit[i].defend = 0;
	X  	    j = 200 ;
	X  	    while (j > armor_points || j > 2 || j < 0) {
	X! 		DISPLAY0(17, "Movement points for CP? ", 0) ;
	X  		j = readchar() ;
	X  		j -= '0' ;
	X  		}
SHAR_EOF
if test 1078 -ne "`wc -c < 'init.c.pat'`"
then
	echo shar: error transmitting "'init.c.pat'" '(should have been 1078 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'map.c.pat'" '(3180 characters)'
if test -f 'map.c.pat'
then
	echo shar: will not over-write existing file "'map.c.pat'"
else
sed 's/^	X//' << \SHAR_EOF > 'map.c.pat'
	X*** map.c	Wed Jul 29 08:20:50 1987
	X--- map.c.new	Wed Jul 29 08:19:09 1987
	X***************
	X*** 310,316
	X      switch(unit[i].type) {
	X  
	X          case HOWITZER:
	X!             display(16, "%s howitzer (%d/%d D%d M%d)", action,
	X                  unit[i].attack, unit[i].range, 
	X                  unit[i].defend, unit[i].moves_left);
	X              break;
	X
	X--- 310,316 -----
	X      switch(unit[i].type) {
	X  
	X          case HOWITZER:
	X!             DISPLAY5(16, "%s howitzer (%d/%d D%d M%d)", action,
	X                  unit[i].attack, unit[i].range, 
	X                  unit[i].defend, unit[i].moves_left);
	X              break;
	X***************
	X*** 316,322
	X              break;
	X  
	X          case MSLTANK:
	X!             display(16, "%s missile tank (%d/%d D%d M%d)", action,
	X                  unit[i].attack, unit[i].range, 
	X                  unit[i].defend, unit[i].moves_left);
	X              break;
	X
	X--- 316,322 -----
	X              break;
	X  
	X          case MSLTANK:
	X!             DISPLAY5(16, "%s missile tank (%d/%d D%d M%d)", action,
	X                  unit[i].attack, unit[i].range, 
	X                  unit[i].defend, unit[i].moves_left);
	X              break;
	X***************
	X*** 322,328
	X              break;
	X  
	X          case GEV:
	X!             display(16, "%s GEV (%d/%d D%d M%d)", action,
	X                  unit[i].attack, unit[i].range, 
	X                  unit[i].defend, unit[i].moves_left);
	X              break;
	X
	X--- 322,328 -----
	X              break;
	X  
	X          case GEV:
	X!             DISPLAY5(16, "%s GEV (%d/%d D%d M%d)", action,
	X                  unit[i].attack, unit[i].range, 
	X                  unit[i].defend, unit[i].moves_left);
	X              break;
	X***************
	X*** 328,334
	X              break;
	X  
	X          case HVYTANK:
	X!             display(16, "%s heavy tank (%d/%d D%d M%d)", action,
	X                  unit[i].attack, unit[i].range, 
	X                  unit[i].defend, unit[i].moves_left);
	X              break;
	X
	X--- 328,334 -----
	X              break;
	X  
	X          case HVYTANK:
	X!             DISPLAY5(16, "%s heavy tank (%d/%d D%d M%d)", action,
	X                  unit[i].attack, unit[i].range, 
	X                  unit[i].defend, unit[i].moves_left);
	X              break;
	X***************
	X*** 334,340
	X              break;
	X  
	X          case INFANTRY:
	X!             display(16, "%s infantry (%d/%d D%d M%d)", action,
	X                  unit[i].attack, unit[i].range, 
	X                  unit[i].defend, unit[i].moves_left);
	X              break;
	X
	X--- 334,340 -----
	X              break;
	X  
	X          case INFANTRY:
	X!             DISPLAY5(16, "%s infantry (%d/%d D%d M%d)", action,
	X                  unit[i].attack, unit[i].range, 
	X                  unit[i].defend, unit[i].moves_left);
	X              break;
	X***************
	X*** 340,346
	X              break;
	X  
	X  	case CP:
	X! 	    display(16, "%s CP (%d/%d D%d M%d)", action,
	X                  unit[i].attack, unit[i].range, 
	X                  unit[i].defend, unit[i].moves_left);
	X  	    break;
	X
	X--- 340,346 -----
	X              break;
	X  
	X  	case CP:
	X! 	    DISPLAY5(16, "%s CP (%d/%d D%d M%d)", action,
	X                  unit[i].attack, unit[i].range, 
	X                  unit[i].defend, unit[i].moves_left);
	X  	    break;
SHAR_EOF
if test 3180 -ne "`wc -c < 'map.c.pat'`"
then
	echo shar: error transmitting "'map.c.pat'" '(should have been 3180 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'ogre.h.pat'" '(1134 characters)'
if test -f 'ogre.h.pat'
then
	echo shar: will not over-write existing file "'ogre.h.pat'"
else
sed 's/^	X//' << \SHAR_EOF > 'ogre.h.pat'
	X*** ogre.h	Wed Jul 29 08:20:54 1987
	X--- ogre.h.new	Wed Jul 29 08:19:10 1987
	X***************
	X*** 39,44
	X  #define HOWITZER    'H'
	X  #define INFANTRY    'I'
	X  
	X  
	X  /* unit statuses */
	X  #define OK          1
	X
	X--- 39,58 -----
	X  #define HOWITZER    'H'
	X  #define INFANTRY    'I'
	X  
	X+ /* display macros */
	X+ 
	X+ #define DISPLAY0(l,f)	movecur(l,0);printf(f)
	X+ #define DISPLAY1(l,f,ar)	movecur(l,0);printf(f,ar)
	X+ #define DISPLAY2(l,f,ar1,ar2)	movecur(l,0);printf(f,ar1,ar2)
	X+ #define DISPLAY3(l,f,ar1,ar2,ar3)	movecur(l,0);printf(f,ar1,ar2,ar3)
	X+ #define DISPLAY4(l,f,ar1,ar2,ar3,ar4)	movecur(l,0);printf(f,ar1,ar2,ar3,ar4)
	X+ #define DISPLAY5(l,f,ar1,ar2,ar3,ar4,ar5)	movecur(l,0);printf(f,ar1,ar2,ar3,ar4,ar5)
	X+ 
	X+ #define DISPLAY_XY1(l,c,f,ar)	movecur(l,c);printf(f,ar)
	X+ #define DISPLAY_XY2(l,c,f,ar1,ar2)	movecur(l,c);printf(f,ar1,ar2)
	X+ #define DISPLAY_XY3(l,c,f,ar1,ar2,ar3)	movecur(l,c);printf(f,ar1,ar2,ar3)
	X+ #define DISPLAY_XY4(l,c,f,ar1,ar2,ar3,ar4)	movecur(l,c);printf(f,ar1,ar2,ar3,ar4)
	X+ #define DISPLAY_XY5(l,c,f,ar1,ar2,ar3,ar4,ar5)	movecur(l,c);printf(f,ar1,ar2,ar3,ar4,ar5)
	X  
	X  /* unit statuses */
	X  #define OK          1
SHAR_EOF
if test 1134 -ne "`wc -c < 'ogre.h.pat'`"
then
	echo shar: error transmitting "'ogre.h.pat'" '(should have been 1134 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'ogre.pat'" '(0 character)'
if test -f 'ogre.pat'
then
	echo shar: will not over-write existing file "'ogre.pat'"
else
sed 's/^	X//' << \SHAR_EOF > 'ogre.pat'
SHAR_EOF
if test 0 -ne "`wc -c < 'ogre.pat'`"
then
	echo shar: error transmitting "'ogre.pat'" '(should have been 0 character)'
fi
fi # end of overwriting check
echo shar: extracting "'ogrecom.c.pat'" '(700 characters)'
if test -f 'ogrecom.c.pat'
then
	echo shar: will not over-write existing file "'ogrecom.c.pat'"
else
sed 's/^	X//' << \SHAR_EOF > 'ogrecom.c.pat'
	X*** ogrecom.c	Wed Jul 29 08:20:57 1987
	X--- ogrecom.c.new	Wed Jul 29 08:19:09 1987
	X***************
	X*** 314,320
	X      /* No point if the unit is already destroyed. */
	X      if(unit[target].status == DESTROYED) return;
	X  
	X!     display(16, "Ogre fires %s at unit at hex %d%d", weapon,
	X          unit[target].l_hex, unit[target].r_hex);
	X  
	X      movecur_hex(unit[target].l_hex, unit[target].r_hex);
	X
	X--- 314,320 -----
	X      /* No point if the unit is already destroyed. */
	X      if(unit[target].status == DESTROYED) return;
	X  
	X!     DISPLAY3(16, "Ogre fires %s at unit at hex %d%d", weapon,
	X          unit[target].l_hex, unit[target].r_hex);
	X  
	X      movecur_hex(unit[target].l_hex, unit[target].r_hex);
SHAR_EOF
if test 700 -ne "`wc -c < 'ogrecom.c.pat'`"
then
	echo shar: error transmitting "'ogrecom.c.pat'" '(should have been 700 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'ogrestat.c.pat'" '(4136 characters)'
if test -f 'ogrestat.c.pat'
then
	echo shar: will not over-write existing file "'ogrestat.c.pat'"
else
sed 's/^	X//' << \SHAR_EOF > 'ogrestat.c.pat'
	X*** ogrestat.c	Wed Jul 29 08:20:59 1987
	X--- ogrestat.c.new	Wed Jul 29 08:19:09 1987
	X***************
	X*** 19,27
	X                       1234567890123456789012345678901234567890       */
	X  
	X      if(redraw || last.main_bats != ogre.main_bats)
	X!         if(ogre.main_bats > 0)
	X!         display(18, "Main Batteries:      %d (4/3 D4)", ogre.main_bats);
	X!         else display(18, " ");
	X  
	X      if(redraw || last.sec_bats != ogre.sec_bats)
	X          if(ogre.sec_bats > 0)
	X
	X--- 19,27 -----
	X                       1234567890123456789012345678901234567890       */
	X  
	X      if(redraw || last.main_bats != ogre.main_bats)
	X!         if(ogre.main_bats > 0) {
	X!         DISPLAY1(18, "Main Batteries:      %d (4/3 D4)", ogre.main_bats);
	X!         } else {DISPLAY0(18, " ");}
	X  
	X      if(redraw || last.sec_bats != ogre.sec_bats)
	X          if(ogre.sec_bats > 0) {
	X***************
	X*** 24,32
	X          else display(18, " ");
	X  
	X      if(redraw || last.sec_bats != ogre.sec_bats)
	X!         if(ogre.sec_bats > 0)
	X!         display(19, "Secondary Batteries: %d (3/2 D3)", ogre.sec_bats);
	X!         else display(19, " ");
	X  
	X      if(redraw || last.missiles != ogre.missiles)
	X          if(ogre.missiles > 0)
	X
	X--- 24,32 -----
	X          } else {DISPLAY0(18, " ");}
	X  
	X      if(redraw || last.sec_bats != ogre.sec_bats)
	X!         if(ogre.sec_bats > 0) {
	X!         DISPLAY1(19, "Secondary Batteries: %d (3/2 D3)", ogre.sec_bats);
	X!         } else { DISPLAY0(19, " ");}
	X  
	X      if(redraw || last.missiles != ogre.missiles)
	X          if(ogre.missiles > 0) {
	X***************
	X*** 29,37
	X          else display(19, " ");
	X  
	X      if(redraw || last.missiles != ogre.missiles)
	X!         if(ogre.missiles > 0)
	X!         display(20, "Missiles:            %d (6/5 D3)", ogre.missiles);
	X!         else display(20, " ");
	X  
	X      if(redraw || last.ap != ogre.ap)
	X          if(ogre.ap > 0)
	X
	X--- 29,37 -----
	X          } else { DISPLAY0(19, " ");}
	X  
	X      if(redraw || last.missiles != ogre.missiles)
	X!         if(ogre.missiles > 0) {
	X!         DISPLAY1(20, "Missiles:            %d (6/5 D3)", ogre.missiles);
	X!         } else { DISPLAY0(20, " ");}
	X  
	X      if(redraw || last.ap != ogre.ap)
	X          if(ogre.ap > 0) {
	X***************
	X*** 34,42
	X          else display(20, " ");
	X  
	X      if(redraw || last.ap != ogre.ap)
	X!         if(ogre.ap > 0)
	X!         display(21, "Anti-personnel:     %2d (1/1 D1)", ogre.ap);
	X!         else display(21, " ");
	X  
	X      if(redraw || last.treads != ogre.treads)
	X          if(ogre.treads > 0)
	X
	X--- 34,42 -----
	X          } else { DISPLAY0(20, " ");}
	X  
	X      if(redraw || last.ap != ogre.ap)
	X!         if(ogre.ap > 0) {
	X!         DISPLAY1(21, "Anti-personnel:     %2d (1/1 D1)", ogre.ap);
	X!         } else { DISPLAY0(21, " ");} 
	X  
	X      if(redraw || last.treads != ogre.treads)
	X          if(ogre.treads > 0) {
	X***************
	X*** 39,47
	X          else display(21, " ");
	X  
	X      if(redraw || last.treads != ogre.treads)
	X!         if(ogre.treads > 0)
	X!         display(22, "Treads:             %2d (1/* D1)", ogre.treads);
	X!         else display(22, " ");
	X  
	X      if(redraw || last.movement != ogre.movement)
	X          display(23, "Movement:            %d", ogre.movement);
	X
	X--- 39,47 -----
	X          } else { DISPLAY0(21, " ");} 
	X  
	X      if(redraw || last.treads != ogre.treads)
	X!         if(ogre.treads > 0) {
	X!         DISPLAY1(22, "Treads:             %2d (1/* D1)", ogre.treads);
	X!         } else { DISPLAY0(22, " ");}
	X  
	X      if(redraw || last.movement != ogre.movement) {
	X          DISPLAY1(23, "Movement:            %d", ogre.movement);}
	X***************
	X*** 43,50
	X          display(22, "Treads:             %2d (1/* D1)", ogre.treads);
	X          else display(22, " ");
	X  
	X!     if(redraw || last.movement != ogre.movement)
	X!         display(23, "Movement:            %d", ogre.movement);
	X  
	X      copy(&last, &ogre, sizeof(last));
	X  
	X
	X--- 43,50 -----
	X          DISPLAY1(22, "Treads:             %2d (1/* D1)", ogre.treads);
	X          } else { DISPLAY0(22, " ");}
	X  
	X!     if(redraw || last.movement != ogre.movement) {
	X!         DISPLAY1(23, "Movement:            %d", ogre.movement);}
	X  
	X      copy(&last, &ogre, sizeof(last));
	X  
SHAR_EOF
if test 4136 -ne "`wc -c < 'ogrestat.c.pat'`"
then
	echo shar: error transmitting "'ogrestat.c.pat'" '(should have been 4136 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'resolve.c.pat'" '(502 characters)'
if test -f 'resolve.c.pat'
then
	echo shar: will not over-write existing file "'resolve.c.pat'"
else
sed 's/^	X//' << \SHAR_EOF > 'resolve.c.pat'
	X*** resolve.c	Wed Jul 29 08:21:00 1987
	X--- resolve.c.new	Wed Jul 29 08:19:09 1987
	X***************
	X*** 57,63
	X  OGRE *allocations;
	X  {
	X  
	X!     display(16, "Resolving..."); cycle();
	X  
	X      if(allocations -> missiles > 0) {
	X          if(crt[roll()][odds(allocations -> missiles, DEF_MISSILES)] ==
	X
	X--- 57,63 -----
	X  OGRE *allocations;
	X  {
	X  
	X!     DISPLAY0(16, "Resolving..."); cycle();
	X  
	X      if(allocations -> missiles > 0) {
	X          if(crt[roll()][odds(allocations -> missiles, DEF_MISSILES)] ==
SHAR_EOF
if test 502 -ne "`wc -c < 'resolve.c.pat'`"
then
	echo shar: error transmitting "'resolve.c.pat'" '(should have been 502 characters)'
fi
fi # end of overwriting check
#	End of shell archive
exit 0