/ * BackupFile: Copy fname to a backup name if it already exists. * Return True iff successful. */
| 1040 | * Return True iff successful. |
| 1041 | */ |
| 1042 | Bool BackupFile(char *fname) |
| 1043 | { |
| 1044 | struct stat s; |
| 1045 | char bname[MAX_PATH]; |
| 1046 | |
| 1047 | // Do nothing if no file exists |
| 1048 | if (stat(fname, &s) == -1) |
| 1049 | return True; |
| 1050 | |
| 1051 | strcpy(bname, fname); |
| 1052 | strcat(bname, "~"); |
| 1053 | |
| 1054 | if (CopyFile(fname, bname, FALSE) == FALSE) |
| 1055 | { |
| 1056 | if (MessageBox(NULL, "Can't make backup room file.\nSave anyway?", "Warning", |
| 1057 | MB_YESNO | MB_DEFBUTTON2) == IDNO) |
| 1058 | return False; |
| 1059 | } |
| 1060 | return True; |
| 1061 | } |
| 1062 | /***************************************************************************/ |
| 1063 | /* |
| 1064 | * SetWallHeights: Fill in wall heights from adjacent sector heights. |