View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002813 | FSSCP | Pilot data | public | 2013-03-18 06:52 | 2013-04-01 07:40 |
Reporter | Goober5000 | Assigned To | niffiwan | ||
Priority | normal | Severity | block | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.6.19 | ||||
Target Version | 3.7.0 | ||||
Summary | 0002813: Vanishing pilots? | ||||
Description | Today I tried compiling the latest source in SVN to test out a new mod. First I noticed that the pilot selection screen said that I already had the maximum number of pilots, which seemed odd. So I deleted a few old test pilots and created a new one. At one point I had to exit the game and re-load it. Unfortunately, when I got back to the pilot selection screen, not only was my new pilot nowhere to be found, but the screen still said that I had the maximum number of pilots. This is despite the fact that I deleted *multiple* old test pilots but only create a single new test pilot. So I did the same thing I did before: delete multiple old test pilots and created a single new one. To further confuse things, the same exact thing happened when I loaded up the engine a *third* time: my new pilot had vanished, and when I tried to create a new one the screen said that I already had the maximum number. | ||||
Tags | No tags attached. | ||||
|
Gah - I think I know exactly what is causing this. The pilot conversion routine doesn't respect the max pilot limit, that combined with the fact that FSO only finds the 1st 20 (i.e. max pilot limit) pilot files returned by the OS (in the order *defined* by the OS), means that it's quite possible for newly created pilots to "vanish". I think the best solution may be to make the pilot conversion routine respect the max pilot limit. Otherwise, the alternative would be to make the find-pilots-and-return-the-1st-20-in-datetime-order grab a total of 40 pilots, and then only return the 1st 20 (but actually, that kinda sucks too) (I say 40, because the max pilots you should be able to ever have is 20 created with the new pilot code, plus 20 converted from the old pilot code) |
|
Can you please test the attached patch? It should stop the problem from occurring in future. First though, you'll need to remove enough pilots (*.plr & *.csg) from data/players to have <= 20 pilots. I don't think there's any safe way for FSO to delete the pilots of anyone who's got into your situation, the player needs to decide which pilots they want to keep. Or you can delete pilots one or more at a time from the selection screen & restart FSO (without creating any new pilots) until the missing pilot returns, obviously this may take longer than the 1st approach. |
|
mantis2813-svn.patch (1,214 bytes)
Index: code/pilotfile/pilotfile_convert.cpp =================================================================== --- code/pilotfile/pilotfile_convert.cpp (revision 9585) +++ code/pilotfile/pilotfile_convert.cpp (working copy) @@ -2,6 +2,7 @@ #include "globalincs/pstypes.h" #include "pilotfile/pilotfile_convert.h" #include "cfile/cfile.h" +#include "playerman/managepilot.h" pilotfile_convert::pilotfile_convert() @@ -71,6 +72,7 @@ { size_t idx, j, i; size_t count, inf_count; + int max_convert, num_converted = 0; SCP_vector<SCP_string> existing; SCP_vector<SCP_string> old_files; @@ -103,8 +105,12 @@ } } + // don't convert enough pilots to exceed the pilot limit + max_convert = MAX_PILOTS - existing.size(); + // if everything is already converted then bail - if (i == count) { + // also bail if MAX_PILOTS (or more!) already exist + if (i == count || max_convert <= 0) { return; } @@ -136,9 +142,15 @@ for (j = 0; j < savefiles.size(); j++) { pcon->csg_convert(savefiles[j].c_str(), inferno); } + + ++num_converted; } delete pcon; + + if (num_converted >= max_convert) { + break; + } } mprintf(("PILOT: Pilot file conversion complete!\n")); |
|
Oops. size_t is unsigned. New patch uploaded. |
|
I tested this on IRC last week and it appears to have fixed the problem. The patch can be committed. |
|
Fix committed to trunk@9614. |
Date Modified | Username | Field | Change |
---|---|---|---|
2013-03-18 06:52 | Goober5000 | New Issue | |
2013-03-18 07:48 | niffiwan | Assigned To | => niffiwan |
2013-03-18 07:48 | niffiwan | Status | new => assigned |
2013-03-18 07:51 | niffiwan | Note Added: 0014776 | |
2013-03-18 07:52 | niffiwan | Note Edited: 0014776 | |
2013-03-18 07:54 | niffiwan | Note Edited: 0014776 | |
2013-03-18 07:55 | niffiwan | Note Edited: 0014776 | |
2013-03-18 10:30 | niffiwan | File Added: mantis2813-svn.patch | |
2013-03-18 10:37 | niffiwan | File Deleted: mantis2813-svn.patch | |
2013-03-18 10:37 | niffiwan | File Added: mantis2813-svn.patch | |
2013-03-18 11:01 | niffiwan | Note Added: 0014777 | |
2013-03-18 11:01 | niffiwan | Status | assigned => feedback |
2013-03-19 09:51 | niffiwan | File Deleted: mantis2813-svn.patch | |
2013-03-19 09:51 | niffiwan | File Added: mantis2813-svn.patch | |
2013-03-19 09:52 | niffiwan | Note Added: 0014783 | |
2013-04-01 06:18 | Goober5000 | Note Added: 0014864 | |
2013-04-01 06:18 | Goober5000 | Status | feedback => assigned |
2013-04-01 07:40 | niffiwan | Changeset attached | => fs2open trunk r9614 |
2013-04-01 07:40 | niffiwan | Note Added: 0014865 | |
2013-04-01 07:40 | niffiwan | Status | assigned => resolved |
2013-04-01 07:40 | niffiwan | Resolution | open => fixed |