Skip to content

Commit 9c65e1c

Browse files
authored
Merge pull request scp-fs2open#7008 from Goober5000/more_fred_replace_stuff
add additional double quote conversion to FRED and qtFRED
2 parents 69dfe81 + 2d37a24 commit 9c65e1c

13 files changed

+49
-5
lines changed

fred2/briefingeditordlg.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,7 @@ void briefing_editor_dlg::update_data(int update)
467467
ptr->icons[m_last_icon].id = m_id;
468468

469469
string_copy(buf, m_icon_label, MAX_LABEL_LEN - 1);
470+
lcl_fred_replace_stuff(buf, MAX_LABEL_LEN - 1);
470471
if (stricmp(ptr->icons[m_last_icon].label, buf) && !m_change_local) {
471472
set_modified();
472473
reset_icon_loop(m_last_stage);
@@ -476,6 +477,7 @@ void briefing_editor_dlg::update_data(int update)
476477
strcpy_s(ptr->icons[m_last_icon].label, buf);
477478

478479
string_copy(buf, m_icon_closeup_label, MAX_LABEL_LEN - 1);
480+
lcl_fred_replace_stuff(buf, MAX_LABEL_LEN - 1);
479481
if (stricmp(ptr->icons[m_last_icon].closeup_label, buf) && !m_change_local) {
480482
set_modified();
481483
reset_icon_loop(m_last_stage);

fred2/eventeditor.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,8 @@ void event_editor::save_event(int e)
911911
}
912912

913913
// handle objective text
914+
lcl_fred_replace_stuff(m_obj_text);
915+
lcl_fred_replace_stuff(m_obj_key_text);
914916
m_events[e].objective_text = (LPCTSTR)m_obj_text;
915917
m_events[e].objective_key_text = (LPCTSTR)m_obj_key_text;
916918

fred2/initialstatus.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,7 @@ void initial_status::change_subsys()
599599

600600
// update cargo name
601601
if (strlen(m_cargo_name) > 0) { //-V805
602+
lcl_fred_replace_stuff(m_cargo_name);
602603
cargo_index = string_lookup(m_cargo_name, Cargo_names, Num_cargo);
603604
if (cargo_index == -1) {
604605
if (Num_cargo < MAX_CARGO);

fred2/jumpnodedlg.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,9 @@ int jumpnode_dlg::update_data()
303303
m_name = _T(jnp->GetName());
304304
UpdateData(FALSE);
305305
}
306-
306+
307+
lcl_fred_replace_stuff(m_display);
308+
307309
strcpy_s(old_name, jnp->GetName());
308310
jnp->SetName((LPCSTR) m_name);
309311
jnp->SetDisplayName((m_display.CompareNoCase("<none>") == 0) ? m_name : m_display);

fred2/missiongoalsdlg.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@ void CMissionGoalsDlg::OnChangeGoalDesc()
436436
}
437437

438438
UpdateData(TRUE);
439+
lcl_fred_replace_stuff(m_goal_desc);
439440
string_copy(m_goals[cur_goal].message, m_goal_desc);
440441
}
441442

fred2/missionsave.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3624,12 +3624,22 @@ int CFred_mission_save::save_objects()
36243624

36253625
// optional alternate type name
36263626
if (strlen(Fred_alt_names[i])) {
3627-
fout("\n$Alt: %s\n", Fred_alt_names[i]);
3627+
if (optional_string_fred("$Alt:", "$Team:")) {
3628+
parse_comments();
3629+
} else {
3630+
fout("\n$Alt:");
3631+
}
3632+
fout(" %s", Fred_alt_names[i]);
36283633
}
36293634

36303635
// optional callsign
36313636
if (Mission_save_format != FSO_FORMAT_RETAIL && strlen(Fred_callsigns[i])) {
3632-
fout("\n$Callsign: %s\n", Fred_callsigns[i]);
3637+
if (optional_string_fred("$Callsign:", "$Team:")) {
3638+
parse_comments();
3639+
} else {
3640+
fout("\n$Callsign:");
3641+
}
3642+
fout(" %s", Fred_callsigns[i]);
36333643
}
36343644

36353645
required_string_fred("$Team:");

fred2/shipeditordlg.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,6 +1291,8 @@ int CShipEditorDlg::update_ship(int ship)
12911291
CComboBox *box;
12921292
int persona;
12931293

1294+
lcl_fred_replace_stuff(m_ship_display_name);
1295+
12941296
// the display name was precalculated, so now just assign it
12951297
if (m_ship_display_name == m_ship_name || m_ship_display_name.CompareNoCase("<none>") == 0)
12961298
{
@@ -1332,6 +1334,7 @@ int CShipEditorDlg::update_ship(int ship)
13321334
MODIFY(Ships[ship].weapons.ai_class, m_ai_class);
13331335
}
13341336
if (strlen(m_cargo1)) {
1337+
lcl_fred_replace_stuff(m_cargo1);
13351338
z = string_lookup(m_cargo1, Cargo_names, Num_cargo);
13361339
if (z == -1) {
13371340
if (Num_cargo < MAX_CARGO) {

qtfred/src/mission/dialogs/JumpNodeEditorDialogModel.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include "globalincs/linklist.h"
44
#include <jumpnode/jumpnode.h>
5+
#include <localization/localize.h>
56
#include <mission/missionparse.h>
67
#include <mission/object.h>
78
#include <model/model.h>
@@ -39,6 +40,8 @@ bool JumpNodeEditorDialogModel::apply()
3940
std::strncpy(old_name_buf, jnp->GetName(), NAME_LENGTH - 1);
4041
old_name_buf[NAME_LENGTH - 1] = '\0';
4142

43+
lcl_fred_replace_stuff(_display);
44+
4245
jnp->SetName(_name.c_str());
4346
jnp->SetDisplayName(lcase_equal(_display, "<none>") ? _name.c_str() : _display.c_str());
4447

qtfred/src/mission/dialogs/MissionGoalsDialogModel.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <localization/localize.h>
12
#include "MissionGoalsDialogModel.h"
23

34

@@ -167,6 +168,7 @@ mission_goal& MissionGoalsDialogModel::createNewGoal() {
167168
void MissionGoalsDialogModel::setCurrentGoalMessage(const char* text) {
168169
Assertion(isCurrentGoalValid(), "Current goal is not valid!");
169170
getCurrentGoal().message = text;
171+
lcl_fred_replace_stuff(getCurrentGoal().message);
170172

171173
set_modified();
172174
modelChanged();

qtfred/src/mission/dialogs/ShipEditor/ShipEditorDialogModel.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "mission/missionmessage.h"
1515

1616
#include <globalincs/linklist.h>
17+
#include <localization/localize.h>
1718
#include <mission/object.h>
1819

1920
#include <QtWidgets>
@@ -637,6 +638,8 @@ namespace fso {
637638
int z, d;
638639
SCP_string str;
639640

641+
lcl_fred_replace_stuff(_m_ship_display_name);
642+
640643
// the display name was precalculated, so now just assign it
641644
if (_m_ship_display_name == _m_ship_name || stricmp(_m_ship_display_name.c_str(), "<none>") == 0)
642645
{
@@ -675,6 +678,7 @@ namespace fso {
675678
Ships[ship].weapons.ai_class = _m_ai_class;
676679
}
677680
if (!_m_cargo1.empty()) {
681+
lcl_fred_replace_stuff(_m_cargo1);
678682
z = string_lookup(_m_cargo1.c_str(), Cargo_names, Num_cargo);
679683
if (z == -1) {
680684
if (Num_cargo < MAX_CARGO) {

0 commit comments

Comments
 (0)