AmmoType atype = (AmmoType)mountedAmmo.getType(); if (atype.getAmmoType() == wtype.getAmmoType() && atype.getRackSize() == wtype.getRackSize()) { mounted.setLinked(mountedAmmo);
for (Enumeration i = getAmmo(); i.hasMoreElements();) { Mounted mountedAmmo = (Mounted)i.nextElement(); AmmoType atype = (AmmoType)mountedAmmo.getType(); if (mountedAmmo.isDestroyed() || mountedAmmo.getShotsLeft() <= 0 || mountedAmmo.isDumping() || mountedAmmo.isBreached()) { continue; } if (atype.getAmmoType() == wtype.getAmmoType() && atype.getRackSize() == wtype.getRackSize()) { mounted.setLinked(mountedAmmo); break; }
    public void loadWeapon(Mounted mounted, Mounted mountedAmmo)    {        if (mountedAmmo.isDestroyed() || mountedAmmo.getShotsLeft() <= 0 || mountedAmmo.isDumping() || mountedAmmo.isBreached()) {            return;        }        WeaponType wtype = (WeaponType)mounted.getType();        AmmoType atype = (AmmoType)mountedAmmo.getType();        if (atype.getAmmoType() == wtype.getAmmoType() && atype.getRackSize() == wtype.getRackSize()) {            mounted.setLinked(mountedAmmo);        }    }