Skip to content

Commit 4b28f92

Browse files
authored
Merge pull request scp-fs2open#7622 from Goober5000/fix/port_to_fred
port several QtFRED fixes to FRED
2 parents 23efd03 + 914c8b6 commit 4b28f92

4 files changed

Lines changed: 41 additions & 22 deletions

File tree

fred2/fredrender.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2080,6 +2080,9 @@ void render_one_model_htl(object *objp) {
20802080
g3_done_instance(0);
20812081

20822082
if (Show_ship_models) {
2083+
if (Ship_info[Ships[z].ship_info_index].uses_team_colors)
2084+
render_info.set_team_color(Ships[z].team_name, Ships[z].secondary_team_name, Ships[z].team_change_timestamp, Ships[z].team_change_time);
2085+
20832086
render_info.set_flags(flags);
20842087
model_render_immediate(&render_info, Ship_info[Ships[z].ship_info_index].model_num, Ships[z].model_instance_num, &objp->orient, &objp->pos);
20852088
}

fred2/initialstatus.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,10 +492,12 @@ void initial_status::OnOK()
492492
handle_inconsistent_flag(Ships[m_ship].flags, Ship::Ship_Flags::Afterburner_locked, m_afterburner_locked);
493493
}
494494

495-
if (m_team_color_setting.IsWindowEnabled() && m_team_color_setting.GetCurSel() > 0)
496-
Ships[m_ship].team_name = Team_Names[m_team_color_setting.GetCurSel() - 1];
497-
else
498-
Ships[m_ship].team_name = "none";
495+
if (m_team_color_setting.IsWindowEnabled()) {
496+
if (m_team_color_setting.GetCurSel() > 0)
497+
Ships[m_ship].team_name = Team_Names[m_team_color_setting.GetCurSel() - 1];
498+
else
499+
Ships[m_ship].team_name = "none";
500+
}
499501

500502
update_docking_info();
501503

fred2/orienteditor.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "Management.h"
1616
#include "globalincs/linklist.h"
1717
#include "FREDView.h"
18+
#include "prop/prop.h"
1819

1920
#ifdef _DEBUG
2021
#undef THIS_FILE
@@ -136,6 +137,12 @@ BOOL orient_editor::OnInitDialog()
136137
box->AddString(jumpnode_get_by_objnum(objnum)->GetName());
137138
index[total++] = objnum;
138139

140+
} else if (ptr->type == OBJ_PROP) {
141+
if (Props[ptr->instance].has_value()) {
142+
box->AddString(Props[ptr->instance].value().prop_name);
143+
index[total++] = objnum;
144+
}
145+
139146
} else if (ptr->type != OBJ_POINT)
140147
Warning(LOCATION, "Unknown object type %d", ptr->type);
141148
}

fred2/shipflagsdlg.cpp

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -429,9 +429,12 @@ void ship_flags_dlg::update_ship(int shipnum)
429429
ship *shipp = &Ships[shipnum];
430430
object *objp = &Objects[shipp->objnum];
431431

432-
if (m_reinforcement.GetCheck() != 2)
432+
// skip this for player starts, which can be edited in a mixed multi-selection even though
433+
// the checkbox is disabled when only players are selected; set_reinforcement would add a
434+
// bogus reinforcement entry for the player, since ship_name_lookup skips player starts
435+
if ((objp->type != OBJ_START) && (m_reinforcement.GetCheck() != 2))
433436
{
434-
set_reinforcement(shipp->ship_name, m_reinforcement.GetCheck());
437+
set_reinforcement(shipp->ship_name, m_reinforcement.GetCheck());
435438
}
436439

437440
switch (m_cargo_known.GetCheck()) {
@@ -709,22 +712,26 @@ void ship_flags_dlg::update_ship(int shipnum)
709712
}
710713

711714
// deal with updating the "destroy before the mission" stuff
712-
switch (m_destroy.GetCheck()) {
713-
case 0: // this means no check in checkbox
714-
if ( shipp->flags[Ship::Ship_Flags::Kill_before_mission] )
715-
set_modified();
716-
717-
shipp->flags.remove(Ship::Ship_Flags::Kill_before_mission);
718-
break;
719-
720-
case 1: // this means checkbox is checked
721-
if ( !(shipp->flags[Ship::Ship_Flags::Kill_before_mission]) )
722-
set_modified();
723-
724-
shipp->flags.set(Ship::Ship_Flags::Kill_before_mission);
725-
m_destroy_value.save(&shipp->final_death_time);
726-
break;
727-
} // a mixed state is 2, and since it's not handled, it doesn't change
715+
// (skip this for player starts, which can be edited in a mixed multi-selection even though
716+
// the checkbox is disabled when only players are selected)
717+
if (objp->type != OBJ_START) {
718+
switch (m_destroy.GetCheck()) {
719+
case 0: // this means no check in checkbox
720+
if ( shipp->flags[Ship::Ship_Flags::Kill_before_mission] )
721+
set_modified();
722+
723+
shipp->flags.remove(Ship::Ship_Flags::Kill_before_mission);
724+
break;
725+
726+
case 1: // this means checkbox is checked
727+
if ( !(shipp->flags[Ship::Ship_Flags::Kill_before_mission]) )
728+
set_modified();
729+
730+
shipp->flags.set(Ship::Ship_Flags::Kill_before_mission);
731+
m_destroy_value.save(&shipp->final_death_time);
732+
break;
733+
} // a mixed state is 2, and since it's not handled, it doesn't change
734+
}
728735

729736
switch (m_no_arrival_music.GetCheck()) {
730737
case 0:

0 commit comments

Comments
 (0)