home *** CD-ROM | disk | FTP | other *** search
/ The Best of Select: Games 3 / cd.iso / cheat / zone66 / z66cht.c next >
C/C++ Source or Header  |  1993-03-14  |  1KB  |  46 lines

  1. #include <io.h>
  2. #include <stdio.h>
  3. #include <fcntl.h>
  4. #include <dos.h>
  5.  
  6. #define uchar unsigned char
  7.  
  8. typedef struct
  9. {
  10.     char    padding[36];
  11.     uchar   payload;
  12.     uchar   fuel;
  13.     uchar   armor;
  14.     uchar   topspeed;
  15.     uchar   accel;
  16.     uchar   turning;
  17.  
  18. } SHIPDAT0;
  19.  
  20. void main( void )
  21. {
  22.     int handle;
  23.     SHIPDAT0 sdat;
  24.  
  25.     /* This is a fake file to screw us over. */
  26.     remove( "SHIPDAT0.Z66" );
  27.  
  28.     /* Real stats are stored here. */
  29.     handle = open( "MAPADAT3.Z66", O_BINARY | O_RDWR );
  30.     lseek( handle, 1423L, SEEK_SET );
  31.     _read( handle, &sdat, sizeof sdat );
  32.     lseek( handle, 1423L, SEEK_SET );
  33.  
  34.     sdat.payload = 255;         /* Max, because uchars are used. */
  35.     sdat.fuel = 120;            /* Bleah.  You guess. */
  36.     sdat.accel = 1;             /* 0 = EXCELLENT, 4 = POOR */
  37.     sdat.turning = 1;           /* Ditto */
  38.     sdat.topspeed = 7;          /* DON'T GO OVER 7! */
  39.     sdat.armor = 120;           /* Doesn't really work */
  40.  
  41.     _write( handle, &sdat, sizeof sdat );
  42.     close( handle );
  43.  
  44.     puts( "Patch done!" );
  45. }
  46.