try { entity.addEquipment(mounted, row.bay.getLocation(), row.bay.isRearMounted()); row.bay.addAmmoToBay(entity.getEquipmentNum(mounted)); } catch (LocationFullException e) { DefaultMmLogger.getInstance().error(BayMunitionsChoicePanel.class,
/** * Worker function that takes an entity, a location, an ammo type string and the critical index * of a weapons bay in the given location and attempts to add the ammo type there. * @param entity The entity we're working on loading * @param loc The location index on the entity * @param type The ammo type string * @param bayIndex The crit index of the bay where we want to load the ammo on the location where the bay is * @return A generated critical slot entry */ private void addExtraAmmoToBay(Entity entity, int loc, String type, String bayIndex) { // here, we need to do the following: // 1: get the bay to which this ammo belongs, and add it to said bay // 2: add the ammo to the entity as a "new" piece of equipment // 3: add the ammo to a crit slot on the bay's location int bayCritIndex = Integer.parseInt(bayIndex); Mounted bay = entity.getCritical(loc, bayCritIndex - 1).getMount(); Mounted ammo = new Mounted(entity, AmmoType.get(type)); try { entity.addEquipment(ammo, loc, bay.isRearMounted()); } catch(LocationFullException lfe) { // silently swallow it, since dropship locations have about a hundred crit slots } bay.addAmmoToBay(entity.getEquipmentNum(ammo)); }
bayMount.addAmmoToBay(a.getEquipmentNum(newmount));
bayMount.addAmmoToBay(a.getEquipmentNum(newmount)); } else {
bayMount.addAmmoToBay(a.getEquipmentNum(newmount));
bayMount.addAmmoToBay(a.getEquipmentNum(newmount));
Mounted m = entity.addEquipment(etype, bay.getLocation(), bay.isRearMounted(), 0); int anum = entity.getEquipmentNum(m); bay.addAmmoToBay(anum); LargeCraftAmmoBin bin = new LargeCraftAmmoBin((int) entity.getWeight(), etype, anum, 0, 0, campaign);