Skip to content

Commit 5cabad5

Browse files
committed
add missing guardian threshold and fix var name
1 parent df3f7f5 commit 5cabad5

File tree

1 file changed

+67
-54
lines changed

1 file changed

+67
-54
lines changed

code/missioneditor/missionsave.cpp

Lines changed: 67 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -3813,6 +3813,19 @@ int Fred_mission_save::save_objects()
38133813
fout(" %d", shipp->escort_priority);
38143814
}
38153815

3816+
// Custom Guardian Thrshold
3817+
if (save_config.save_format != MissionFormat::RETAIL) {
3818+
if (shipp->ship_guardian_threshold != 0) {
3819+
if (optional_string_fred("+Guardian Threshold:", "$Name:")) {
3820+
parse_comments();
3821+
} else {
3822+
fout("\n+Guardian Threshold:");
3823+
}
3824+
3825+
fout(" %d", shipp->ship_guardian_threshold);
3826+
}
3827+
}
3828+
38163829
// special explosions
38173830
if (save_config.save_format != MissionFormat::RETAIL) {
38183831
if (shipp->use_special_explosion) {
@@ -4837,77 +4850,77 @@ int Fred_mission_save::save_wings()
48374850
parse_comments(2);
48384851
fout("\t\t;! %d total", Num_wings);
48394852

4840-
for (auto& wing : Wings) {
4841-
if (!wing.wave_count)
4853+
for (auto& w : Wings) {
4854+
if (!w.wave_count)
48424855
continue;
48434856

48444857
count++;
48454858
required_string_either_fred("$Name:", "#Events");
48464859
required_string_fred("$Name:");
48474860
parse_comments(2);
4848-
fout(" %s", wing.name);
4861+
fout(" %s", w.name);
48494862

48504863
// squad logo - Goober5000
48514864
if (save_config.save_format != MissionFormat::RETAIL) {
4852-
if (strlen(wing.wing_squad_filename) > 0) //-V805
4865+
if (strlen(w.wing_squad_filename) > 0) //-V805
48534866
{
48544867
if (optional_string_fred("+Squad Logo:", "$Name:"))
48554868
parse_comments();
48564869
else
48574870
fout("\n+Squad Logo:");
48584871

4859-
fout(" %s", wing.wing_squad_filename);
4872+
fout(" %s", w.wing_squad_filename);
48604873
}
48614874
}
48624875

48634876
required_string_fred("$Waves:");
48644877
parse_comments();
4865-
fout(" %d", wing.num_waves);
4878+
fout(" %d", w.num_waves);
48664879

48674880
required_string_fred("$Wave Threshold:");
48684881
parse_comments();
4869-
fout(" %d", wing.threshold);
4882+
fout(" %d", w.threshold);
48704883

48714884
required_string_fred("$Special Ship:");
48724885
parse_comments();
4873-
fout(" %d\t\t;! %s", wing.special_ship, Ships[wing.ship_index[wing.special_ship]].ship_name);
4886+
fout(" %d\t\t;! %s", w.special_ship, Ships[w.ship_index[w.special_ship]].ship_name);
48744887

48754888
if (save_config.save_format != MissionFormat::RETAIL) {
4876-
if (wing.formation >= 0 && wing.formation < static_cast<int>(Wing_formations.size())) {
4889+
if (w.formation >= 0 && w.formation < static_cast<int>(Wing_formations.size())) {
48774890
if (optional_string_fred("+Formation:", "$Name:")) {
48784891
parse_comments();
48794892
} else {
48804893
fout("\n+Formation:");
48814894
}
4882-
fout(" %s", Wing_formations[wing.formation].name);
4895+
fout(" %s", Wing_formations[w.formation].name);
48834896
}
4884-
if (!fl_equal(wing.formation_scale, 1.0f, 0.001f)) {
4897+
if (!fl_equal(w.formation_scale, 1.0f, 0.001f)) {
48854898
if (optional_string_fred("+Formation Scale:", "$Name:")) {
48864899
parse_comments();
48874900
} else {
48884901
fout("\n+Formation Scale:");
48894902
}
4890-
fout(" %f", wing.formation_scale);
4903+
fout(" %f", w.formation_scale);
48914904
}
48924905
}
48934906

48944907
required_string_fred("$Arrival Location:");
48954908
parse_comments();
4896-
fout(" %s", Arrival_location_names[static_cast<int>(wing.arrival_location)]);
4909+
fout(" %s", Arrival_location_names[static_cast<int>(w.arrival_location)]);
48974910

4898-
if (wing.arrival_location != ArrivalLocation::AT_LOCATION) {
4911+
if (w.arrival_location != ArrivalLocation::AT_LOCATION) {
48994912
if (optional_string_fred("+Arrival Distance:", "$Name:"))
49004913
parse_comments();
49014914
else
49024915
fout("\n+Arrival Distance:");
49034916

4904-
fout(" %d", wing.arrival_distance);
4917+
fout(" %d", w.arrival_distance);
49054918
if (optional_string_fred("$Arrival Anchor:", "$Name:"))
49064919
parse_comments();
49074920
else
49084921
fout("\n$Arrival Anchor:");
49094922

4910-
int z = wing.arrival_anchor;
4923+
int z = w.arrival_anchor;
49114924
if (z < 0) {
49124925
fout(" <error>");
49134926
} else if (z & SPECIAL_ARRIVAL_ANCHOR_FLAG) {
@@ -4924,18 +4937,18 @@ int Fred_mission_save::save_wings()
49244937

49254938
// Goober5000
49264939
if (save_config.save_format != MissionFormat::RETAIL) {
4927-
if ((wing.arrival_location == ArrivalLocation::FROM_DOCK_BAY) && (wing.arrival_path_mask > 0)) {
4940+
if ((w.arrival_location == ArrivalLocation::FROM_DOCK_BAY) && (w.arrival_path_mask > 0)) {
49284941
int anchor_shipnum;
49294942
polymodel* pm;
49304943

4931-
anchor_shipnum = wing.arrival_anchor;
4944+
anchor_shipnum = w.arrival_anchor;
49324945
Assert(anchor_shipnum >= 0 && anchor_shipnum < MAX_SHIPS);
49334946

49344947
fout("\n+Arrival Paths: ( ");
49354948

49364949
pm = model_get(Ship_info[Ships[anchor_shipnum].ship_info_index].model_num);
49374950
for (auto n = 0; n < pm->ship_bay->num_paths; n++) {
4938-
if (wing.arrival_path_mask & (1 << n)) {
4951+
if (w.arrival_path_mask & (1 << n)) {
49394952
fout("\"%s\" ", pm->paths[pm->ship_bay->path_indexes[n]].name);
49404953
}
49414954
}
@@ -4944,48 +4957,48 @@ int Fred_mission_save::save_wings()
49444957
}
49454958
}
49464959

4947-
if (wing.arrival_delay) {
4960+
if (w.arrival_delay) {
49484961
if (optional_string_fred("+Arrival delay:", "$Name:"))
49494962
parse_comments();
49504963
else
49514964
fout("\n+Arrival delay:");
49524965

4953-
fout(" %d", wing.arrival_delay);
4966+
fout(" %d", w.arrival_delay);
49544967
}
49554968

49564969
required_string_fred("$Arrival Cue:");
49574970
parse_comments();
4958-
convert_sexp_to_string(sexp_out, wing.arrival_cue, SEXP_SAVE_MODE);
4971+
convert_sexp_to_string(sexp_out, w.arrival_cue, SEXP_SAVE_MODE);
49594972
fout(" %s", sexp_out.c_str());
49604973

49614974
required_string_fred("$Departure Location:");
49624975
parse_comments();
4963-
fout(" %s", Departure_location_names[static_cast<int>(wing.departure_location)]);
4976+
fout(" %s", Departure_location_names[static_cast<int>(w.departure_location)]);
49644977

4965-
if (wing.departure_location != DepartureLocation::AT_LOCATION) {
4978+
if (w.departure_location != DepartureLocation::AT_LOCATION) {
49664979
required_string_fred("$Departure Anchor:");
49674980
parse_comments();
49684981

4969-
if (wing.departure_anchor >= 0)
4970-
fout(" %s", Ships[wing.departure_anchor].ship_name);
4982+
if (w.departure_anchor >= 0)
4983+
fout(" %s", Ships[w.departure_anchor].ship_name);
49714984
else
49724985
fout(" <error>");
49734986
}
49744987

49754988
// Goober5000
49764989
if (save_config.save_format != MissionFormat::RETAIL) {
4977-
if ((wing.departure_location == DepartureLocation::TO_DOCK_BAY) && (wing.departure_path_mask > 0)) {
4990+
if ((w.departure_location == DepartureLocation::TO_DOCK_BAY) && (w.departure_path_mask > 0)) {
49784991
int anchor_shipnum;
49794992
polymodel* pm;
49804993

4981-
anchor_shipnum = wing.departure_anchor;
4994+
anchor_shipnum = w.departure_anchor;
49824995
Assert(anchor_shipnum >= 0 && anchor_shipnum < MAX_SHIPS);
49834996

49844997
fout("\n+Departure Paths: ( ");
49854998

49864999
pm = model_get(Ship_info[Ships[anchor_shipnum].ship_info_index].model_num);
49875000
for (auto n = 0; n < pm->ship_bay->num_paths; n++) {
4988-
if (wing.departure_path_mask & (1 << n)) {
5001+
if (w.departure_path_mask & (1 << n)) {
49895002
fout("\"%s\" ", pm->paths[pm->ship_bay->path_indexes[n]].name);
49905003
}
49915004
}
@@ -4994,43 +5007,43 @@ int Fred_mission_save::save_wings()
49945007
}
49955008
}
49965009

4997-
if (wing.departure_delay) {
5010+
if (w.departure_delay) {
49985011
if (optional_string_fred("+Departure delay:", "$Name:"))
49995012
parse_comments();
50005013
else
50015014
fout("\n+Departure delay:");
50025015

5003-
fout(" %d", wing.departure_delay);
5016+
fout(" %d", w.departure_delay);
50045017
}
50055018

50065019
required_string_fred("$Departure Cue:");
50075020
parse_comments();
5008-
convert_sexp_to_string(sexp_out, wing.departure_cue, SEXP_SAVE_MODE);
5021+
convert_sexp_to_string(sexp_out, w.departure_cue, SEXP_SAVE_MODE);
50095022
fout(" %s", sexp_out.c_str());
50105023

50115024
required_string_fred("$Ships:");
50125025
parse_comments();
5013-
fout(" (\t\t;! %d total\n", wing.wave_count);
5026+
fout(" (\t\t;! %d total\n", w.wave_count);
50145027

5015-
for (int j = 0; j < wing.wave_count; j++) {
5016-
//ship = wing.ship_index[j];
5028+
for (int j = 0; j < w.wave_count; j++) {
5029+
//ship = w.ship_index[j];
50175030
// if (Objects[Ships[ship].objnum].type == OBJ_START)
50185031
// fout("\t\"Player 1\"\n");
50195032
// else
5020-
fout("\t\"%s\"\n", Ships[wing.ship_index[j]].ship_name);
5033+
fout("\t\"%s\"\n", Ships[w.ship_index[j]].ship_name);
50215034
}
50225035

50235036
fout(")");
50245037

5025-
save_ai_goals(wing.ai_goals, -1);
5038+
save_ai_goals(w.ai_goals, -1);
50265039

5027-
if (wing.hotkey != -1) {
5040+
if (w.hotkey != -1) {
50285041
if (optional_string_fred("+Hotkey:", "$Name:"))
50295042
parse_comments();
50305043
else
50315044
fout("\n+Hotkey:");
50325045

5033-
fout(" %d", wing.hotkey);
5046+
fout(" %d", w.hotkey);
50345047
}
50355048

50365049
if (optional_string_fred("+Flags:", "$Name:")) {
@@ -5048,49 +5061,49 @@ int Fred_mission_save::save_wings()
50485061
return nullptr;
50495062
};
50505063

5051-
if (wing.flags[Ship::Wing_Flags::Ignore_count])
5064+
if (w.flags[Ship::Wing_Flags::Ignore_count])
50525065
fout(" \"%s\"", get_flag_name(Ship::Wing_Flags::Ignore_count));
5053-
if (wing.flags[Ship::Wing_Flags::Reinforcement])
5066+
if (w.flags[Ship::Wing_Flags::Reinforcement])
50545067
fout(" \"%s\"", get_flag_name(Ship::Wing_Flags::Reinforcement));
5055-
if (wing.flags[Ship::Wing_Flags::No_arrival_music])
5068+
if (w.flags[Ship::Wing_Flags::No_arrival_music])
50565069
fout(" \"%s\"", get_flag_name(Ship::Wing_Flags::No_arrival_music));
5057-
if (wing.flags[Ship::Wing_Flags::No_arrival_message])
5070+
if (w.flags[Ship::Wing_Flags::No_arrival_message])
50585071
fout(" \"%s\"", get_flag_name(Ship::Wing_Flags::No_arrival_message));
5059-
if (wing.flags[Ship::Wing_Flags::No_first_wave_message])
5072+
if (w.flags[Ship::Wing_Flags::No_first_wave_message])
50605073
fout(" \"%s\"", get_flag_name(Ship::Wing_Flags::No_first_wave_message));
5061-
if (wing.flags[Ship::Wing_Flags::No_arrival_warp])
5074+
if (w.flags[Ship::Wing_Flags::No_arrival_warp])
50625075
fout(" \"%s\"", get_flag_name(Ship::Wing_Flags::No_arrival_warp));
5063-
if (wing.flags[Ship::Wing_Flags::No_departure_warp])
5076+
if (w.flags[Ship::Wing_Flags::No_departure_warp])
50645077
fout(" \"%s\"", get_flag_name(Ship::Wing_Flags::No_departure_warp));
5065-
if (wing.flags[Ship::Wing_Flags::No_dynamic])
5078+
if (w.flags[Ship::Wing_Flags::No_dynamic])
50665079
fout(" \"%s\"", get_flag_name(Ship::Wing_Flags::No_dynamic));
50675080
if (save_config.save_format != MissionFormat::RETAIL) {
5068-
if (wing.flags[Ship::Wing_Flags::Nav_carry])
5081+
if (w.flags[Ship::Wing_Flags::Nav_carry])
50695082
fout(" \"%s\"", get_flag_name(Ship::Wing_Flags::Nav_carry));
5070-
if (wing.flags[Ship::Wing_Flags::Same_arrival_warp_when_docked])
5083+
if (w.flags[Ship::Wing_Flags::Same_arrival_warp_when_docked])
50715084
fout(" \"%s\"", get_flag_name(Ship::Wing_Flags::Same_arrival_warp_when_docked));
5072-
if (wing.flags[Ship::Wing_Flags::Same_departure_warp_when_docked])
5085+
if (w.flags[Ship::Wing_Flags::Same_departure_warp_when_docked])
50735086
fout(" \"%s\"", get_flag_name(Ship::Wing_Flags::Same_departure_warp_when_docked));
50745087
}
50755088

50765089
fout(" )");
50775090

5078-
if (wing.wave_delay_min) {
5091+
if (w.wave_delay_min) {
50795092
if (optional_string_fred("+Wave Delay Min:", "$Name:"))
50805093
parse_comments();
50815094
else
50825095
fout("\n+Wave Delay Min:");
50835096

5084-
fout(" %d", wing.wave_delay_min);
5097+
fout(" %d", w.wave_delay_min);
50855098
}
50865099

5087-
if (wing.wave_delay_max) {
5100+
if (w.wave_delay_max) {
50885101
if (optional_string_fred("+Wave Delay Max:", "$Name:"))
50895102
parse_comments();
50905103
else
50915104
fout("\n+Wave Delay Max:");
50925105

5093-
fout(" %d", wing.wave_delay_max);
5106+
fout(" %d", w.wave_delay_max);
50945107
}
50955108

50965109
fso_comment_pop();

0 commit comments

Comments
 (0)