77
88#include < SDL.h>
99#include < ai/ai.h>
10- #include < sound/audiostr.h>
1110#include < parse/parselo.h>
12- #include < missionui/fictionviewer.h>
1311#include < mission/missiongoals.h>
1412#include < mission/missionparse.h>
1513#include < asteroid/asteroid.h>
@@ -490,11 +488,6 @@ bool Editor::loadMission(const std::string& mission_name, int flags) {
490488 return true ;
491489}
492490void Editor::clean_up_selections () {
493- #if 0
494- if (Briefing_dialog)
495- Briefing_dialog->icon_select(-1);
496- #endif
497-
498491 unmark_all ();
499492}
500493void Editor::unmark_all () {
@@ -556,11 +549,6 @@ void Editor::unmarkObject(int obj) {
556549void Editor::clearMission (bool fast_reload) {
557550 // clean up everything we need to before we reset back to defaults.
558551 clean_up_selections ();
559- #if 0
560- if (Briefing_dialog){
561- Briefing_dialog->reset_editor();
562- }
563- #endif
564552
565553 allocate_parse_text (PARSE_TEXT_SIZE );
566554
@@ -669,14 +657,6 @@ void Editor::setupCurrentObjectIndices(int selectedObj) {
669657 if ((Objects[selectedObj].type == OBJ_SHIP ) || (Objects[selectedObj].type == OBJ_START )) {
670658 cur_ship = Objects[selectedObj].instance ;
671659 cur_wing = Ships[cur_ship].wingnum ;
672- if (cur_wing >= 0 ) {
673- for (auto i = 0 ; i < Wings[cur_wing].wave_count ; i++) {
674- if (wing_objects[cur_wing][i] == currentObject) {
675- cur_wing_index = i;
676- break ;
677- }
678- }
679- }
680660 } else if (Objects[selectedObj].type == OBJ_WAYPOINT ) {
681661 cur_waypoint = find_waypoint_with_instance (Objects[selectedObj].instance );
682662 Assert (cur_waypoint != nullptr );
@@ -718,12 +698,6 @@ void Editor::setupCurrentObjectIndices(int selectedObj) {
718698 if (ptr->type == OBJ_SHIP ) {
719699 cur_ship = ptr->instance ;
720700 cur_wing = Ships[cur_ship].wingnum ;
721- for (auto i = 0 ; i < Wings[cur_wing].wave_count ; i++) {
722- if (wing_objects[cur_wing][i] == currentObject) {
723- cur_wing_index = i;
724- break ;
725- }
726- }
727701 } else if (ptr->type == OBJ_WAYPOINT ) {
728702 cur_waypoint = find_waypoint_with_instance (ptr->instance );
729703 Assert (cur_waypoint != nullptr );
@@ -1183,16 +1157,6 @@ int Editor::common_object_delete(int obj) {
11831157 ai_do_objects_undocked_stuff (&Objects[obj], dock_get_first_docked_object (&Objects[obj]));
11841158 }
11851159
1186- } else if (type == OBJ_POINT ) {
1187- /*
1188- TODO: Implement briefing dialog
1189-
1190- Assert(Briefing_dialog);
1191- Briefing_dialog->delete_icon(Objects[obj].instance);
1192- Update_window = 1;
1193- */
1194- return 0 ;
1195-
11961160 } else if (type == OBJ_JUMP_NODE ) {
11971161 for (jnp = Jump_nodes.begin (); jnp != Jump_nodes.end (); ++jnp) {
11981162 if (jnp->GetSCPObject () == &Objects[obj]) {
@@ -1318,7 +1282,6 @@ int Editor::reference_handler(const char* name, sexp_ref_type type, int obj) {
13181282 Warning (LOCATION , " \" %s\" referenced by an unknown sexp source! "
13191283 " Run for the hills and let Hoffoss know right now!" , name);
13201284
1321- delete_flag = 1 ;
13221285 return 2 ;
13231286 }
13241287
@@ -1336,7 +1299,6 @@ int Editor::reference_handler(const char* name, sexp_ref_type type, int obj) {
13361299 }
13371300
13381301 if (r == 2 ) {
1339- delete_flag = 1 ;
13401302 return 2 ;
13411303 }
13421304 }
@@ -1374,7 +1336,6 @@ int Editor::reference_handler(const char* name, sexp_ref_type type, int obj) {
13741336 }
13751337
13761338 if (r == 2 ) {
1377- delete_flag = 1 ;
13781339 return 2 ;
13791340 }
13801341 }
@@ -1422,40 +1383,6 @@ int Editor::orders_reference_handler(sexp_src /*source*/, int /*source_index*/,
14221383 return 0 ;
14231384 }
14241385
1425- // TODO: add a generic dialog system for showing these dialogs
1426- /*
1427- ShipGoalsDlg dlg_goals;
1428-
1429- switch (source) {
1430- case sexp_src::SHIP_ORDER:
1431- unmark_all();
1432- mark_object(Ships[source_index].objnum);
1433-
1434- dlg_goals.self_ship = source_index;
1435- dlg_goals.DoModal();
1436- if (!query_initial_orders_empty(Ai_info[Ships[source_index].ai_index].goals))
1437- if ((Ships[source_index].wingnum >= 0) && (query_initial_orders_conflict(Ships[source_index].wingnum)))
1438- Fred_main_wnd->MessageBox("This ship's wing also has initial orders", "Possible conflict");
1439-
1440- break;
1441-
1442- case sexp_src::WING_ORDER:
1443- unmark_all();
1444- mark_wing(source_index);
1445-
1446- dlg_goals.self_wing = source_index;
1447- dlg_goals.DoModal();
1448- if (query_initial_orders_conflict(source_index))
1449- Fred_main_wnd->MessageBox("One or more ships of this wing also has initial orders", "Possible conflict");
1450-
1451- break;
1452-
1453- default: // very bad. Someone added an sexp somewhere and didn't change this.
1454- Error(LOCATION, "Unknown initial order reference source");
1455- }
1456- */
1457-
1458- delete_flag = 1 ;
14591386 return 2 ;
14601387}
14611388int Editor::sexp_reference_handler (int /* node*/ , sexp_src /* source*/ , int /* source_index*/ , const char * msg) {
@@ -1473,89 +1400,6 @@ int Editor::sexp_reference_handler(int /*node*/, sexp_src /*source*/, int /*sou
14731400 return 0 ;
14741401 }
14751402
1476- // TODO: add a generic dialog system for showing these dialogs
1477- /*
1478- int n = source_index;
1479- switch (source) {
1480- case sexp_src::SHIP_ARRIVAL:
1481- case sexp_src::SHIP_DEPARTURE:
1482- if (!Ship_editor_dialog.GetSafeHwnd())
1483- Ship_editor_dialog.Create();
1484-
1485- Ship_editor_dialog.SetWindowPos(&Fred_main_wnd->wndTop, 0, 0, 0, 0,
1486- SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
1487- Ship_editor_dialog.ShowWindow(SW_RESTORE);
1488-
1489- Ship_editor_dialog.select_sexp_node = node;
1490- unmark_all();
1491- mark_object(Ships[n].objnum);
1492- break;
1493-
1494- case sexp_src::WING_ARRIVAL:
1495- case sexp_src::WING_DEPARTURE:
1496- if (!Wing_editor_dialog.GetSafeHwnd())
1497- Wing_editor_dialog.Create();
1498-
1499- Wing_editor_dialog.SetWindowPos(&Fred_main_wnd->wndTop, 0, 0, 0, 0,
1500- SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
1501- Wing_editor_dialog.ShowWindow(SW_RESTORE);
1502-
1503- Wing_editor_dialog.select_sexp_node = node;
1504- unmark_all();
1505- mark_wing(n);
1506- break;
1507-
1508- case sexp_src::EVENT:
1509- if (Message_editor_dlg) {
1510- Fred_main_wnd->MessageBox("You must close the message editor before the event editor can be opened");
1511- break;
1512- }
1513-
1514- if (!Event_editor_dlg) {
1515- Event_editor_dlg = new event_editor;
1516- Event_editor_dlg->select_sexp_node = node;
1517- Event_editor_dlg->Create(event_editor::IDD);
1518- }
1519-
1520- Event_editor_dlg->SetWindowPos(&CWnd::wndTop, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
1521- Event_editor_dlg->ShowWindow(SW_RESTORE);
1522- break;
1523-
1524- case sexp_src::MISSION_GOAL: {
1525- CMissionGoalsDlg dlg;
1526-
1527- dlg.select_sexp_node = node;
1528- dlg.DoModal();
1529- break;
1530- }
1531-
1532- case sexp_src::DEBRIEFING: {
1533- debriefing_editor_dlg dlg;
1534-
1535- dlg.select_sexp_node = node;
1536- dlg.DoModal();
1537- break;
1538- }
1539-
1540- case sexp_src::BRIEFING: {
1541- if (!Briefing_dialog) {
1542- Briefing_dialog = new briefing_editor_dlg;
1543- Briefing_dialog->create();
1544- }
1545-
1546- Briefing_dialog->SetWindowPos(&Briefing_dialog->wndTop, 0, 0, 0, 0,
1547- SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
1548- Briefing_dialog->ShowWindow(SW_RESTORE);
1549- Briefing_dialog->focus_sexp(node);
1550- break;
1551- }
1552-
1553- default: // very bad. Someone added an sexp somewhere and didn't change this.
1554- Error(LOCATION, "Unknown sexp reference source");
1555- }
1556- */
1557-
1558- delete_flag = 1 ;
15591403 return 2 ;
15601404}
15611405int Editor::delete_ship_from_wing (int ship) {
@@ -1568,10 +1412,6 @@ int Editor::delete_ship_from_wing(int ship) {
15681412 cur_wing = -1 ;
15691413 r = delete_wing (wing, 1 );
15701414 if (r) {
1571- if (r == 2 ) {
1572- delete_flag = 1 ;
1573- }
1574-
15751415 return r;
15761416 }
15771417
@@ -1906,21 +1746,22 @@ void Editor::updateStartingWingLoadoutUseCounts() {
19061746}
19071747void Editor::delete_marked () {
19081748 object* ptr, * next;
1749+ bool navigated_to_reference = false ;
19091750
1910- delete_flag = 0 ;
19111751 ptr = GET_FIRST (&obj_used_list);
19121752 while (ptr != END_OF_LIST (&obj_used_list)) {
19131753 next = GET_NEXT (ptr);
19141754 if (ptr->flags [Object::Object_Flags::Marked]) {
19151755 if (delete_object (OBJ_INDEX (ptr)) == 2 ) { // user went to a reference, so don't get in the way.
1756+ navigated_to_reference = true ;
19161757 break ;
19171758 }
19181759 }
19191760
19201761 ptr = next;
19211762 }
19221763
1923- if (!delete_flag ) {
1764+ if (!navigated_to_reference ) {
19241765 setupCurrentObjectIndices (-1 );
19251766 }
19261767
@@ -2231,15 +2072,6 @@ void Editor::pad_with_newline(SCP_string& str, size_t max_size) {
22312072 }
22322073}
22332074
2234- void Editor::lcl_fred_replace_stuff (QString& text)
2235- {
2236- // this should be kept in sync with the function in localize.cpp
2237- text.replace (" \" " , " $quote" );
2238- text.replace (" ;" , " $semicolon" );
2239- text.replace (" /" , " $slash" );
2240- text.replace (" \\ " , " $backslash" );
2241- }
2242-
22432075SCP_string Editor::get_display_name_for_text_box (const SCP_string &orig_name)
22442076{
22452077 auto index = get_index_of_first_hash_symbol (orig_name);
0 commit comments