View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002810 | FSSCP | Pilot data | public | 2013-03-16 07:23 | 2013-03-21 07:06 |
Reporter | FUBAR-BDHR | Assigned To | niffiwan | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.6.19 | ||||
Summary | 0002810: Incorrect default pilot after deleting a pre 3.6.19 pilot file | ||||
Description | Doing some testing I cleaned up some test pilots before creating a new test pilots. One of these pilots was created with the 3.6.19 build before any changes were made except the file names so for all purposes it was a 3.6.18 build. That pilot was named test8. I created the new pilot called newtest and proceeded to run the test and exit the game normally. Needed to run the test again so I launched the game again. Test8 was back (expected as it reconverted) but was also now the default pilot with newtest that should have been the default second on the list. | ||||
Steps To Reproduce | Launch 3.6.18 or earlier, create a pilot, exit game. Launch latest trunk, delete the pilot created above. Create another new pilot with a different name, launch the game with this pilot, exit game. Launch the game again the first pilot created will be back and is set as default. | ||||
Tags | No tags attached. | ||||
|
IIRC, this is expected behaviour. FSO "remembers" which pilot was used last by the last modified date on the pilotfile. If a pilot gets converted, it automatically has a date more recent than any other pilot, because any other pilot could not have been updated any more recently than the last time FSO closed. I guess that something could be done for literally only the last used pilot, since that gets stored in the registry (or fs2_open.ini). But is it really worth the effort for something (that IMO at least) is not such a big deal? :) [s]So, um, convince me of your point of view :)[/s] edit: Actually - after some more thought, what's the point in storing the last used pilot / player if it isn't actually used. So, good argument, you didn't even have to say anything :D |
|
Well I was looking to see how the last used pilot was determined and came across this little gem: int player_select_get_last_pilot_info() { // TODO: Replace this with a function that does this properly for the new pilot code. So apparently it is one of those things that was on someones todo list and they todidnt'. |
|
mantis2810-svn.patch (1,530 bytes)
Index: code/menuui/playermenu.cpp =================================================================== --- code/menuui/playermenu.cpp (revision 9584) +++ code/menuui/playermenu.cpp (working copy) @@ -800,7 +800,10 @@ // Player_select_last_is_multi = Player_select_last_pilot[strlen(Player_select_last_pilot)-1] == 'M' ? 1 : 0; Player_select_last_is_multi = 0; - Player_select_last_pilot[strlen(Player_select_last_pilot)-1]='\0'; + // handle changing from pre-pilot code to post-pilot code + if (Player_select_last_pilot[strlen(Player_select_last_pilot)-1] == 'M' || Player_select_last_pilot[strlen(Player_select_last_pilot)-1] == 'S') { + Player_select_last_pilot[strlen(Player_select_last_pilot)-1]='\0'; // chop off last char, M|P + } return 1; } @@ -857,6 +860,22 @@ Player_select_num_pilots = cf_get_file_list_preallocated(MAX_PILOTS, Pilots_arr, Pilots, CF_TYPE_PLAYERS, NOX("*.plr"), CF_SORT_TIME); + // if we have a "last_player", and they're in the list, bash them to the top of the list + if (Player_select_last_pilot[0] != '\0') { + int i,j; + for (i = 0; i < Player_select_num_pilots; ++i) { + if (!stricmp(Player_select_last_pilot,Pilots[i])) { + break; + } + } + if (i != Player_select_num_pilots) { + for (j = i; j > 0; --j) { + strncpy(Pilots[j], Pilots[j-1], strlen(Pilots[j-1])+1); + } + strncpy(Pilots[0], Player_select_last_pilot, strlen(Player_select_last_pilot)+1); + } + } + Player = NULL; // if this value is -1, it means we should set it to the num pilots count |
|
Please test the attached patch. It should ensure that the "last player" recorded in the registry/fs2_open.ini should always be at the top of the initial player selection list (assuming that it's found by FSO in the 1st place, it's conceivable that the last pilot may be missing in certain edge cases) All other pilots in the list will be sorted by pilotfile last-modified-date, so you might get some unexpected ordering there due to pilots being converted, etc. |
|
Looks like this one works. Deleted pilot showed up second in list after reconvert with last used pilot at top and selected. |
|
Fix committed to trunk@9592. |
Date Modified | Username | Field | Change |
---|---|---|---|
2013-03-16 07:23 | FUBAR-BDHR | New Issue | |
2013-03-16 08:33 | niffiwan | Assigned To | => niffiwan |
2013-03-16 08:33 | niffiwan | Status | new => assigned |
2013-03-16 08:39 | niffiwan | Note Added: 0014769 | |
2013-03-16 08:50 | niffiwan | Note Edited: 0014769 | |
2013-03-17 02:10 | FUBAR-BDHR | Note Added: 0014772 | |
2013-03-17 04:45 | niffiwan | File Added: mantis2810-svn.patch | |
2013-03-17 04:48 | niffiwan | Note Added: 0014774 | |
2013-03-17 04:48 | niffiwan | Status | assigned => feedback |
2013-03-21 03:06 | FUBAR-BDHR | Note Added: 0014789 | |
2013-03-21 03:06 | FUBAR-BDHR | Status | feedback => assigned |
2013-03-21 07:06 | niffiwan | Changeset attached | => fs2open trunk r9592 |
2013-03-21 07:06 | niffiwan | Note Added: 0014791 | |
2013-03-21 07:06 | niffiwan | Status | assigned => resolved |
2013-03-21 07:06 | niffiwan | Resolution | open => fixed |