Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion code/ship/ship.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19022,7 +19022,20 @@ void ship_page_in()
// Model already loaded
model_previously_loaded = it->model_num;

if ((sip->n_subsystems > 0) && (sip->subsystems[0].model_num > -1)) {
// The class found above may only have model_num set (e.g. by a briefing closeup) without
// linked subsystems. If this class is already linked to this model, keep its links rather
// than clearing them and relying on ship_copy_subsystem_fixup() to find another source.
bool sip_already_linked = (sip->n_subsystems > 0);
for (k = 0; k < sip->n_subsystems; k++) {
if (sip->subsystems[k].model_num != model_previously_loaded) {
sip_already_linked = false;
break;
}
}

if (sip_already_linked) {
ship_previously_loaded = i;
} else if ((sip->n_subsystems > 0) && (sip->subsystems[0].model_num > -1)) {
ship_previously_loaded = (int)std::distance(Ship_info.begin(), it);

// It is possible in some cases for sip->model_num to change, and for subsystems->model_num
Expand Down
Loading