no i did it the straight forward way of giving each ship an additional flag (SF2_SECONDARY_LINKED) and then in ship_fire_secondary() just changed
bank = swp->current_secondary_weapon;
to this
for (bank = 0; bank < swp->num_secondary_banks; bank++)
{
if (bank != swp->current_secondary_bank && !ship_is_secondary_linked_with(shipp, bank, 1))
continue;
//...
where ship_is_secondary_linked_with() is some helper function that comares shipp's current secondary weapon with the secondary residing in index of shipp->weapons.secondary_bank_weapons[bank]. The third argument tells the function to ignore ammo counts when processing the link (only used for the hud stuff (drawing the extra triangles). The function would return non-zero if the two weapons are linkable
int ship_is_secondary_linked_with(ship* shipp, int other_secondary_bank, int ignore_ammo)
{
ship_weapon* swp = &shipp->weapons;
//this could be bad if we don't check for this
if (other_secondary_bank < 0)
return 0;
//this could also be bad
if (other_secondary_bank >= swp->num_secondary_banks)
return 0;
//if the ship doesn't have the linked secondary flag set, bail
if (!(shipp->flags2 & SF2_SECONDARY_LINKED))
return 0;
//if the weapon types are different, return the two weapons can't be linked
if (swp->secondary_bank_weapons[swp->current_secondary_bank] != swp->secondary_bank_weapons[other_secondary_bank])
return 0;
//if either of the banks has no ammo, the two weapons can't be linked
if (swp->secondary_bank_ammo[swp->current_secondary_bank] == 0 && !ignore_ammo)
return 0;
if (swp->secondary_bank_ammo[other_secondary_bank] == 0 && !ignore_ammo)
return 0;
//TODO:
//if the currently selected secondary weapon has the "no link" flag, bail.
//looks goods
return 1;
}