View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002906 | FSSCP | Pilot data | public | 2013-07-31 08:32 | 2014-05-24 10:19 |
Reporter | Macfie | Assigned To | niffiwan | ||
Priority | urgent | Severity | major | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | windows | OS | vista | ||
Product Version | 3.6.19 | ||||
Target Version | 3.7.1 | ||||
Summary | 0002906: Pilot cloned with stats from previous pilot | ||||
Description | I created a new pilot by cloning an old pilot. When I did it kept all the statistics from the old pilot including medals and promotions. | ||||
Tags | No tags attached. | ||||
|
fso-WIN-Standard-20130730_r9737. I'll try to reproduce this tonight and attach the pilot file. |
|
|
|
I uploaded a 7zip file with the pilot file for the original pilot and the cloned pilot. I also cloned another pilot and got the same results. I also noted that according to the medals I've been awarded the ace medal 6 times. |
|
Are you still getting this error with the latest nightly? If so, what are the exact steps you did to get this? You might want to go into /data/players and delete any cloned pilots manually before trying again. |
|
Yes I'm still getting this error. I deleted the cloned pilot and tried again with a different pilot selected to clone. I go in to the choose pilot screen and select a pilot. Then I go to the button at the bottom and select the clone option. I tried it from the barracks with the same result |
|
Hmm. If you still have your pre-3.7 RC pilots, delete the post-3.7 RC pilots and redo the conversion with a r9747 build or later. Once that's done, and you're *still* getting this error, please post the pre-3.7 RC pilots, the post-3.7 RC pilots, and the fs2_open.log Also, is this pilot for a mod? |
|
In my testing with Macfie's uwar.plr, I can confirm that cloning the pilot reproduces the bug. However, creating a new pilot with uwar selected also produces the bug (all testing was done in the barracks). Several of my other pilots do not reproduce the bug, but one that I've been using "skipmemymissionyo" a lot with (which tends to corrupt the pilotfile) does something very similar to uwar. Only difference is that the stats are not duplicated, they're some random (but consistent between clones) value. Anyway, I created a new pilot with zero stats. I then skipped the training missions & played Surrender Belisarius, kills were 8x Herc, 1x Deimos. I then tried cloning this pilot & creating a new pilot with this one selected, and in both cases the bug appeared. Stats were identical, but kills were converted to 9x Herc and no Deimos. Exit FSO, restart, and the new pilot still has the same problem. (& attached the new pilot for reference) (& can confirm the problem exists in r9584 and does not exist in 3.6.18) |
|
|
|
Ok, so it's definitely something done in the new pilot code. I'm guessing it has to do with how the scoring is stored in the player's all-time stats and the current campaign's stats/progress. The barracks menu doesn't display the all-time stats right next to the current campaigns, so I can't tell right off where the error is occurring. |
|
I was having a problem with a current pilot and decided to create a new pilot. When I did it carried over all the statistics from the previously selected pilot to the new pilot. It also carried over the rank and wings. It didn't matter if the new pilot was created in the barracks or at the pilot selection screen. It also didn't make any difference if I had selected a different mod from what I had previously played. This was with r9771 |
|
Copying note from 0002916: The error seems to be in the all_time_stats variable. When the pilot is initially created, his scoring struct is empty as expected. However, when the pilot file is immediately saved, the saved all_time_stats will include at least one Wings medal. What's the purpose of all_time_stats? It seems to be populated when the pilots are iterated through when the pilot menu first appears. This means it contains scoring information even when a fresh pilot is created, and then that is what gets saved in the new pilot file. EDIT: Additionally, the newly created all_time_stats medals vector contains three Wings entries. I should think that any given medal should only appear in the vector once... |
|
Assigning to z64555 since he has posted the most notes on the ticket. :) |
|
z64555: I was going to have a look at this ticket on the weekend, let me know if you'd prefer to take care of it :) |
|
I think I have the issue with new pilots fixed. Now just need to fix the cloned pilots issue... |
|
mantis2906-svn.patch (2,529 bytes)
Index: code/pilotfile/pilotfile.cpp =================================================================== --- code/pilotfile/pilotfile.cpp (revision 9855) +++ code/pilotfile/pilotfile.cpp (working copy) @@ -182,4 +182,39 @@ void pilotfile::update_stats_backout(scoring_struct *stats, bool training) { -} \ No newline at end of file +} + +/** + * Reset stats stored in the .plr file; all_time_stats & multi_stats + */ +void pilotfile::reset_stats() +{ + scoring_special_t *ss_stats[] = {&all_time_stats, &multi_stats}; + + for (int i = 0; i < 2; ++i) { + ss_stats[i]->score = 0; + ss_stats[i]->assists = 0; + ss_stats[i]->score = 0; + ss_stats[i]->rank = 0; + ss_stats[i]->assists = 0; + ss_stats[i]->kill_count = 0; + ss_stats[i]->kill_count_ok = 0; + ss_stats[i]->bonehead_kills = 0; + + ss_stats[i]->p_shots_fired = 0; + ss_stats[i]->p_shots_hit = 0; + ss_stats[i]->p_bonehead_hits = 0; + + ss_stats[i]->s_shots_fired = 0; + ss_stats[i]->s_shots_hit = 0; + ss_stats[i]->s_bonehead_hits = 0; + + ss_stats[i]->missions_flown = 0; + ss_stats[i]->flight_time = 0; + ss_stats[i]->last_flown = 0; + ss_stats[i]->last_backup = 0; + + ss_stats[i]->ship_kills.clear(); + ss_stats[i]->medals_earned.clear(); + } +} Index: code/pilotfile/pilotfile.h =================================================================== --- code/pilotfile/pilotfile.h (revision 9855) +++ code/pilotfile/pilotfile.h (working copy) @@ -39,6 +39,7 @@ // updating stats, multi and/or all-time void update_stats(scoring_struct *stats, bool training = false); void update_stats_backout(scoring_struct *stats, bool training = false); + void reset_stats(); // for checking to see if a PLR file is basically valid bool verify(const char *fname, int *rank = NULL); Index: code/playerman/managepilot.cpp =================================================================== --- code/playerman/managepilot.cpp (revision 9855) +++ code/playerman/managepilot.cpp (working copy) @@ -34,6 +34,7 @@ #include "cfile/cfile.h" #include "network/multi.h" #include "mod_table/mod_table.h" +#include "pilotfile/pilotfile.h" // pilot pic image list stuff ( call pilot_load_pic_list() to make these valid ) @@ -121,7 +122,8 @@ pilot_set_random_squad_pic(p); } - p->stats.init(); + p->stats.init(); + Pilot.reset_stats(); p->stats.score = 0; p->stats.rank = RANK_ENSIGN; @@ -430,6 +432,7 @@ memset(&ci, 0, sizeof(control_info)); stats.init(); + Pilot.reset_stats(); friendly_hits = 0; friendly_damage = 0.0f; |
|
The attached patch should fix the issue. I've successfully tested pilot creation & cloning in both the initial select screen & the barracks. |
|
I tested both creation and cloning here as well. Seems to be fixed. :) |
|
Fix committed to trunk@9887. |
fs2open: trunk r9887 2013-10-06 22:26 Ported: N/A Details Diff |
Fix mantis 2906 reset stats in Pilot (i.e. .plr) on new pilot create/clone |
Affected Issues 0002906 |
|
mod - /trunk/fs2_open/code/pilotfile/pilotfile.cpp | Diff File | ||
mod - /trunk/fs2_open/code/pilotfile/pilotfile.h | Diff File | ||
mod - /trunk/fs2_open/code/playerman/managepilot.cpp | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2013-07-31 08:32 | Macfie | New Issue | |
2013-07-31 15:30 | Macfie | Note Added: 0015204 | |
2013-07-31 23:54 | Macfie | File Added: uwar.7z | |
2013-07-31 23:58 | Macfie | Note Added: 0015205 | |
2013-08-12 09:50 | z64555 | Note Added: 0015231 | |
2013-08-14 22:00 | Macfie | Note Added: 0015238 | |
2013-08-14 22:03 | Macfie | Note Edited: 0015238 | |
2013-08-15 03:05 | z64555 | Note Added: 0015239 | |
2013-08-15 03:07 | z64555 | Note Edited: 0015239 | |
2013-08-15 08:18 | niffiwan | Note Added: 0015240 | |
2013-08-15 08:23 | niffiwan | File Added: players.zip | |
2013-08-15 08:23 | niffiwan | Note Edited: 0015240 | |
2013-08-15 08:34 | niffiwan | Note Edited: 0015240 | |
2013-08-16 03:17 | z64555 | Note Added: 0015241 | |
2013-09-13 05:06 | niffiwan | Relationship added | related to 0002916 |
2013-09-13 12:23 | Macfie | Note Added: 0015271 | |
2013-09-22 08:57 | Goober5000 | Note Added: 0015280 | |
2013-09-22 09:01 | Goober5000 | Note Edited: 0015280 | |
2013-09-23 05:29 | Goober5000 | Relationship replaced | has duplicate 0002916 |
2013-09-24 03:09 | Goober5000 | Note Added: 0015291 | |
2013-09-24 03:09 | Goober5000 | Assigned To | => z64555 |
2013-09-24 03:09 | Goober5000 | Severity | minor => major |
2013-09-24 03:09 | Goober5000 | Reproducibility | have not tried => always |
2013-09-24 03:09 | Goober5000 | Status | new => assigned |
2013-09-24 03:09 | Goober5000 | Target Version | => 3.7.1 |
2013-09-24 03:10 | Goober5000 | Priority | normal => urgent |
2013-09-24 03:10 | Goober5000 | Description Updated | |
2013-09-27 01:59 | niffiwan | Note Added: 0015295 | |
2013-09-28 09:38 | niffiwan | Note Added: 0015296 | |
2013-09-28 09:38 | niffiwan | Assigned To | z64555 => niffiwan |
2013-09-29 03:16 | niffiwan | File Added: mantis2906-svn.patch | |
2013-09-29 03:18 | niffiwan | Note Added: 0015303 | |
2013-09-29 03:18 | niffiwan | Status | assigned => code review |
2013-10-07 00:19 | Goober5000 | Note Added: 0015308 | |
2013-10-07 02:06 | niffiwan | Changeset attached | => fs2open trunk r9887 |
2013-10-07 02:06 | niffiwan | Note Added: 0015309 | |
2013-10-07 02:06 | niffiwan | Status | code review => resolved |
2013-10-07 02:06 | niffiwan | Resolution | open => fixed |
2014-05-24 10:19 | niffiwan | Relationship added | related to 0002940 |