void wing_editor::OnSelchangeArrivalLocation() { CComboBox *box; box = (CComboBox *)GetDlgItem(IDC_ARRIVAL_TARGET); UpdateData(); if (m_arrival_location) { GetDlgItem(IDC_ARRIVAL_DISTANCE)->EnableWindow(TRUE); GetDlgItem(IDC_ARRIVAL_TARGET)->EnableWindow(TRUE); if (m_arrival_target < 0) { m_arrival_target = 0; } // determine which items we should put into the arrival target combo box if ( m_arrival_location == ARRIVE_FROM_DOCK_BAY ) { management_add_ships_to_combo( box, SHIPS_2_COMBO_DOCKING_BAY_ONLY ); } else { management_add_ships_to_combo( box, SHIPS_2_COMBO_SPECIAL | SHIPS_2_COMBO_ALL_SHIPS ); } } else { m_arrival_target = -1; GetDlgItem(IDC_ARRIVAL_DISTANCE)->EnableWindow(FALSE); GetDlgItem(IDC_ARRIVAL_TARGET)->EnableWindow(FALSE); } UpdateData(FALSE); }
void wing_editor::OnSelchangeDepartureLocation() { CComboBox *box; box = (CComboBox *)GetDlgItem(IDC_DEPARTURE_TARGET); UpdateData(); if (m_departure_location) { GetDlgItem(IDC_DEPARTURE_TARGET)->EnableWindow(TRUE); if (m_departure_target < 0) { m_departure_target = 0; } // we need to build up the list box content based on the departure type. When // from a docking bay, only show ships in the list which have them. Show all ships otherwise if ( m_departure_location == DEPART_AT_DOCK_BAY ) { management_add_ships_to_combo( box, SHIPS_2_COMBO_DOCKING_BAY_ONLY ); } else { // I think that this section is currently illegal Int3(); } } else { box->ResetContent(); box->EnableWindow(TRUE); if ( m_departure_target < 0 ) m_departure_target = -1; m_departure_target = 0; box->AddString("None"); for (int i=0; i<Num_jump_nodes; i++) box->AddString(Jumppoint_lists[i].name); //GetDlgItem(IDC_DEPARTURE_TARGET)->EnableWindow(FALSE); } UpdateData(FALSE); }
void wing_editor::OnSelchangeDepartureLocation() { CComboBox *box; box = (CComboBox *)GetDlgItem(IDC_DEPARTURE_TARGET); UpdateData(); if (m_departure_location) { GetDlgItem(IDC_DEPARTURE_TARGET)->EnableWindow(TRUE); if (m_departure_target < 0) { m_departure_target = 0; } // we need to build up the list box content based on the departure type. When // from a docking bay, only show ships in the list which have them. Show all ships otherwise if ( m_departure_location == DEPART_AT_DOCK_BAY ) { management_add_ships_to_combo( box, SHIPS_2_COMBO_DOCKING_BAY_ONLY ); } else { // I think that this section is currently illegal Int3(); } } else { m_departure_target = -1; GetDlgItem(IDC_DEPARTURE_TARGET)->EnableWindow(FALSE); } if (m_departure_location == DEPART_AT_DOCK_BAY) { GetDlgItem(IDC_RESTRICT_DEPARTURE)->EnableWindow(TRUE); } else { GetDlgItem(IDC_RESTRICT_DEPARTURE)->EnableWindow(FALSE); } UpdateData(FALSE); }
// initialize everything that update_data_safe() saves. void wing_editor::initialize_data_safe(int full_update) { int i, enable = TRUE, player_wing = 0, player_enabled = 1; CComboBox *arrival_box, *departure_box; nprintf(("Fred routing", "Wing dialog load safe\n")); if (!GetSafeHwnd()) return; arrival_box = (CComboBox *) GetDlgItem(IDC_ARRIVAL_TARGET); departure_box = (CComboBox *)GetDlgItem(IDC_DEPARTURE_TARGET); m_ignore_count = 0; if (cur_wing < 0) { m_wing_squad_filename = _T(""); m_special_ship = -1; m_arrival_location = -1; m_departure_location = -1; m_arrival_delay = 0; m_arrival_delay_min = 0; m_arrival_delay_max = 0; m_arrival_dist = 0; m_arrival_target = -1; m_departure_target = -1; m_departure_delay = 0; m_arrival_tree.clear_tree(); m_departure_tree.clear_tree(); m_arrival_tree.DeleteAllItems(); m_departure_tree.DeleteAllItems(); m_reinforcement = FALSE; m_hotkey = 0; m_ignore_count = 0; m_no_arrival_music = 0; m_no_arrival_message = 0; m_no_arrival_warp = 0; m_no_departure_warp = 0; m_no_dynamic = 0; player_enabled = enable = FALSE; } else { CComboBox *ptr; /*if (cur_wing == wing_name_lookup("alpha", 1)) player_enabled = 0; if ((The_mission.game_type & MISSION_TYPE_MULTI_TEAMS) && (cur_wing == wing_name_lookup("zeta", 1))) player_enabled = 0; // in multiplayer coop missions, alpha, beta, and gamma are both off limits. if ( The_mission.game_type & MISSION_TYPE_MULTI_COOP ) { if ( (cur_wing == wing_name_lookup("alpha", 1)) || (cur_wing == wing_name_lookup("beta", 1)) || (cur_wing == wing_name_lookup("gamma", 1)) ) { player_enabled = 0; } }*/ if ((Player_start_shipnum >= 0) && (Player_start_shipnum < MAX_SHIPS) && (Ships[Player_start_shipnum].objnum >= 0)) if (Ships[Player_start_shipnum].wingnum == cur_wing) player_wing = 1; m_wing_squad_filename = _T(Wings[cur_wing].wing_squad_filename); m_special_ship = Wings[cur_wing].special_ship; m_waves = Wings[cur_wing].num_waves; m_threshold = Wings[cur_wing].threshold; m_arrival_location = Wings[cur_wing].arrival_location; m_departure_location = Wings[cur_wing].departure_location; m_arrival_delay = Wings[cur_wing].arrival_delay; m_arrival_delay_min = Wings[cur_wing].wave_delay_min; m_arrival_delay_max = Wings[cur_wing].wave_delay_max; m_arrival_dist = Wings[cur_wing].arrival_distance; m_arrival_target = Wings[cur_wing].arrival_anchor; if (m_departure_location == DEPART_AT_DOCK_BAY) m_departure_target = Wings[cur_wing].departure_anchor; else m_departure_target = Wings[cur_wing].jump_anchor; m_no_dynamic = (Wings[cur_wing].flags & WF_NO_DYNAMIC)?1:0; // Add the ships/special items to the combo box here before data is updated if ( m_arrival_location == ARRIVE_FROM_DOCK_BAY ) { management_add_ships_to_combo( arrival_box, SHIPS_2_COMBO_DOCKING_BAY_ONLY ); } else { management_add_ships_to_combo( arrival_box, SHIPS_2_COMBO_SPECIAL | SHIPS_2_COMBO_ALL_SHIPS ); } if (m_arrival_target >= SPECIAL_ARRIVAL_ANCHORS_OFFSET) m_arrival_target -= SPECIAL_ARRIVAL_ANCHORS_OFFSET; else if (m_arrival_target >= 0) m_arrival_target = arrival_box->FindStringExact(-1, Ships[m_arrival_target].ship_name); // add the ships to the departure target combo box if ( m_departure_location == DEPART_AT_DOCK_BAY ) { management_add_ships_to_combo( departure_box, SHIPS_2_COMBO_DOCKING_BAY_ONLY ); if ( m_departure_target >= 0 ) m_departure_target = departure_box->FindStringExact(-1, Ships[m_departure_target].ship_name); } else { departure_box->ResetContent(); char list[MAX_JUMPPOINT_LISTS+1][NAME_LENGTH]; strcpy(list[0], "None"); departure_box->AddString("None"); for (i=0; i<Num_jump_nodes; i++) { departure_box->AddString(Jumppoint_lists[i].name); strcpy(list[i+1], Jumppoint_lists[i].name); } if (m_departure_target >= 0) { m_departure_target = departure_box->FindStringExact(-1, list[m_departure_target]); } else m_departure_target = 0; } m_departure_delay = Wings[cur_wing].departure_delay; if (player_wing) m_arrival_tree.load_tree(Locked_sexp_true); else m_arrival_tree.load_tree(Wings[cur_wing].arrival_cue); m_departure_tree.load_tree(Wings[cur_wing].departure_cue, "false"); m_hotkey = Wings[cur_wing].hotkey+1; if (Wings[cur_wing].flags & WF_IGNORE_COUNT) m_ignore_count = 1; else m_ignore_count = 0; if (Wings[cur_wing].flags & WF_NO_ARRIVAL_MUSIC) m_no_arrival_music = 1; else m_no_arrival_music = 0; if ( Wings[cur_wing].flags & WF_NO_ARRIVAL_MESSAGE ) m_no_arrival_message = 1; else m_no_arrival_message = 0; if ( Wings[cur_wing].flags & WF_NO_ARRIVAL_WARP ) m_no_arrival_warp = 1; else m_no_arrival_warp = 0; if ( Wings[cur_wing].flags & WF_NO_DEPARTURE_WARP ) m_no_departure_warp = 1; else m_no_departure_warp = 0; ptr = (CComboBox *) GetDlgItem(IDC_WING_SPECIAL_SHIP); ptr->ResetContent(); for (i=0; i<Wings[cur_wing].wave_count; i++) ptr->AddString(Ships[Wings[cur_wing].ship_index[i]].ship_name); m_threshold_spin.SetRange(0, Wings[cur_wing].wave_count - 1); for (i=0; i<Num_reinforcements; i++) if (!stricmp(Reinforcements[i].name, Wings[cur_wing].name)) break; if (i < Num_reinforcements) m_reinforcement = TRUE; else m_reinforcement = FALSE; } if (full_update) UpdateData(FALSE); GetDlgItem(IDC_WING_NAME)->EnableWindow(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); GetDlgItem(IDC_SPIN_WAVES)->EnableWindow(player_enabled); GetDlgItem(IDC_SPIN_WAVE_THRESHOLD)->EnableWindow(player_enabled); GetDlgItem(IDC_ARRIVAL_LOCATION)->EnableWindow(enable); GetDlgItem(IDC_ARRIVAL_DELAY)->EnableWindow(player_enabled); GetDlgItem(IDC_ARRIVAL_DELAY_MIN)->EnableWindow(player_enabled); GetDlgItem(IDC_ARRIVAL_DELAY_MAX)->EnableWindow(player_enabled); GetDlgItem(IDC_ARRIVAL_DELAY_SPIN)->EnableWindow(player_enabled); if (m_arrival_location) { GetDlgItem(IDC_ARRIVAL_DISTANCE)->EnableWindow(enable); GetDlgItem(IDC_ARRIVAL_TARGET)->EnableWindow(enable); } else { GetDlgItem(IDC_ARRIVAL_DISTANCE)->EnableWindow(FALSE); GetDlgItem(IDC_ARRIVAL_TARGET)->EnableWindow(FALSE); } GetDlgItem(IDC_NO_DYNAMIC)->EnableWindow(enable); //if ( m_departure_location ) { GetDlgItem(IDC_DEPARTURE_TARGET)->EnableWindow(enable); //} else { // GetDlgItem(IDC_DEPARTURE_TARGET)->EnableWindow(FALSE); //} if (player_wing) GetDlgItem(IDC_ARRIVAL_TREE)->EnableWindow(0); else GetDlgItem(IDC_ARRIVAL_TREE)->EnableWindow(enable); GetDlgItem(IDC_DEPARTURE_LOCATION)->EnableWindow(enable); GetDlgItem(IDC_DEPARTURE_DELAY)->EnableWindow(enable); GetDlgItem(IDC_DEPARTURE_DELAY_SPIN)->EnableWindow(enable); GetDlgItem(IDC_DEPARTURE_TREE)->EnableWindow(enable); GetDlgItem(IDC_GOALS2)->EnableWindow(enable); GetDlgItem(IDC_DELETE_WING)->EnableWindow(enable); GetDlgItem(IDC_REINFORCEMENT)->EnableWindow(enable); GetDlgItem(IDC_HOTKEY)->EnableWindow(enable); GetDlgItem(IDC_IGNORE_COUNT)->EnableWindow(enable); GetDlgItem(IDC_NO_ARRIVAL_MUSIC)->EnableWindow(enable); GetDlgItem(IDC_NO_ARRIVAL_MESSAGE)->EnableWindow(enable); GetDlgItem(IDC_NO_ARRIVAL_WARP)->EnableWindow(enable); GetDlgItem(IDC_NO_DEPARTURE_WARP)->EnableWindow(enable); if (cur_wing >= 0) { enable = TRUE; // check to see if the wing has a ship which is not a fighter/bomber type. If so, then disable // the wing_waves and wing_threshold stuff for (i = 0; i < Wings[cur_wing].wave_count; i++ ) { int sflag; sflag = Ship_info[Ships[Wings[cur_wing].ship_index[i]].ship_info_index].flags; if ( !(sflag & SIF_FIGHTER) && !(sflag & SIF_BOMBER) ) enable = FALSE; } } else enable = FALSE; }
// initialize everything that update_data_safe() saves. void wing_editor::initialize_data_safe(int full_update) { int i, enable = TRUE, player_wing = 0, player_enabled = 1; CComboBox *arrival_box, *departure_box; nprintf(("Fred routing", "Wing dialog load safe\n")); if (!GetSafeHwnd()) return; arrival_box = (CComboBox *) GetDlgItem(IDC_ARRIVAL_TARGET); departure_box = (CComboBox *)GetDlgItem(IDC_DEPARTURE_TARGET); m_ignore_count = 0; if (cur_wing < 0) { m_wing_squad_filename = _T(""); m_special_ship = -1; m_arrival_location = -1; m_departure_location = -1; m_arrival_delay = 0; m_arrival_delay_min = 0; m_arrival_delay_max = 0; m_arrival_dist = 0; m_arrival_target = -1; m_departure_target = -1; m_departure_delay = 0; m_arrival_tree.clear_tree(); m_departure_tree.clear_tree(); m_arrival_tree.DeleteAllItems(); m_departure_tree.DeleteAllItems(); m_reinforcement = FALSE; m_hotkey = 0; m_ignore_count = 0; m_no_arrival_music = 0; m_no_arrival_message = 0; m_no_arrival_warp = 0; m_no_departure_warp = 0; m_no_dynamic = 0; player_enabled = enable = FALSE; } else { CComboBox *ptr; if (The_mission.game_type & MISSION_TYPE_MULTI) { if (The_mission.game_type & MISSION_TYPE_MULTI_TEAMS) { for (i=0; i<MAX_TVT_WINGS; i++) { if (cur_wing == TVT_wings[i]) player_enabled = 0; } } else { for (i=0; i<MAX_STARTING_WINGS; i++) { if (cur_wing == Starting_wings[i]) player_enabled = 0; } } } else { if (cur_wing == Ships[Player_start_shipnum].wingnum) player_enabled = 0; } if ((Player_start_shipnum >= 0) && (Player_start_shipnum < MAX_SHIPS) && (Ships[Player_start_shipnum].objnum >= 0)) if (Ships[Player_start_shipnum].wingnum == cur_wing) player_wing = 1; m_wing_squad_filename = _T(Wings[cur_wing].wing_squad_filename); m_special_ship = Wings[cur_wing].special_ship; m_waves = Wings[cur_wing].num_waves; m_threshold = Wings[cur_wing].threshold; m_arrival_location = Wings[cur_wing].arrival_location; m_departure_location = Wings[cur_wing].departure_location; m_arrival_delay = Wings[cur_wing].arrival_delay; m_arrival_delay_min = Wings[cur_wing].wave_delay_min; m_arrival_delay_max = Wings[cur_wing].wave_delay_max; m_arrival_dist = Wings[cur_wing].arrival_distance; m_arrival_target = Wings[cur_wing].arrival_anchor; m_departure_target = Wings[cur_wing].departure_anchor; m_no_dynamic = (Wings[cur_wing].flags & WF_NO_DYNAMIC)?1:0; // Add the ships/special items to the combo box here before data is updated if ( m_arrival_location == ARRIVE_FROM_DOCK_BAY ) { management_add_ships_to_combo( arrival_box, SHIPS_2_COMBO_DOCKING_BAY_ONLY ); } else { management_add_ships_to_combo( arrival_box, SHIPS_2_COMBO_SPECIAL | SHIPS_2_COMBO_ALL_SHIPS ); } // Goober5000 - gah, this is ridiculous! Prior to this point in the function (and only in this function), // m_arrival_target seems to refer to the arrival anchor. The rest of the time, it refers to the index // of the drop-down list. if (m_arrival_target >= 0) { if (m_arrival_target & SPECIAL_ARRIVAL_ANCHOR_FLAG) { // figure out what the box represents this as char tmp[NAME_LENGTH + 15]; stuff_special_arrival_anchor_name(tmp, m_arrival_target, 0); // find it in the box m_arrival_target = arrival_box->FindStringExact(-1, tmp); } else { // find it in the box m_arrival_target = arrival_box->FindStringExact(-1, Ships[m_arrival_target].ship_name); } } // add the ships to the departure target combo box if ( m_departure_location == DEPART_AT_DOCK_BAY ) { management_add_ships_to_combo( departure_box, SHIPS_2_COMBO_DOCKING_BAY_ONLY ); } else { departure_box->ResetContent(); } if ( m_departure_target >= 0 ) m_departure_target = departure_box->FindStringExact(-1, Ships[m_departure_target].ship_name); m_departure_delay = Wings[cur_wing].departure_delay; if (player_wing) m_arrival_tree.load_tree(Locked_sexp_true); else m_arrival_tree.load_tree(Wings[cur_wing].arrival_cue); m_departure_tree.load_tree(Wings[cur_wing].departure_cue, "false"); m_hotkey = Wings[cur_wing].hotkey+1; if (Wings[cur_wing].flags & WF_IGNORE_COUNT) m_ignore_count = 1; else m_ignore_count = 0; if (Wings[cur_wing].flags & WF_NO_ARRIVAL_MUSIC) m_no_arrival_music = 1; else m_no_arrival_music = 0; if ( Wings[cur_wing].flags & WF_NO_ARRIVAL_MESSAGE ) m_no_arrival_message = 1; else m_no_arrival_message = 0; if ( Wings[cur_wing].flags & WF_NO_ARRIVAL_WARP ) m_no_arrival_warp = 1; else m_no_arrival_warp = 0; if ( Wings[cur_wing].flags & WF_NO_DEPARTURE_WARP ) m_no_departure_warp = 1; else m_no_departure_warp = 0; ptr = (CComboBox *) GetDlgItem(IDC_WING_SPECIAL_SHIP); ptr->ResetContent(); for (i=0; i<Wings[cur_wing].wave_count; i++) ptr->AddString(Ships[Wings[cur_wing].ship_index[i]].ship_name); m_threshold_spin.SetRange(0, Wings[cur_wing].wave_count - 1); for (i=0; i<Num_reinforcements; i++) if (!stricmp(Reinforcements[i].name, Wings[cur_wing].name)) break; if (i < Num_reinforcements) m_reinforcement = TRUE; else m_reinforcement = FALSE; } if (full_update) UpdateData(FALSE); GetDlgItem(IDC_WING_NAME)->EnableWindow(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); GetDlgItem(IDC_SPIN_WAVES)->EnableWindow(player_enabled); GetDlgItem(IDC_SPIN_WAVE_THRESHOLD)->EnableWindow(player_enabled); GetDlgItem(IDC_ARRIVAL_LOCATION)->EnableWindow(enable); GetDlgItem(IDC_ARRIVAL_DELAY)->EnableWindow(player_enabled); GetDlgItem(IDC_ARRIVAL_DELAY_MIN)->EnableWindow(player_enabled); GetDlgItem(IDC_ARRIVAL_DELAY_MAX)->EnableWindow(player_enabled); GetDlgItem(IDC_ARRIVAL_DELAY_SPIN)->EnableWindow(player_enabled); if (m_arrival_location) { GetDlgItem(IDC_ARRIVAL_DISTANCE)->EnableWindow(enable); GetDlgItem(IDC_ARRIVAL_TARGET)->EnableWindow(enable); } else { GetDlgItem(IDC_ARRIVAL_DISTANCE)->EnableWindow(FALSE); GetDlgItem(IDC_ARRIVAL_TARGET)->EnableWindow(FALSE); } if (m_arrival_location == ARRIVE_FROM_DOCK_BAY) { GetDlgItem(IDC_RESTRICT_ARRIVAL)->EnableWindow(enable); } else { GetDlgItem(IDC_RESTRICT_ARRIVAL)->EnableWindow(FALSE); } GetDlgItem(IDC_NO_DYNAMIC)->EnableWindow(enable); if (m_departure_location) { GetDlgItem(IDC_DEPARTURE_TARGET)->EnableWindow(enable); } else { GetDlgItem(IDC_DEPARTURE_TARGET)->EnableWindow(FALSE); } if (m_departure_location == DEPART_AT_DOCK_BAY) { GetDlgItem(IDC_RESTRICT_DEPARTURE)->EnableWindow(enable); } else { GetDlgItem(IDC_RESTRICT_DEPARTURE)->EnableWindow(FALSE); } if (player_wing) GetDlgItem(IDC_ARRIVAL_TREE)->EnableWindow(0); else GetDlgItem(IDC_ARRIVAL_TREE)->EnableWindow(enable); GetDlgItem(IDC_DEPARTURE_LOCATION)->EnableWindow(enable); GetDlgItem(IDC_DEPARTURE_DELAY)->EnableWindow(enable); GetDlgItem(IDC_DEPARTURE_DELAY_SPIN)->EnableWindow(enable); GetDlgItem(IDC_DEPARTURE_TREE)->EnableWindow(enable); GetDlgItem(IDC_GOALS2)->EnableWindow(enable); GetDlgItem(IDC_DELETE_WING)->EnableWindow(enable); GetDlgItem(IDC_REINFORCEMENT)->EnableWindow(enable); GetDlgItem(IDC_HOTKEY)->EnableWindow(enable); GetDlgItem(IDC_IGNORE_COUNT)->EnableWindow(enable); GetDlgItem(IDC_NO_ARRIVAL_MUSIC)->EnableWindow(enable); GetDlgItem(IDC_NO_ARRIVAL_MESSAGE)->EnableWindow(enable); GetDlgItem(IDC_NO_ARRIVAL_WARP)->EnableWindow(enable); GetDlgItem(IDC_NO_DEPARTURE_WARP)->EnableWindow(enable); if (cur_wing >= 0) { enable = TRUE; // check to see if the wing has a ship which is not a fighter/bomber type. If so, then disable // the wing_waves and wing_threshold stuff for (i = 0; i < Wings[cur_wing].wave_count; i++ ) { int sflag; sflag = Ship_info[Ships[Wings[cur_wing].ship_index[i]].ship_info_index].flags; if ( !(sflag & SIF_FIGHTER) && !(sflag & SIF_BOMBER) ) enable = FALSE; } } else enable = FALSE; }