[comp.sources.games] v12i067: larn2 - dungeon type adventure game

billr@saab.CNA.TEK.COM (Bill Randle) (05/15/91)

Submitted-by: routley@tle.ENET.DEC.COM (Kevin Routley)
Posting-number: Volume 12, Issue 67
Archive-name: larn2/Patch1
Patch-To: larn2: Volume 12, Issue 54-65
Environment: Unix, VMS, MS-DOS, OS/2, termcap



#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  patches01
# Wrapped by billr@saab on Tue May 14 15:50:41 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'patches01' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'patches01'\"
else
echo shar: Extracting \"'patches01'\" \(11173 characters\)
sed "s/^X//" >'patches01' <<'END_OF_FILE'
X
X*** patchlog.org Mon May 13 21:26:38 1991
X--- patchlog    Mon May 13 21:24:36 1991
X***************
X*** 0 ****
X--- 1,16 ----
X+ Patch 1
X+ =======
X+
X+ Prompted by Pat Ryan, fix a bug in the dropobj() code in main.c that
X+ allowed the player to drop a negative amount of gold.  In the process, fix
X+ the backwards carriage return logic when printing the error response.
X+
X+ Document the new SIG_RETURNS_INT #define introduced by Bill Randle when the
X+ software was posted.
X+
X+ Prompted by Lasse Oestergaard, guard against out-of-bound array references
X+ in movem.c when on the Home level.  Also fixed a bug where a 'smart' monster
X+ would fail to move towards the player when the player was on the boundary.
X+
X+ Prompted by Mitch Gorman, make the EXTRA #define compile and work under
X+ MS-DOS.
X*** patchlev.org    Sat Mar 23 14:08:52 1991
X--- patchlev.h  Mon May 13 21:17:10 1991
X***************
X*** 1,3 ****
X  /* indicate which patches have been applied to Larn.
X  */
X! #define PATCHLEVEL 0
X--- 1,3 ----
X  /* indicate which patches have been applied to Larn.
X  */
X! #define PATCHLEVEL 1
X*** config.org  Sat Jul 07 13:58:52 1990
X--- config.c    Mon May 13 20:32:26 1991
X***************
X*** 73,78 ****
X--- 73,81 ----
X  char ckpfile[PATHLEN];
X  char swapfile[PATHLEN];
X  char larndir[DIRLEN]        = LARNHOME;
X+ # ifdef EXTRA
X+ char diagfile[PATHLEN];        /* the diagnostic filename  */
X+ # endif
X  #   else
X  char savefilename[PATHLEN]  = LARNHOME;
X  char scorefile[PATHLEN]     = LARNHOME;
X*** diag.org    Sat Jul 07 13:47:32 1990
X--- diag.c  Mon May 13 20:32:16 1991
X***************
X*** 24,29 ****
X--- 24,31 ----
X  extern int rmst,maxitm,lasttime;
X  extern char nosignal;
X  
X+ #define max( _a, _b ) (( _a > _b ) ? _a : _b )
X+ 
X  /*
X      ***************************
X      DIAG -- dungeon diagnostics
X***************
X*** 124,129 ****
X--- 126,133 ----
X      lcreat((char*)0);       lprcat("Done Diagnosing . . .");
X      return(0);
X      }
X+ 
X+ #ifndef MSDOS
X  /*
X      subroutine to count the number of occurrences of an object
X   */
X***************
X*** 139,144 ****
X--- 143,149 ----
X                  if (cell[(long) p*MAXX*MAXY+i*MAXY+j].item == l) k++;
X      return(k);
X      }
X+ #endif
X  
X  /*
X      subroutine to draw the whole screen as the player knows it
X*** header.org  Mon Dec 24 14:10:10 1990
X--- header.h    Mon May 13 20:31:28 1991
X***************
X*** 22,27 ****
X--- 22,28 ----
X  #define FORTSNAME   "larn.ftn"
X  #define PLAYERIDS   "larn.pid"
X  #define HOLIFILE    "holidays"
X+ #define DIAGFILE    "Diagfile"
X  #ifdef MSDOS
X  #   define LARNOPTS "larn.opt"
X  #   define SAVEFILE "larn.sav"
X*** io.org  Tue Mar 26 14:39:08 1991
X--- io.c    Mon May 13 20:32:20 1991
X***************
X*** 57,62 ****
X--- 57,66 ----
X  #include "larndefs.h"
X  #include <ctype.h>
X
X+ #ifdef EXTRA
X+ # include "player.h"
X+ #endif
X+
X  #ifdef SYSV /* system III or system V */
X  # ifndef MSDOS
X  #   include <termio.h>
X*** main.org    Tue Mar 26 15:00:36 1991
X--- main.c  Mon May 13 20:32:22 1991
X***************
X*** 167,178 ****
X
X      /* Savefile and swapfile can be given explicitly as options
X       */
X!     if (!savefilename[0]) 
X          {
X          strcpy(savefilename, larndir);
X          strcat(savefilename, SAVEFILE);
X          }
X!     if (!swapfile[0]) 
X          {
X          strcpy(swapfile, larndir);
X          strcat(swapfile, SWAPFILE);
X--- 167,178 ----
X  
X      /* Savefile and swapfile can be given explicitly as options
X       */
X!     if (!savefilename[0])
X          {
X          strcpy(savefilename, larndir);
X          strcat(savefilename, SAVEFILE);
X          }
X!     if (!swapfile[0])
X          {
X          strcpy(swapfile, larndir);
X          strcat(swapfile, SWAPFILE);
X***************
X*** 184,193 ****
X      strcpy(fortfile, larndir);
X      strcpy(playerids, larndir);
X      strcpy(ckpfile, larndir);
X  
X  # else /* MSDOS */
X  
X!     if ((ptr = getenv("HOME")) == 0) 
X          ptr = ".";
X  #ifdef SAVEINHOME
X      /* save file name in home directory */
X--- 184,196 ----
X      strcpy(fortfile, larndir);
X      strcpy(playerids, larndir);
X      strcpy(ckpfile, larndir);
X+ #  ifdef EXTRA
X+     strcpy(diagfile,larndir);
X+ #  endif
X  
X  # else /* MSDOS */
X  
X!     if ((ptr = getenv("HOME")) == 0)
X          ptr = ".";
X  #ifdef SAVEINHOME
X      /* save file name in home directory */
X***************
X*** 220,225 ****
X--- 223,232 ----
X      strcat(holifile, HOLIFILE);     /* the holiday data file name */
X  # endif
X  
X+ # ifdef EXTRA
X+     strcat(diagfile, DIAGFILE);
X+ # endif
X+ 
X  #ifdef VT100
X  /*
X   *  check terminal type to avoid users who have not vt100 type terminals
X***************
X*** 1036,1049 ****
X      {
X      register int i;
X      register char *p;
X!     long amt;
X  
X      p = &item[playerx][playery];
X      while (1)
X          {
X!         if ((i = whatitem("drop"))=='\33')  
X          return;
X!     if (i=='*') 
X          {
X          i = showstr(TRUE);
X          cursors();
X--- 1043,1056 ----
X      {
X      register int i;
X      register char *p;
X!     unsigned long amt;
X  
X      p = &item[playerx][playery];
X      while (1)
X          {
X!         if ((i = whatitem("drop"))=='\33')
X          return;
X!     if (i=='*')
X          {
X          i = showstr(TRUE);
X          cursors();
X***************
X*** 1059,1065 ****
X                  if ((amt=readnum((long)c[GOLD])) == 0) return;
X                  if (amt>c[GOLD])
X                      {
X! #ifndef MSDOS
X              lprcat("\n");
X  #endif MSDOS
X              lprcat("You don't have that much!");
X--- 1066,1072 ----
X                  if ((amt=readnum((long)c[GOLD])) == 0) return;
X                  if (amt>c[GOLD])
X                      {
X! #ifdef MSDOS
X              lprcat("\n");
X  #endif MSDOS
X              lprcat("You don't have that much!");
X*** makefile.org    Sat Mar 23 19:09:40 1991
X--- makefile.pc   Mon May 13 21:15:22 1991
X***************
X*** 31,36 ****
X--- 31,38 ----
X  #   RFCMAIL       - mail messages are RFC822 conformant.  Must be used with
X  #                   MAIL above.
X  #   SAVEINHOME    - put save files in users HOME instead of LARNHOME (default)
X+ #   SIG_RETURNS_INT - define if signal() returns (int *)() instead of
X+ #                   (void *)()
X  #   SYSV          - use system III/V (instead of V7) type ioctl calls
X  #   TIMECHECK     - incorporates code to disable play during working hours (8-5)
X  #   UIDSCORE      - Define to use user id's to manage scoreboard.  Leaving this
X*** movem.org   Sat Mar 23 16:14:34 1991
X--- movem.c Mon May 13 18:03:26 1991
X***************
X*** 311,323 ****
X
X        /* test all spots around the current one being looked at.
X        */
X!       if ( ( curx >= xl && curx < xh ) &&
X!            ( cury >= yl && cury < yh ) )
X            {
X            for (z=1; z<9; z++)
X            {
X            tmpx = curx + diroffx[z] ;
X            tmpy = cury + diroffy[z] ;
X            if (screen[tmpx][tmpy] == 0 )
X                {
X                screen[tmpx][tmpy] = curdist + 1;
X--- 311,324 ----
X  
X        /* test all spots around the current one being looked at.
X        */
X!       if ( ( curx >= xl && curx <= xh ) &&
X!            ( cury >= yl && cury <= yh ) )
X            {
X            for (z=1; z<9; z++)
X            {
X            tmpx = curx + diroffx[z] ;
X            tmpy = cury + diroffy[z] ;
X+           vxy( &tmpx, &tmpy );
X            if (screen[tmpx][tmpy] == 0 )
X                {
X                screen[tmpx][tmpy] = curdist + 1;
X***************
X*** 448,453 ****
X--- 449,459 ----
X      xl=i-1;  yl=j-1;  xh=i+2;  yh=j+2;
X      if (i<playerx) xl++; else if (i>playerx) --xh;
X      if (j<playery) yl++; else if (j>playery) --yh;
X+ 
X+     if (xl < 0) xl = 0;
X+     if (yl < 0) yl = 0;
X+     if (xh > MAXX) xh = MAXX; /* MAXX OK; loop check below is <, not <= */
X+     if (yh > MAXY) yh = MAXY; /* MAXY OK; loop check below is <, not <= */
X  
X      /* check all spots in the range.  find the one that is closest to
X         the player.  if the monster is already next to the player, exit
X*** scores.org  Sun Mar 03 23:59:52 1991
X--- scores.c    Mon May 13 20:32:30 1991
X***************
X*** 72,78 ****
X--- 72,80 ----
X      long moves;         /* number of moves made by player                   */
X      short ac;           /* armor class of player                            */
X      short hp,hpmax;     /* players hitpoints                                */
X+ # ifndef MSDOS
X      short cputime;      /* cpu time needed in seconds                       */
X+ # endif
X      short killed,spused;/* monsters killed and spells cast                  */
X      short usage;        /* usage of the cpu in %                            */
X      short lev;          /* player level                                     */
X***************
X*** 511,519 ****
X--- 513,523 ----
X      register int f,win;
X      char ch,*mod;
X      long zzz,i;
X+ #ifndef MSDOS
X  # ifdef EXTRA
X      struct tms cputime;
X  # endif
X+ #endif
X      if (c[LIFEPROT]>0) /* if life protection */
X          {
X          switch((x>0) ? x : -x)
X***************
X*** 572,579 ****
X--- 576,585 ----
X          time(&zzz);   /* get cpu time -- write out score info */
X          logg.diedtime=zzz;
X  #ifdef EXTRA
X+ # ifndef MSDOS
X          times(&cputime);  /* get cpu time -- write out score info */
X          logg.cputime = i = (cputime.tms_utime + cputime.tms_stime)/60 + c[CPUTIME];
X+ # endif
X          logg.lev=c[LEVEL];          logg.ac=c[AC];
X          logg.hpmax=c[HPMAX];        logg.hp=c[HP];
X          logg.elapsedtime=(zzz-initialtime+59)/60;
X***************
X*** 645,653 ****
X  #ifdef EXTRA
X          if (logg.moves<=0) logg.moves=1;
X          lprintf("  Experience Level: %d,  AC: %d,  HP: %d/%d,  Elapsed Time: %d minutes\n",(long)(logg.lev),(long)(logg.ac),(long)(logg.hp),(long)(logg.hpmax),(long)(logg.elapsedtime));
X          lprintf("  CPU time used: %d seconds,  Machine usage: %d.%02d%%\n",(long)(logg.cputime),(long)(logg.usage/100),(long)(logg.usage%100));
X          lprintf("  BYTES in: %d, out: %d, moves: %d, deaths: %d, spells cast: %d\n",(long)(logg.bytin),(long)(logg.bytout),(long)(logg.moves),(long)(logg.killed),(long)(logg.spused));
X!         lprintf("  out bytes per move: %d,  time per move: %d ms\n",(long)(logg.bytout/logg.moves),(long)((logg.cputime*1000)/logg.moves));
X  #endif
X          }
X          lflush();  lrclose();  return;
X--- 651,665 ----
X  #ifdef EXTRA
X          if (logg.moves<=0) logg.moves=1;
X          lprintf("  Experience Level: %d,  AC: %d,  HP: %d/%d,  Elapsed Time: %d minutes\n",(long)(logg.lev),(long)(logg.ac),(long)(logg.hp),(long)(logg.hpmax),(long)(logg.elapsedtime));
X+ # ifndef MSDOS
X          lprintf("  CPU time used: %d seconds,  Machine usage: %d.%02d%%\n",(long)(logg.cputime),(long)(logg.usage/100),(long)(logg.usage%100));
X+ # endif
X          lprintf("  BYTES in: %d, out: %d, moves: %d, deaths: %d, spells cast: %d\n",(long)(logg.bytin),(long)(logg.bytout),(long)(logg.moves),(long)(logg.killed),(long)(logg.spused));
X!         lprintf("  out bytes per move: %d",(long)(logg.bytout/logg.moves));
X! # ifndef MSDOS
X!         lprintf(",  time per move: %d ms",(long)((logg.cputime*1000)/logg.moves));
X! # endif
X!         lprintf("\n");
X  #endif
X          }
X          lflush();  lrclose();  return;
X
END_OF_FILE
if test 11173 -ne `wc -c <'patches01'`; then
    echo shar: \"'patches01'\" unpacked with wrong size!
fi
# end of 'patches01'
fi
echo shar: End of shell archive.
exit 0