View Issue Details

IDProjectCategoryView StatusLast Update
0003065FSSCPgameplaypublic2014-08-18 13:23
Reporterniffiwan Assigned Toniffiwan  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.7.2 RC3 
Target Version3.7.2 
Summary0003065: redalert data is not cleared when you reset a campaign
DescriptionProbably doesn't have any effect unless you're playing a campaign that starts with a redalert mission - which would be pretty odd. Regardless, it may/may not cause other unintended issues and should be a fairly easy fix.
TagsNo tags attached.

Relationships

related to 0003020 resolvedniffiwan pilot stats not behaving when switching campaigns or cloning 

Activities

niffiwan

2014-08-16 03:09

developer   ~0016221

Patch attached to resolve the issue. Previously red alert data would propagate between pilots and campaigns in a number of ways.

1) (per this issue) resetting a campaign doesn't remove old RA data
2) switching to a campaign without any existing RA data (including an unplayed campaign) doesn't clear RA data from the old campaign
3) switching to a newly created pilot doesn't clear RA data from the old pilots active campaign

Having said that, this doesn't actually cause any observable issues unless a campaign has a 'part 2' RA mission without a preceding 'part 1'. In every case I can think of, any incorrect RA data will be overwritten by new RA data before it can be used.

Regardless, the patch should resolve these issues by ensuring that when a campaign is loaded and the CSG file for the new campaign is not valid, old RA data is removed. I've tested this with a dummy campaign (see attachment; requires Derelict 3.7.0) that just has RA missions; and using a hex editor on the CSG files to confirm/deny the presence of RA data.

Lasty - why bother at all? It's cleaner and less confusing, and figuring out this problem also led to a solution to the pretty much identical stats problem in the related ticket.

niffiwan

2014-08-16 03:09

developer  

derelict-tst.fc2 (1,259 bytes)

niffiwan

2014-08-17 04:34

developer  

mantis3065-svn.patch (2,059 bytes)   
Index: code/mission/missioncampaign.cpp
===================================================================
--- code/mission/missioncampaign.cpp	(revision 11000)
+++ code/mission/missioncampaign.cpp	(working copy)
@@ -653,6 +653,8 @@
 				Campaign_load_failure = CAMPAIGN_ERROR_SAVEFILE;
 				return CAMPAIGN_ERROR_SAVEFILE;
 			} else {
+				// make sure we initialize red alert data for the new CSG
+				red_alert_clear();
 				Pilot.save_savefile();
 			}
 		}
Index: code/missionui/redalert.cpp
===================================================================
--- code/missionui/redalert.cpp	(revision 11000)
+++ code/missionui/redalert.cpp	(working copy)
@@ -1096,3 +1096,14 @@
 		gameseq_post_event(GS_EVENT_END_GAME);
 	}
 }
+
+/*
+ * red_alert_clear()
+ *
+ * clear all red alert "wingman" data
+ * Allows data to be cleared from outside REDALERT_INTERNAL code
+ */
+void red_alert_clear()
+{
+	Red_alert_wingman_status.clear();
+}
Index: code/missionui/redalert.h
===================================================================
--- code/missionui/redalert.h	(revision 11000)
+++ code/missionui/redalert.h	(working copy)
@@ -28,6 +28,7 @@
 
 void red_alert_store_wingman_status();
 void red_alert_bash_wingman_status();
+void red_alert_clear();
 
 void red_alert_voice_pause();
 void red_alert_voice_unpause();
Index: code/pilotfile/csg.cpp
===================================================================
--- code/pilotfile/csg.cpp	(revision 11000)
+++ code/pilotfile/csg.cpp	(working copy)
@@ -790,10 +790,6 @@
 		return;
 	}
 
-	// about to read new redalert data so flush any existing data
-	// otherwise wingman entries will multiply like rabbits
-	Red_alert_wingman_status.clear();
-
 	cfread_string_len(t_string, MAX_FILENAME_LEN, cfp);
 
 	Red_alert_precursor_mission = t_string;
@@ -1301,6 +1297,9 @@
 		Campaign.redalert_variables = NULL;
 	}
 
+	// clear red alert data
+	Red_alert_wingman_status.clear();
+
 	// clear out mission stuff
 	for (idx = 0; idx < MAX_CAMPAIGN_MISSIONS; idx++) {
 		missionp = &Campaign.missions[idx];
mantis3065-svn.patch (2,059 bytes)   

niffiwan

2014-08-17 08:17

developer   ~0016231

Fix committed to trunk@11007.

Goober5000

2014-08-18 13:23

administrator   ~0016237

Heh. As a historical note, this will fix the weirdness with the original Silent Threat campaign, which had a Part 2 red-alert (save the Krios) without a Part 1. The mission was designed for a Ulysses, but many players found that they were flying an Ursa or other seemingly random craft. This was because 99% of the players had just finished playing the main campaign, and their pilot dutifully carried over the red-alert data from the "pursue the Lucifer into subspace" mission.

Related Changesets

fs2open: trunk r11007

2014-08-17 04:46

niffiwan


Ported: N/A

Details Diff
Fix mantis 3065 (clear RA data)

Clear red alert data when resetting campaign progress, changing
campaigns and switching pilots
In CSG read, move RA data clear from the read RA section to the data
reset function (i.e. clear if CSG is valid, not if section contains
data)
Affected Issues
0003065
mod - /trunk/fs2_open/code/missionui/redalert.cpp Diff File
mod - /trunk/fs2_open/code/mission/missioncampaign.cpp Diff File
mod - /trunk/fs2_open/code/pilotfile/csg.cpp Diff File
mod - /trunk/fs2_open/code/missionui/redalert.h Diff File

Issue History

Date Modified Username Field Change
2014-06-19 10:27 niffiwan New Issue
2014-06-19 10:27 niffiwan Status new => assigned
2014-06-19 10:27 niffiwan Assigned To => niffiwan
2014-08-16 02:57 niffiwan File Added: mantis3065-svn.patch
2014-08-16 03:09 niffiwan Note Added: 0016221
2014-08-16 03:09 niffiwan File Added: derelict-tst.fc2
2014-08-16 03:10 niffiwan Relationship added related to 0003020
2014-08-16 03:10 niffiwan Status assigned => code review
2014-08-17 04:34 niffiwan File Deleted: mantis3065-svn.patch
2014-08-17 04:34 niffiwan File Added: mantis3065-svn.patch
2014-08-17 08:17 niffiwan Changeset attached => fs2open trunk r11007
2014-08-17 08:17 niffiwan Note Added: 0016231
2014-08-17 08:17 niffiwan Status code review => resolved
2014-08-17 08:17 niffiwan Resolution open => fixed
2014-08-18 13:23 Goober5000 Note Added: 0016237