comparison xrogue/save.c @ 206:a3d90e31a001

XRogue: add and use more md_ functions. Portable md_fileno() and md_unlink() have been added to state.c.
author John "Elwin" Edwards
date Thu, 13 Aug 2015 15:15:21 -0400
parents 6e6fb0955095
children f54901b9c39b
comparison
equal deleted inserted replaced
205:6e6fb0955095 206:a3d90e31a001
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 int md_unlink(char *file);
35
34 bool 36 bool
35 save_game() 37 save_game()
36 { 38 {
37 register FILE *savef; 39 register FILE *savef;
38 register int c; 40 register int c;
93 * write out encrpyted file 95 * write out encrpyted file
94 */ 96 */
95 if (save_file(savef) == FALSE) { 97 if (save_file(savef) == FALSE) {
96 fclose(savef); 98 fclose(savef);
97 msg("Cannot create save file."); 99 msg("Cannot create save file.");
98 unlink(file_name); 100 md_unlink(file_name);
99 return(FALSE); 101 return(FALSE);
100 } 102 }
101 fclose(savef); 103 fclose(savef);
102 return(TRUE); 104 return(TRUE);
103 } 105 }
223 } 225 }
224 226
225 close(inf); 227 close(inf);
226 228
227 if (!wizard) 229 if (!wizard)
228 unlink(file); 230 md_unlink(file);
229 231
230 mpos = 0; 232 mpos = 0;
231 environ = envp; 233 environ = envp;
232 strcpy(file_name, file); 234 strcpy(file_name, file);
233 clearok(curscr, TRUE); 235 clearok(curscr, TRUE);