Skip to content

Commit 1fa5068

Browse files
authored
Merge pull request #4428 from Goober5000/fix_4412
more fixes for the skip-training-mission crash
2 parents eef9a34 + 6b9dacb commit 1fa5068

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

code/mission/missioncampaign.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,9 @@ void mission_campaign_store_goals_and_events()
951951
int cur, i;
952952
cmission *mission_obj;
953953

954+
if (!(Game_mode & GM_CAMPAIGN_MODE))
955+
return;
956+
954957
cur = Campaign.current_mission;
955958
name = Campaign.missions[cur].name;
956959

@@ -1027,6 +1030,9 @@ void mission_campaign_store_variables(int persistence_type, bool store_red_alert
10271030
int cur, i, j;
10281031
cmission *mission_obj;
10291032

1033+
if (!(Game_mode & GM_CAMPAIGN_MODE))
1034+
return;
1035+
10301036
cur = Campaign.current_mission;
10311037
mission_obj = &Campaign.missions[cur];
10321038

@@ -1092,6 +1098,9 @@ void mission_campaign_store_variables(int persistence_type, bool store_red_alert
10921098
// jg18 - adapted from mission_campaign_store_variables()
10931099
void mission_campaign_store_containers(ContainerType persistence_type, bool store_red_alert)
10941100
{
1101+
if (!(Game_mode & GM_CAMPAIGN_MODE))
1102+
return;
1103+
10951104
if (!sexp_container_has_persistent_non_eternal_containers()) {
10961105
// nothing to do
10971106
return;
@@ -1891,12 +1900,8 @@ void mission_campaign_save_on_close_variables()
18911900
{
18921901
int i;
18931902

1894-
// make sure we are actually playing a campaign
1895-
if (!(Game_mode & GM_CAMPAIGN_MODE))
1896-
return;
1897-
1898-
// make sure this is a single-player campaign
1899-
if (!(Campaign.type == CAMPAIGN_TYPE_SINGLE))
1903+
// make sure we are actually playing a single-player campaign
1904+
if (!(Game_mode & GM_CAMPAIGN_MODE) || (Campaign.type != CAMPAIGN_TYPE_SINGLE))
19001905
return;
19011906

19021907
// now save variables

0 commit comments

Comments
 (0)