Skip to content

Commit 42f70f7

Browse files
committed
fixes
1 parent 68e7519 commit 42f70f7

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++) {
@@ -1385,7 +1386,7 @@ int Fred_mission_save::save_cmd_briefs()
13851386
return err;
13861387
}
13871388

1388-
void Fred_mission_save::fso_comment_push(char* ver)
1389+
void Fred_mission_save::fso_comment_push(const char* ver)
13891390
{
13901391
if (fso_ver_comment.empty()) {
13911392
fso_ver_comment.push_back(SCP_string(ver));
@@ -1402,7 +1403,7 @@ void Fred_mission_save::fso_comment_push(char* ver)
14021403
elem2 = scan_fso_version_string(ver, &in_major, &in_minor, &in_build, &in_revis);
14031404

14041405
// check consistency
1405-
if (elem1 == 3 && elem2 == 4 || elem1 == 4 && elem2 == 3) {
1406+
if ((elem1 == 3 && elem2 == 4) || (elem1 == 4 && elem2 == 3)) {
14061407
elem1 = elem2 = 3;
14071408
} else if ((elem1 >= 3 && elem2 >= 3) && (revis < 1000 || in_revis < 1000)) {
14081409
elem1 = elem2 = 3;
@@ -2433,7 +2434,9 @@ int Fred_mission_save::save_mission_file(const char* pathname)
24332434
*ext_ch = 0;
24342435

24352436
strcat_s(backup_name, ".bak");
2437+
#ifdef _WIN32
24362438
cf_attrib(pathname, 0, FILE_ATTRIBUTE_READONLY, CF_TYPE_MISSIONS);
2439+
#endif
24372440
cf_delete(backup_name, CF_TYPE_MISSIONS);
24382441
cf_rename(pathname, backup_name, CF_TYPE_MISSIONS);
24392442
cf_rename(savepath, pathname, CF_TYPE_MISSIONS);
@@ -4832,7 +4835,7 @@ int Fred_mission_save::save_waypoint_list(const waypoint_list* wp_list)
48324835
int Fred_mission_save::save_wings()
48334836
{
48344837
SCP_string sexp_out;
4835-
int i, j, z, ship, count = 0;
4838+
int i, j, z, count = 0;
48364839

48374840
fred_parse_flag = 0;
48384841
required_string_fred("#Wings");
@@ -5015,7 +5018,7 @@ int Fred_mission_save::save_wings()
50155018
fout(" (\t\t;! %d total\n", Wings[i].wave_count);
50165019

50175020
for (j = 0; j < Wings[i].wave_count; j++) {
5018-
ship = Wings[i].ship_index[j];
5021+
//ship = Wings[i].ship_index[j];
50195022
// if (Objects[Ships[ship].objnum].type == OBJ_START)
50205023
// fout("\t\"Player 1\"\n");
50215024
// 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)