public void ChangeWeapon(int index) { WeaponSlot weaponType = Starship.WeaponList[index].Item1; if (weaponType == WeaponSlot.Prow)//Heavy weapons can be on all prows if they can be on a ship { weaponType |= WeaponSlot.Heavy; } if (((Starship.Hull.HullTypes & HullType.AllCruiser) != 0) || (weaponType & WeaponSlot.Prow) != 0)//lances can be on all prows or any slot of ships bigger than frigates, raiders or transports { weaponType |= WeaponSlot.Lance; } if ((Starship.Hull.HullTypes & (HullType.GrandCruiser | HullType.BattleShip)) != 0 && (weaponType & WeaponSlot.Dorsal) != 0)//Grand cruisers may have heavy weapons in dorsal slots { weaponType |= WeaponSlot.Heavy; } //Open weapon chooser WeaponChooser dialog = new WeaponChooser(Starship, weaponType, index, loader); dialog.ShowDialog(); if (dialog.DialogResult ?? false) { UpdateWeaponSlots(true); } }
public void ChangeWeapon(int index) { WeaponSlot weaponType = Starship.WeaponList[index].Item1; if (weaponType == WeaponSlot.Prow)//Heavy weapons can be on all prows if they can be on a ship weaponType |= WeaponSlot.Heavy; if (((Starship.Hull.HullTypes & HullType.AllCruiser) != 0) || (weaponType & WeaponSlot.Prow) != 0)//lances can be on all prows or any slot of ships bigger than frigates, raiders or transports weaponType |= WeaponSlot.Lance; if ((Starship.Hull.HullTypes & (HullType.GrandCruiser | HullType.BattleShip)) != 0 && (weaponType & WeaponSlot.Dorsal) != 0)//Grand cruisers may have heavy weapons in dorsal slots weaponType |= WeaponSlot.Heavy; //Open weapon chooser WeaponChooser dialog = new WeaponChooser(Starship, weaponType, index, loader); dialog.ShowDialog(); if (dialog.DialogResult ?? false) UpdateWeaponSlots(true); }