diff --git a/code/ai/aigoals.cpp b/code/ai/aigoals.cpp index 12209ef1ca8..75279a20ff0 100644 --- a/code/ai/aigoals.cpp +++ b/code/ai/aigoals.cpp @@ -207,10 +207,10 @@ void ai_maybe_add_form_goal(wing* wingp) if (Netgame.type_flags & NG_TYPE_TEAM) { const ship_registry_entry* ship_regp = ship_registry_get(Ships[wingp->ship_index[j]].ship_name); wingnum = TVT_wings[ship_regp->p_objp->team]; - ai_add_ship_goal_player(AIG_TYPE_PLAYER_SHIP, AI_GOAL_FORM_ON_WING, -1, Ships[Wings[wingnum].ship_index[Wings[wingnum].special_ship]].ship_name, aip); + ai_add_ship_goal_player(AIG_TYPE_PLAYER_SHIP, AI_GOAL_FORM_ON_WING, -1, Ships[Wings[wingnum].ship_index[0]].ship_name, aip); } else { wingnum = Starting_wings[0]; - ai_add_ship_goal_player(AIG_TYPE_PLAYER_SHIP, AI_GOAL_FORM_ON_WING, -1, Ships[Wings[wingnum].ship_index[Wings[wingnum].special_ship]].ship_name, aip); + ai_add_ship_goal_player(AIG_TYPE_PLAYER_SHIP, AI_GOAL_FORM_ON_WING, -1, Ships[Wings[wingnum].ship_index[0]].ship_name, aip); } } else if (!(Game_mode & GM_MULTIPLAYER)) { ai_add_ship_goal_player(AIG_TYPE_PLAYER_SHIP, AI_GOAL_FORM_ON_WING, -1, Player_ship->ship_name, aip); @@ -522,7 +522,7 @@ void ai_goal_purge_invalid_goals( ai_goal *aigp, ai_goal *goal_list, ai_info *ai // for wings we grab the ship type of the wing leader if (ai_wingnum >= 0) { - ai_ship_type = Ship_info[Ships[Wings[ai_wingnum].ship_index[Wings[ai_wingnum].special_ship]].ship_info_index].class_type; + ai_ship_type = Ship_info[Ships[Wings[ai_wingnum].ship_index[0]].ship_info_index].class_type; } // otherwise we simply grab it from the ship itself else { diff --git a/code/hud/hudsquadmsg.cpp b/code/hud/hudsquadmsg.cpp index 4e1c50da834..ef0ddd4108b 100644 --- a/code/hud/hudsquadmsg.cpp +++ b/code/hud/hudsquadmsg.cpp @@ -899,9 +899,9 @@ void hud_squadmsg_send_to_all_fighters( int command, int player_num ) continue; // get the first ship on the wing list and look at its team and then its type - shipnum = Wings[i].ship_index[Wings[i].special_ship]; + shipnum = Wings[i].ship_index[0]; - // if special ship isn't valid then just move on + // if wing leader isn't valid then just move on if (shipnum < 0) continue; @@ -2058,8 +2058,8 @@ void hud_squadmsg_wing_command() default_orders.erase(CAPTURE_TARGET_ITEM); // we cannot capture any target with a wing. Num_menu_items = 0; - shipnum = wingp->ship_index[wingp->special_ship]; - Assertion(shipnum >= 0, "Special ship (%d) for wing '%s' has a negative ship_index (%d). This should not happen; get a coder!\n", wingp->special_ship, wingp->name, shipnum); + shipnum = wingp->ship_index[0]; + Assertion(shipnum >= 0, "Wing leader for wing '%s' has a negative ship_index (%d). This should not happen; get a coder!\n", wingp->name, shipnum); orders = Ships[shipnum].orders_accepted; // get the orders that the wing leader will accept for ( size_t order_id : default_orders ) { diff --git a/code/mission/missionhotkey.cpp b/code/mission/missionhotkey.cpp index 4b73dbb0332..9402c073750 100644 --- a/code/mission/missionhotkey.cpp +++ b/code/mission/missionhotkey.cpp @@ -646,8 +646,8 @@ int hotkey_build_team_listing(int enemy_team_mask, int y, bool list_enemies) char wing_name[NAME_LENGTH]; // the wing has to be valid - if (Wings[i].current_count && Wings[i].ship_index[Wings[i].special_ship] >= 0) { - ship *shipp = &Ships[Wings[i].ship_index[Wings[i].special_ship]]; + if (Wings[i].current_count && Wings[i].ship_index[0] >= 0) { + ship *shipp = &Ships[Wings[i].ship_index[0]]; // check IFF override and team mask if (Iff_info[shipp->team].hotkey_team == IFF_hotkey_team::Default) { diff --git a/code/mission/missionparse.cpp b/code/mission/missionparse.cpp index 78fd272b20a..428c01c2da5 100644 --- a/code/mission/missionparse.cpp +++ b/code/mission/missionparse.cpp @@ -4224,10 +4224,6 @@ int parse_wing_create_ships( wing *wingp, int num_to_create, bool force_create, for (j = i; j < length - 1; j++) { wingp->ship_index[j] = wingp->ship_index[j+1]; - - // update "special" ship too - if (wingp->special_ship == j+1) - wingp->special_ship--; } // last value becomes -1 @@ -4278,12 +4274,9 @@ int parse_wing_create_ships( wing *wingp, int num_to_create, bool force_create, // test code to check to be sure that all ships in the wing are ignoring the same types // of orders from the leader if ( Fred_running ) { - Assert( wingp->ship_index[wingp->special_ship] != -1 ); + Assert( wingp->ship_index[0] != -1 ); const std::set& orders = Ships[wingp->ship_index[0]].orders_accepted; - for (it = 0; it < wingp->current_count; it++ ) { - if (it == wingp->special_ship) - continue; - + for (it = 1; it < wingp->current_count; it++ ) { if ( orders != Ships[wingp->ship_index[it]].orders_accepted ) { Warning(LOCATION, "ships in wing %s are ignoring different player orders. Please find Mark A\nto talk to him about this.", wingp->name ); break; @@ -4360,8 +4353,8 @@ void parse_wing(mission *pm) required_string("$Wave Threshold:"); stuff_int(&wingp->threshold); - required_string("$Special Ship:"); - stuff_int(&wingp->special_ship); + if (optional_string("$Special Ship:")) + stuff_int(&i); // not used // Use a custom formation if specified if (optional_string("+Formation:")) { @@ -7461,7 +7454,7 @@ bool mission_maybe_make_wing_arrive(int wingnum, bool force_arrival) if(MULTI_TEAM) { // send a hostile wing arrived message - rship = wingp->ship_index[wingp->special_ship]; + rship = wingp->ship_index[0]; int multi_team_filter = Ships[rship].team; diff --git a/code/parse/sexp.cpp b/code/parse/sexp.cpp index 5fdb6e6f7de..8b68454b288 100644 --- a/code/parse/sexp.cpp +++ b/code/parse/sexp.cpp @@ -6107,17 +6107,8 @@ object_ship_wing_point_team::object_ship_wing_point_team(wing* wp) else type = OSWPT_TYPE_WING_NOT_PRESENT; - // point to wing leader if he is valid - if ((wingp->special_ship >= 0) && (wingp->ship_index[wingp->special_ship] >= 0)) - { - objp = &Objects[Ships[wingp->ship_index[wingp->special_ship]].objnum]; - } - // boo... well, just point to ship at index 0 - else - { - objp = &Objects[Ships[wingp->ship_index[0]].objnum]; - Warning(LOCATION, "Substituting ship '%s' at index 0 for nonexistent wing leader at index %d!", Ships[objp->instance].ship_name, wingp->special_ship); - } + // point to wing leader + objp = &Objects[Ships[wingp->ship_index[0]].objnum]; } void object_ship_wing_point_team::clear() @@ -6234,17 +6225,8 @@ void eval_object_ship_wing_point_team(object_ship_wing_point_team *oswpt, int no { oswpt->type = OSWPT_TYPE_WING; - // point to wing leader if he is valid - if ((wingp->special_ship >= 0) && (wingp->ship_index[wingp->special_ship] >= 0)) - { - oswpt->objp = &Objects[Ships[wingp->ship_index[wingp->special_ship]].objnum]; - } - // boo... well, just point to ship at index 0 - else - { - oswpt->objp = &Objects[Ships[wingp->ship_index[0]].objnum]; - Warning(LOCATION, "Substituting ship '%s' at index 0 for nonexistent wing leader at index %d!", Ships[oswpt->objp->instance].ship_name, wingp->special_ship); - } + // point to wing leader + oswpt->objp = &Objects[Ships[wingp->ship_index[0]].objnum]; } // it's still a valid wing even if nobody is here else diff --git a/code/ship/ship.cpp b/code/ship/ship.cpp index e524bef3d79..6e4eabf1690 100644 --- a/code/ship/ship.cpp +++ b/code/ship/ship.cpp @@ -6691,8 +6691,6 @@ void wing::clear() total_departed = 0; total_vanished = 0; - special_ship = 0; - arrival_location = ARRIVE_AT_LOCATION; arrival_distance = 0; arrival_anchor = -1; @@ -8000,10 +7998,6 @@ void ship_wing_cleanup( int shipnum, wing *wingp ) Assert ( wingp->current_count >= 0 ); wingp->ship_index[wingp->current_count] = -1; - // adjust the special ship if necessary - if (wingp->special_ship > 0 && wingp->special_ship >= index) - wingp->special_ship--; - // if the current count is 0, check to see if the wing departed or was destroyed. if (wingp->current_count == 0) { diff --git a/code/ship/ship.h b/code/ship/ship.h index 08a7738d6c3..aa84afb4ca1 100644 --- a/code/ship/ship.h +++ b/code/ship/ship.h @@ -1516,8 +1516,6 @@ typedef struct wing { int total_departed; // total number of ships departed in this wing (including all waves) int total_vanished; // total number of ships vanished in this wing (including all waves) - int special_ship; // the leader of the wing. An index into ship_index[]. - int arrival_location; // arrival and departure information for wings -- similar to info for ships int arrival_distance; // distance from some ship where this ship arrives int arrival_anchor; // name of object this ship arrives near (or in front of) diff --git a/fred2/dumpstats.cpp b/fred2/dumpstats.cpp index 8604e9cc857..c1b0536878c 100644 --- a/fred2/dumpstats.cpp +++ b/fred2/dumpstats.cpp @@ -585,7 +585,7 @@ void DumpStats::get_species_ship_breakdown(CString &buffer) buffer += "\tFighter wings:\r\n"; for (i=0; i 0) { - int wing_leader_shipnum = Wings[i].ship_index[Wings[i].special_ship]; + int wing_leader_shipnum = Wings[i].ship_index[0]; if (Ship_info[Ships[wing_leader_shipnum].ship_info_index].species == species) { if (Ship_info[Ships[wing_leader_shipnum].ship_info_index].flags[Ship::Info_Flags::Fighter]) { temp.Format("\t\tWing: %s, count: %d, waves: %d, type: %s\r\n", Wings[i].name, Wings[i].wave_count, Wings[i].num_waves, Ship_info[Ships[wing_leader_shipnum].ship_info_index].name); @@ -599,7 +599,7 @@ void DumpStats::get_species_ship_breakdown(CString &buffer) buffer += "\tBomber wings:\r\n"; for (i=0; i 0) { - int wing_leader_shipnum = Wings[i].ship_index[Wings[i].special_ship]; + int wing_leader_shipnum = Wings[i].ship_index[0]; if (Ship_info[Ships[wing_leader_shipnum].ship_info_index].species == species) { if (Ship_info[Ships[wing_leader_shipnum].ship_info_index].flags[Ship::Info_Flags::Bomber]) { temp.Format("\t\tWing: %s, count: %d, waves: %d, type: %s\r\n", Wings[i].name, Wings[i].wave_count, Wings[i].num_waves, Ship_info[Ships[wing_leader_shipnum].ship_info_index].name); @@ -766,7 +766,7 @@ void DumpStats::get_default_ship_loadouts(CString &buffer) buffer += "\tFighter wings:\r\n"; for (i=0; i 0) { - int wing_leader_shipnum = Wings[i].ship_index[Wings[i].special_ship]; + int wing_leader_shipnum = Wings[i].ship_index[0]; if (Ship_info[Ships[wing_leader_shipnum].ship_info_index].species == species) { if (Ship_info[Ships[wing_leader_shipnum].ship_info_index].flags[Ship::Info_Flags::Fighter]) { temp.Format("\t\tWing: %s\r\n", Wings[i].name); @@ -782,7 +782,7 @@ void DumpStats::get_default_ship_loadouts(CString &buffer) buffer += "\tBomber wings:\r\n"; for (i=0; i 0) { - int wing_leader_shipnum = Wings[i].ship_index[Wings[i].special_ship]; + int wing_leader_shipnum = Wings[i].ship_index[0]; if (Ship_info[Ships[wing_leader_shipnum].ship_info_index].species == species) { if (Ship_info[Ships[wing_leader_shipnum].ship_info_index].flags[Ship::Info_Flags::Bomber]) { temp.Format("\t\tWing: %s\r\n", Wings[i].name); diff --git a/fred2/fred.rc b/fred2/fred.rc index 370a63e9ce5..428666c26e3 100644 --- a/fred2/fred.rc +++ b/fred2/fred.rc @@ -1151,12 +1151,11 @@ BEGIN PUSHBUTTON "Prev",IDC_PREV,240,7,24,14,0,WS_EX_STATICEDGE PUSHBUTTON "Next",IDC_NEXT,267,7,24,14,0,WS_EX_STATICEDGE EDITTEXT IDC_WING_NAME,65,7,73,14,ES_AUTOHSCROLL - COMBOBOX IDC_WING_SPECIAL_SHIP,65,23,73,161,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_WING_WAVES,65,37,61,14,ES_AUTOHSCROLL | ES_NUMBER + EDITTEXT IDC_WING_WAVES,65,23,61,14,ES_AUTOHSCROLL | ES_NUMBER CONTROL "Spin2",IDC_SPIN_WAVES,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,127,37,11,15 - EDITTEXT IDC_WING_WAVE_THRESHOLD,65,53,61,15,ES_AUTOHSCROLL | ES_NUMBER + EDITTEXT IDC_WING_WAVE_THRESHOLD,65,39,61,15,ES_AUTOHSCROLL | ES_NUMBER CONTROL "Spin2",IDC_SPIN_WAVE_THRESHOLD,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,127,53,11,15 - COMBOBOX IDC_HOTKEY,65,70,73,115,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_HOTKEY,65,56,73,115,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Squad Logo",IDC_WING_SQUAD_LOGO_BUTTON,7,89,55,14 EDITTEXT IDC_WING_SQUAD_LOGO,65,90,80,14,ES_AUTOHSCROLL | ES_READONLY CONTROL "Reinforcement Unit",IDC_REINFORCEMENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,143,10,77,10 @@ -1191,9 +1190,8 @@ BEGIN CONTROL "Hide Cues",IDC_HIDE_CUES,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,241,71,49,12 GROUPBOX "Departure",IDC_STATIC,153,110,138,270 RTEXT "Wing Name",IDC_STATIC,19,10,42,8 - RTEXT "Wave Threshold",IDC_STATIC,7,56,54,8 - RTEXT "# of Waves",IDC_STATIC,16,40,45,8 - RTEXT "Leader",IDC_STATIC,38,25,23,8,NOT WS_GROUP + RTEXT "Wave Threshold",IDC_STATIC,7,42,54,8 + RTEXT "# of Waves",IDC_STATIC,16,26,45,8 LTEXT "Location",IDC_STATIC,15,124,28,8 LTEXT "Cue:",IDC_STATIC,15,259,16,8 GROUPBOX "Arrival",IDC_CUE_FRAME,7,110,138,270 @@ -1202,7 +1200,7 @@ BEGIN LTEXT "Delay",IDC_STATIC,160,140,19,8 LTEXT "Delay",IDC_STATIC,15,140,19,8 LTEXT "Seconds",IDC_STATIC,102,141,45,8 - RTEXT "Hotkey",IDC_STATIC,37,72,24,8 + RTEXT "Hotkey",IDC_STATIC,37,58,24,8 GROUPBOX "Delay Between Waves",IDC_STATIC,15,154,119,30 LTEXT "Min",IDC_STATIC,21,167,12,8 LTEXT "Max",IDC_STATIC,80,167,14,8 @@ -2823,8 +2821,6 @@ END IDD_WING_EDITOR DLGINIT BEGIN - IDC_WING_SPECIAL_SHIP, 0x403, 6, 0 -0x6977, 0x676e, 0x0031, IDC_HOTKEY, 0x403, 5, 0 0x6f4e, 0x656e, "\000" IDC_HOTKEY, 0x403, 11, 0 diff --git a/fred2/fredview.cpp b/fred2/fredview.cpp index 4a3dedd5bfe..e5d3a6412f6 100644 --- a/fred2/fredview.cpp +++ b/fred2/fredview.cpp @@ -2830,10 +2830,6 @@ int CFREDView::global_error_check() } } - if ((Wings[i].special_ship < 0) || (Wings[i].special_ship >= Wings[i].wave_count)){ - return internal_error("Special ship out of range for \"%s\"", Wings[i].name); - } - if (Wings[i].num_waves < 0){ return internal_error("Number of waves for \"%s\" is negative", Wings[i].name); } @@ -4384,8 +4380,7 @@ void CFREDView::OnMarkWing() for (i=0; i= 0 && Wings[wing].special_ship < Wings[wing].wave_count); - set_cur_object_index(wing_objects[wing][Wings[wing].special_ship]); + set_cur_object_index(wing_objects[wing][0]); } } diff --git a/fred2/management.cpp b/fred2/management.cpp index 22a8a96c3b7..45302fd11aa 100644 --- a/fred2/management.cpp +++ b/fred2/management.cpp @@ -1371,11 +1371,6 @@ int delete_ship_from_wing(int ship) } Assert(i != -1); // Error, object should be in wing. - if (Wings[wing].special_ship == i){ - Wings[wing].special_ship = 0; - } else if (Wings[wing].special_ship > i) { - Wings[wing].special_ship--; - } if (i != end) { wing_objects[wing][i] = wing_objects[wing][end]; diff --git a/fred2/missionsave.cpp b/fred2/missionsave.cpp index e0c522d4587..35cb4bcdd92 100644 --- a/fred2/missionsave.cpp +++ b/fred2/missionsave.cpp @@ -4463,10 +4463,12 @@ int CFred_mission_save::save_wings() parse_comments(); fout(" %d", Wings[i].threshold); - required_string_fred("$Special Ship:"); - parse_comments(); - fout(" %d\t\t;! %s", Wings[i].special_ship, - Ships[Wings[i].ship_index[Wings[i].special_ship]].ship_name); + if (Mission_save_format == FSO_FORMAT_RETAIL) { + if (optional_string_fred("$Special Ship:")) { + parse_comments(); + fout(" %d\t\t;! %s", 0, Ships[Wings[i].ship_index[0]].ship_name); + } + } if (Mission_save_format != FSO_FORMAT_RETAIL) { if (Wings[i].formation >= 0 && Wings[i].formation < (int)Wing_formations.size()) diff --git a/fred2/resource.h b/fred2/resource.h index 051e44ce075..a4e8d95b4e6 100644 --- a/fred2/resource.h +++ b/fred2/resource.h @@ -161,7 +161,6 @@ #define IDC_SHIP_WEAPON1 1019 #define IDC_WEAPON_ENERGY_AMMO_USAGE 1019 #define IDC_SHIP_WEAPON2 1020 -#define IDC_WING_SPECIAL_SHIP 1021 #define IDC_MODEL_NAME 1021 #define IDC_WEAPON_LIGHT_CAST 1021 #define IDC_AI_DETERMINATION 1022 diff --git a/fred2/wing.cpp b/fred2/wing.cpp index 1462d9815c4..432e477ba32 100644 --- a/fred2/wing.cpp +++ b/fred2/wing.cpp @@ -246,8 +246,6 @@ int create_wing() { Ships[ship].departure_cue = Locked_sexp_false; wing_objects[wing][i] = OBJ_INDEX(ptr); - if (OBJ_INDEX(ptr) == leader) - Wings[wing].special_ship = i; } ptr = GET_NEXT(ptr); @@ -275,7 +273,7 @@ int create_wing() { "Error", MB_ICONEXCLAMATION); - leader_team = Ships[Wings[wing].ship_index[Wings[wing].special_ship]].team; + leader_team = Ships[Wings[wing].ship_index[0]].team; for (i = 0; i < Wings[wing].wave_count; i++) { if (Ships[Wings[wing].ship_index[i]].team != leader_team) { Fred_main_wnd->MessageBox("Wing contains ships on different teams", "Warning"); @@ -366,8 +364,7 @@ void mark_wing(int wing) int i; unmark_all(); - Assert(Wings[wing].special_ship >= 0 && Wings[wing].special_ship < Wings[wing].wave_count); - set_cur_object_index(wing_objects[wing][Wings[wing].special_ship]); + set_cur_object_index(wing_objects[wing][0]); for (i=0; iResetContent(); - for (i=0; iAddString(Ships[Wings[cur_wing].ship_index[i]].ship_name); - m_threshold_spin.SetRange(0, static_cast(calc_max_wave_treshold())); for (i=0; iEnableWindow(enable); GetDlgItem(IDC_WING_SQUAD_LOGO_BUTTON)->EnableWindow(enable); - GetDlgItem(IDC_WING_SPECIAL_SHIP)->EnableWindow(enable); GetDlgItem(IDC_WING_WAVES)->EnableWindow(player_enabled); GetDlgItem(IDC_WING_WAVE_THRESHOLD)->EnableWindow(player_enabled); GetDlgItem(IDC_DISBAND_WING)->EnableWindow(enable); @@ -787,7 +777,6 @@ void wing_editor::update_data_safe() } } - MODIFY(Wings[cur_wing].special_ship, m_special_ship); MODIFY(Wings[cur_wing].num_waves, m_waves); MODIFY(Wings[cur_wing].threshold, m_threshold); MODIFY(Wings[cur_wing].formation, m_formation - 1); diff --git a/fred2/wing_editor.h b/fred2/wing_editor.h index e84155ec8b9..1e0de5a2594 100644 --- a/fred2/wing_editor.h +++ b/fred2/wing_editor.h @@ -47,7 +47,6 @@ class wing_editor : public CDialog CSpinButtonCtrl m_threshold_spin; CSpinButtonCtrl m_waves_spin; CString m_wing_name; - int m_special_ship; int m_waves; int m_threshold; int m_formation; diff --git a/qtfred/src/mission/Editor.cpp b/qtfred/src/mission/Editor.cpp index 527c120dddc..4e53f31d004 100644 --- a/qtfred/src/mission/Editor.cpp +++ b/qtfred/src/mission/Editor.cpp @@ -1342,11 +1342,6 @@ int Editor::delete_ship_from_wing(int ship) { } Assert(i != -1); // Error, object should be in wing. - if (Wings[wing].special_ship == i) { - Wings[wing].special_ship = 0; - } else if (Wings[wing].special_ship > i) { - Wings[wing].special_ship--; - } if (i != end) { wing_objects[wing][i] = wing_objects[wing][end]; @@ -2165,10 +2160,6 @@ int Editor::global_error_check_impl() { } } - if ((Wings[i].special_ship < 0) || (Wings[i].special_ship >= Wings[i].wave_count)) { - return internal_error("Special ship out of range for \"%s\"", Wings[i].name); - } - if (Wings[i].num_waves < 0) { return internal_error("Number of waves for \"%s\" is negative", Wings[i].name); } diff --git a/qtfred/src/mission/EditorWing.cpp b/qtfred/src/mission/EditorWing.cpp index 1b08aaa1e79..ee3174a7a0c 100644 --- a/qtfred/src/mission/EditorWing.cpp +++ b/qtfred/src/mission/EditorWing.cpp @@ -268,9 +268,6 @@ int Editor::create_wing() Ships[ship].departure_cue = Locked_sexp_false; wing_objects[wing][i] = OBJ_INDEX(ptr); - if (OBJ_INDEX(ptr) == leader) { - Wings[wing].special_ship = i; - } } ptr = GET_NEXT(ptr); @@ -304,7 +301,7 @@ int Editor::create_wing() {DialogButton::Ok}); } - leader_team = Ships[Wings[wing].ship_index[Wings[wing].special_ship]].team; + leader_team = Ships[Wings[wing].ship_index[0]].team; for (i = 0; i < Wings[wing].wave_count; i++) { if (Ships[Wings[wing].ship_index[i]].team != leader_team) { _lastActiveViewport->dialogProvider->showButtonDialog(DialogType::Warning, @@ -345,9 +342,6 @@ void Editor::remove_ship_from_wing(int ship, int min) } Assert(i != -1); // Error, object should be in wing. - if (Wings[wing].special_ship == i) { - Wings[wing].special_ship = 0; - } // if not last element, move last element to position to fill gap if (i != end) { @@ -390,8 +384,7 @@ void Editor::mark_wing(int wing) int i; unmark_all(); - Assert(Wings[wing].special_ship >= 0 && Wings[wing].special_ship < Wings[wing].wave_count); - setupCurrentObjectIndices(wing_objects[wing][Wings[wing].special_ship]); + setupCurrentObjectIndices(wing_objects[wing][0]); for (i = 0; i < Wings[wing].wave_count; i++) { markObject(wing_objects[wing][i]); } diff --git a/qtfred/src/mission/missionsave.cpp b/qtfred/src/mission/missionsave.cpp index 1e962a77600..edbbc8479e0 100644 --- a/qtfred/src/mission/missionsave.cpp +++ b/qtfred/src/mission/missionsave.cpp @@ -4435,9 +4435,12 @@ int CFred_mission_save::save_wings() parse_comments(); fout(" %d", Wings[i].threshold); - required_string_fred("$Special Ship:"); - parse_comments(); - fout(" %d\t\t;! %s", Wings[i].special_ship, Ships[Wings[i].ship_index[Wings[i].special_ship]].ship_name); + if (save_format == MissionFormat::RETAIL) { + if (optional_string_fred("$Special Ship:")) { + parse_comments(); + fout(" %d\t\t;! %s", 0, Ships[Wings[i].ship_index[0]].ship_name); + } + } if (save_format != MissionFormat::RETAIL) { if (Wings[i].formation >= 0 && Wings[i].formation < (int)Wing_formations.size())