Mercurial > hg > early-roguelike
comparison xrogue/save.c @ 225:4f6e056438eb
Merge the GCC5 and build fix branches.
| author | John "Elwin" Edwards | 
|---|---|
| date | Wed, 02 Mar 2016 21:28:34 -0500 | 
| parents | f54901b9c39b | 
| children | d3968e9cb98d | 
   comparison
  equal
  deleted
  inserted
  replaced
| 224:4d0f53998e8a | 225:4f6e056438eb | 
|---|---|
| 29 | 29 | 
| 30 extern char version[]; | 30 extern char version[]; | 
| 31 extern unsigned char encstr[]; | 31 extern unsigned char encstr[]; | 
| 32 extern int big_endian; | 32 extern int big_endian; | 
| 33 | 33 | 
| 34 bool rs_write_int(FILE *savef, int c); | |
| 35 bool rs_read_int(int inf, int *i); | |
| 36 bool rs_save_file(FILE *savef); | |
| 37 bool rs_restore_file(int inf); | |
| 38 | |
| 34 int md_unlink(char *file); | 39 int md_unlink(char *file); | 
| 40 bool save_file(FILE *savef); | |
| 35 | 41 | 
| 36 bool | 42 bool | 
| 37 save_game() | 43 save_game(void) | 
| 38 { | 44 { | 
| 39 register FILE *savef; | 45 register FILE *savef; | 
| 40 register int c; | 46 register int c; | 
| 41 char buf[LINELEN]; | 47 char buf[LINELEN]; | 
| 42 | 48 | 
| 127 /* | 133 /* | 
| 128 * write the saved game on the file | 134 * write the saved game on the file | 
| 129 */ | 135 */ | 
| 130 | 136 | 
| 131 bool | 137 bool | 
| 132 save_file(savef) | 138 save_file(FILE *savef) | 
| 133 register FILE *savef; | |
| 134 { | 139 { | 
| 135 int slines = LINES; | 140 int slines = LINES; | 
| 136 int scols = COLS; | 141 int scols = COLS; | 
| 137 int ret = FALSE; | 142 bool ret = FALSE; | 
| 138 int endian = 0x01020304; | 143 int endian = 0x01020304; | 
| 139 big_endian = ( *((char *)&endian) == 0x01 ); | 144 big_endian = ( *((char *)&endian) == 0x01 ); | 
| 140 | 145 | 
| 141 wmove(cw, LINES-1, 0); | 146 wmove(cw, LINES-1, 0); | 
| 142 draw(cw); | 147 draw(cw); | 
| 148 ret = rs_save_file(savef); | 153 ret = rs_save_file(savef); | 
| 149 | 154 | 
| 150 return(ret); | 155 return(ret); | 
| 151 } | 156 } | 
| 152 | 157 | 
| 153 restore(file, envp) | 158 bool | 
| 154 register char *file; | 159 restore(char *file, char *envp[]) | 
| 155 char **envp; | |
| 156 { | 160 { | 
| 157 register int inf; | 161 register int inf; | 
| 158 extern char **environ; | 162 extern char **environ; | 
| 159 char buf[LINELEN]; | 163 char buf[LINELEN]; | 
| 160 int endian = 0x01020304; | 164 int endian = 0x01020304; | 
| 249 /* | 253 /* | 
| 250 * perform an encrypted write | 254 * perform an encrypted write | 
| 251 */ | 255 */ | 
| 252 | 256 | 
| 253 long | 257 long | 
| 254 encwrite(start, size, outf) | 258 encwrite(char *start, unsigned long size, FILE *outf) | 
| 255 register char *start; | |
| 256 register unsigned long size; | |
| 257 register FILE *outf; | |
| 258 { | 259 { | 
| 259 register unsigned char *ep; | 260 register unsigned char *ep; | 
| 260 register int i = 0; | 261 register int i = 0; | 
| 261 unsigned long num_written = 0; | 262 unsigned long num_written = 0; | 
| 262 char buf[ENCWBSIZ]; | 263 char buf[ENCWBSIZ]; | 
| 290 /* | 291 /* | 
| 291 * perform an encrypted read | 292 * perform an encrypted read | 
| 292 */ | 293 */ | 
| 293 | 294 | 
| 294 long | 295 long | 
| 295 encread(start, size, inf) | 296 encread(char *start, unsigned long size, int inf) | 
| 296 register char *start; | |
| 297 register unsigned long size; | |
| 298 int inf; | |
| 299 { | 297 { | 
| 300 register unsigned char *ep; | 298 register unsigned char *ep; | 
| 301 register int rd_siz; | 299 register int rd_siz; | 
| 302 register unsigned long total_read; | 300 register unsigned long total_read; | 
| 303 | 301 | 
