Search in sources :

Example 6 with EntityLoadingException

use of megamek.common.loaders.EntityLoadingException in project megameklab by MegaMek.

the class DropTargetCriticalList method changeArmoring.

private void changeArmoring() {
    CriticalSlot cs = getCrit();
    if (cs != null) {
        if (cs.getType() == CriticalSlot.TYPE_EQUIPMENT) {
            Mounted mount = getMounted();
            mount.setArmored(!cs.isArmored());
            UnitUtil.updateCritsArmoredStatus(getUnit(), mount);
        } else {
            cs.setArmored(!cs.isArmored());
            UnitUtil.updateCritsArmoredStatus(getUnit(), cs, getCritLocation());
        }
    }
    // Check linkings after you remove everything.
    try {
        MechFileParser.postLoadInit(getUnit());
    } catch (EntityLoadingException ele) {
    // do nothing.
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    if (refresh != null) {
        refresh.refreshAll();
    }
}
Also used : CriticalSlot(megamek.common.CriticalSlot) Mounted(megamek.common.Mounted) EntityLoadingException(megamek.common.loaders.EntityLoadingException) EntityLoadingException(megamek.common.loaders.EntityLoadingException)

Example 7 with EntityLoadingException

use of megamek.common.loaders.EntityLoadingException in project megameklab by MegaMek.

the class BuildTab method resetCrits.

private void resetCrits() {
    for (Mounted mount : getTank().getEquipment()) {
        // Fixed shouldn't be removed
        if (UnitUtil.isFixedLocationSpreadEquipment(mount.getType())) {
            continue;
        }
        UnitUtil.removeCriticals(getTank(), mount);
        UnitUtil.changeMountStatus(getTank(), mount, Entity.LOC_NONE, Entity.LOC_NONE, false);
    }
    // Check linkings after you remove everything.
    try {
        MechFileParser.postLoadInit(getTank());
    } catch (EntityLoadingException ele) {
    // do nothing.
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    refresh.refreshAll();
}
Also used : Mounted(megamek.common.Mounted) EntityLoadingException(megamek.common.loaders.EntityLoadingException) EntityLoadingException(megamek.common.loaders.EntityLoadingException)

Aggregations

Mounted (megamek.common.Mounted)7 EntityLoadingException (megamek.common.loaders.EntityLoadingException)7 CriticalSlot (megamek.common.CriticalSlot)5 BattleArmor (megamek.common.BattleArmor)1 LocationFullException (megamek.common.LocationFullException)1 TestBattleArmor (megamek.common.verifier.TestBattleArmor)1