Skip to content

Commit d45f660

Browse files
committed
fixes
1 parent 1735bc6 commit d45f660

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

code/missioneditor/missionsave.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ void Fred_mission_save::convert_special_tags_to_retail()
168168
}
169169
}
170170

171-
int Fred_mission_save::fout(char* format, ...)
171+
int Fred_mission_save::fout(const char* format, ...)
172172
{
173173
// don't output anything if we're saving in retail and have version-specific comments active
174174
if (save_config.save_format == MissionFormat::RETAIL && !fso_ver_comment.empty()) {
@@ -190,7 +190,7 @@ int Fred_mission_save::fout(char* format, ...)
190190
return 0;
191191
}
192192

193-
int Fred_mission_save::fout_ext(char* pre_str, char* format, ...)
193+
int Fred_mission_save::fout_ext(const char* pre_str, const char* format, ...)
194194
{
195195
// don't output anything if we're saving in retail and have version-specific comments active
196196
if (save_config.save_format == MissionFormat::RETAIL && !fso_ver_comment.empty()) {
@@ -298,7 +298,7 @@ int Fred_mission_save::fout_ext(char* pre_str, char* format, ...)
298298
return 0;
299299
}
300300

301-
int Fred_mission_save::fout_version(char* format, ...)
301+
int Fred_mission_save::fout_version(const char* format, ...)
302302
{
303303
SCP_string str_scp;
304304
char* ch = NULL;
@@ -563,7 +563,8 @@ void Fred_mission_save::parse_comments(int newlines)
563563

564564
void Fred_mission_save::save_ai_goals(ai_goal* goalp, int ship)
565565
{
566-
char *str = NULL, buf[80];
566+
const char* str = NULL;
567+
char buf[80];
567568
int i, valid, flag = 1;
568569

569570
for (i = 0; i < MAX_AI_GOALS; i++) {
@@ -1389,7 +1390,7 @@ int Fred_mission_save::save_cmd_briefs()
13891390
return err;
13901391
}
13911392

1392-
void Fred_mission_save::fso_comment_push(char* ver)
1393+
void Fred_mission_save::fso_comment_push(const char* ver)
13931394
{
13941395
if (fso_ver_comment.empty()) {
13951396
fso_ver_comment.push_back(SCP_string(ver));
@@ -1406,7 +1407,7 @@ void Fred_mission_save::fso_comment_push(char* ver)
14061407
elem2 = scan_fso_version_string(ver, &in_major, &in_minor, &in_build, &in_revis);
14071408

14081409
// check consistency
1409-
if (elem1 == 3 && elem2 == 4 || elem1 == 4 && elem2 == 3) {
1410+
if ((elem1 == 3 && elem2 == 4) || (elem1 == 4 && elem2 == 3)) {
14101411
elem1 = elem2 = 3;
14111412
} else if ((elem1 >= 3 && elem2 >= 3) && (revis < 1000 || in_revis < 1000)) {
14121413
elem1 = elem2 = 3;
@@ -2437,7 +2438,9 @@ int Fred_mission_save::save_mission_file(const char* pathname)
24372438
*ext_ch = 0;
24382439

24392440
strcat_s(backup_name, ".bak");
2441+
#ifdef _WIN32
24402442
cf_attrib(pathname, 0, FILE_ATTRIBUTE_READONLY, CF_TYPE_MISSIONS);
2443+
#endif
24412444
cf_delete(backup_name, CF_TYPE_MISSIONS);
24422445
cf_rename(pathname, backup_name, CF_TYPE_MISSIONS);
24432446
cf_rename(savepath, pathname, CF_TYPE_MISSIONS);
@@ -4836,7 +4839,7 @@ int Fred_mission_save::save_waypoint_list(const waypoint_list* wp_list)
48364839
int Fred_mission_save::save_wings()
48374840
{
48384841
SCP_string sexp_out;
4839-
int i, j, z, ship, count = 0;
4842+
int i, j, z, count = 0;
48404843

48414844
fred_parse_flag = 0;
48424845
required_string_fred("#Wings");
@@ -5019,7 +5022,7 @@ int Fred_mission_save::save_wings()
50195022
fout(" (\t\t;! %d total\n", Wings[i].wave_count);
50205023

50215024
for (j = 0; j < Wings[i].wave_count; j++) {
5022-
ship = Wings[i].ship_index[j];
5025+
//ship = Wings[i].ship_index[j];
50235026
// if (Objects[Ships[ship].objnum].type == OBJ_START)
50245027
// fout("\t\"Player 1\"\n");
50255028
// else

code/missioneditor/missionsave.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class Fred_mission_save {
122122
*
123123
* @see scan_fso_version_string()
124124
*/
125-
void fso_comment_push(char* ver);
125+
void fso_comment_push(const char* ver);
126126

127127
/**
128128
* @brief Saves comments from previous campaign/mission file
@@ -137,7 +137,7 @@ class Fred_mission_save {
137137
*
138138
* @see printf() for formatting
139139
*/
140-
int fout(char* format, ...);
140+
int fout(const char* format, ...);
141141

142142
/**
143143
* @brief Puts the given string as an XSTR() into the file
@@ -148,15 +148,15 @@ class Fred_mission_save {
148148
*
149149
* @TODO verify
150150
*/
151-
int fout_ext(char* pre_str, char* format, ...);
151+
int fout_ext(const char* pre_str, const char* format, ...);
152152

153153
/**
154154
* @brief Puts the given version string into the file
155155
*
156156
* @param[in] format
157157
* @param[in] ...
158158
*/
159-
int fout_version(char* format, ...);
159+
int fout_version(const char* format, ...);
160160

161161
private:
162162

0 commit comments

Comments
 (0)