fs2open.github.com icon indicating copy to clipboard operation
fs2open.github.com copied to clipboard

better stats handling when switching or resetting campaigns

Open Goober5000 opened this issue 7 years ago • 0 comments

~~This PR is an offshoot of #1450, and depends on that for full functionality (I'll rebase this when that's merged)~~ Rebase complete.

I ended up going down a rabbit hole of trying to figure out why all-time stats kept getting reset whenever the player would switch campaigns. There are a few improvements here:

  1. A proper clear_savefile function, based on the internal clear_csg_data function. This is invoked when the game tries to load a savefile that isn't found. The campaign data is cleared and assigned to a proper state to begin the campaign, rather than winging it. Note that allowed ships and weapons are NOT cleared, since they were just parsed from the campaign file. There is no capability to revert to starting ships and weapons like there is for the starting tech database, and zeroing the entire fields is the wrong thing to do.

  2. Player stats are not cleared when the campaign savefile data is cleared. I believe this is the correct fix because the stats represent all-time stats, and we want those to persist regardless of which campaign the player is playing.

  3. Then there's the fix to Mantis 3174, but that's covered in PR #1450.

I thought point 2 above would fix the stat-clearing issue, but for whatever reason, all-time stats continue to be zeroed out when the player switches campaigns. There must be some hidden dependency I haven't found yet.

Goober5000 avatar Aug 26 '17 07:08 Goober5000