Skip to content

Commit fc48fac

Browse files
committed
miscellaneous fixes
1. When loading and saving lighting profiles, treat an empty string as equivalent to the default name 2. Remove unused fields from the mission struct 3. Properly guard union initialization in `add_message`
1 parent ce31a33 commit fc48fac

5 files changed

Lines changed: 12 additions & 5 deletions

File tree

code/lab/renderer/lab_renderer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,8 @@ void LabRenderer::useBackground(const SCP_string& mission_name) {
422422
ltp_name = ltp::default_name();
423423
if(optional_string("$Lighting Profile:")){
424424
stuff_string(ltp_name,F_NAME);
425+
if (ltp_name.empty())
426+
ltp_name = ltp::default_name();
425427
}
426428
if (ltp_name != ltp::current()->name) {
427429
ltp::switch_to(ltp_name);

code/mission/missionmessage.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2647,8 +2647,13 @@ bool add_message(const char* name, const char* message, int persona_index, int m
26472647
strcpy_s(msg.message, message);
26482648
msg.persona_index = persona_index;
26492649
msg.multi_team = multi_team;
2650-
msg.avi_info.index = -1;
2651-
msg.wave_info.index = -1;
2650+
if (Fred_running) {
2651+
msg.avi_info.name = nullptr;
2652+
msg.wave_info.name = nullptr;
2653+
} else {
2654+
msg.avi_info.index = -1;
2655+
msg.wave_info.index = -1;
2656+
}
26522657
Messages.push_back(msg);
26532658
Num_messages++;
26542659

code/mission/missionparse.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,6 +1002,8 @@ void parse_mission_info(mission *pm, bool basic = false)
10021002
if (optional_string("$Lighting Profile:"))
10031003
{
10041004
stuff_string(The_mission.lighting_profile_name, F_NAME);
1005+
if (The_mission.lighting_profile_name.empty())
1006+
The_mission.lighting_profile_name = lighting_profiles::default_name();
10051007
}
10061008
else
10071009
The_mission.lighting_profile_name = lighting_profiles::default_name();

code/mission/missionparse.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,6 @@ typedef struct mission {
208208
int skybox_flags;
209209
int contrail_threshold;
210210
int ambient_light_level;
211-
float neb_far_multi;
212-
float neb_near_multi;
213211
std::optional<volumetric_nebula> volumetrics;
214212
sound_env sound_environment;
215213
vec3d gravity;

code/missioneditor/missionsave.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2977,7 +2977,7 @@ int Fred_mission_save::save_mission_info()
29772977
fso_comment_pop();
29782978

29792979
// EatThePath's lighting profiles
2980-
if (The_mission.lighting_profile_name != lighting_profiles::default_name()) {
2980+
if (!The_mission.lighting_profile_name.empty() && The_mission.lighting_profile_name != lighting_profiles::default_name()) {
29812981
fso_comment_push(";;FSO 23.1.0;;");
29822982
if (optional_string_fred("$Lighting Profile:")) {
29832983
parse_comments(2);

0 commit comments

Comments
 (0)