Barracks bug biting you? You know, you have an old plr file that causes FS2 to crash if you try to change pilots? Or you have been messing around with mods, and now your favorite plr file seems to be corrupt? Here’s the scoop:
In Ship.h:
#define MAX_SHIP_TYPES 130
The ships.tbl is parsed in Ship.cpp, and the global int Num_ship_types is set equal to the number of ships defined in ships.tbl. So far, no problem.
In Barracks.cpp, the function barracks_init_stats() builds an array of strings to be displayed when you view your stats. There are 20 lines of miscellaneous stats, followed by one line for each type of ship you have killed. Problem is this define near the top of Barracks.cpp:
#define NUM_STAT_LINES 85
Only 65 lines of text are reserved to display kills-by-ship-type. Kill that 66th ship type and FS2 crashes when you try going to the Barracks screen.
The fix is simple. Increase NUM_STAT_LINES:
#define NUM_STAT_LINES 150
Better yet, do this just in case someone increases the ship types limit:
#define NUM_STAT_LINES MAX_SHIP_TYPES + 20
If it does not compile, try adding this line to the other #include statements in Barracks.cpp:
#include “Ship.h” For those that can’t yet compile the code, and for those that still like playing on PXO, I wrote a small utility to edit a plr file (sorry cheaters, you can only delete kills-by-ship-type, not add

). I’ll release it this weekend.