Originally posted by Bobboau
ok how are we going to handel the load out screen? this needs a totaly new system seing as weapons are given a flag as being used or not for the entire ship
I just took a look at the code, and I realized that this will turn into a huge amount of work if the code isn't written carefully. Done correctly, however, only one or two functions will need changing.
Keep the existing table entries as they are. Then add a new entry, like HotSnoj said, specifying the allowed weapons for each bank. Don't modify the existing loadout code (it'll require massive code rewriting); instead, add a new subroutine to check for if a weapon is allowed on a bank.
So the new table entry will read as follows:
$Allowed PBanks: ( "blah1" "blah2" "blah3" )
+Allowed PBank: 1 ( "blah1" )
+Allowed PBank: 2 ( "blah2" "blah3" )
To the ship_info structure, add
int restricted_loadout_flag[MAX_SHIP_WEAPONS]
int allowed_bank_restricted_weapons[MAX_SHIP_WEAPONS]
[MAX_WEAPON_TYPES]
Inside the ship parser, set
restricted_loadout_flag[bank] whenever a "+Allowed PBank: X" or "+Allowed SBank: X" line is encountered.
The loadout screen will only restrict the loadout on a bank if it sees that
restricted_loadout is set for that bank.
This way, you can let the existing loadout code handle just about all of the work. All that needs to be changed (aside from the parser and ship structure) is a little something added to the function
drop_weapon_on_slot, saying that this weapon is not allowed if this is the wrong slot.