Skip to content

Commit 86622e1

Browse files
authored
Fix Edge-case with $Preload briefing icon models: (#6850)
Found a very interesting edge case bug with `$Preload briefing icon models:.` Situation: Mission 1 has a briefing which has a ship class A as the class (and thus loads the model), but the ship class A is not actually in that mission so no subsystems are loaded. Then in mission 2, the ship class A is actually in the mission but FSO tries to reuse the slot that was loaded, but realizes no subsystems were loaded and makes an error message. I that is because the preload code for the briefing icons on `missionparse.cpp` line 6664 just calls `model_load` but does not specify the subsystem argument. I've also attached a retail mod reproducible campaign (2 missions, first is 5 seconds long). When the second mission loads the incorrect subsystem warning appears. This PR properly loads the subsystems and fixes the bug. Tested and works as expected.
1 parent 199c7b7 commit 86622e1

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

code/mission/missionparse.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6661,7 +6661,8 @@ bool post_process_mission(mission *pm)
66616661
for (i = 0; i < Briefings[team].num_stages; i++) {
66626662
const auto &stage = br[i];
66636663
for (int j = 0; j < stage.num_icons; j++) {
6664-
stage.icons[j].modelnum = model_load(Ship_info[stage.icons[j].ship_class].pof_file);
6664+
ship_info *sip = &Ship_info[stage.icons[j].ship_class];
6665+
stage.icons[j].modelnum = model_load(sip->pof_file, sip);
66656666
}
66666667
}
66676668
}

0 commit comments

Comments
 (0)