Skip to content

Commit

Permalink
Only shift landing gear crit in CT when changing engine or gyro type.
Browse files Browse the repository at this point in the history
Bug was introduced in previous fix for this issue.

Fixes #106: LAM landing gear not placed correctly with compact engine or
gyro.
  • Loading branch information
neoancient committed Dec 22, 2017
1 parent f84d418 commit a7833bc
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/megameklab/com/ui/Mek/tabs/StructureTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ private void resetSystemCrits() {
getMech().clearCockpitCrits();
getMech().clearGyroCrits();
getMech().clearEngineCrits();
removeSystemCrits(LandAirMech.LAM_LANDING_GEAR);
removeSystemCrits(LandAirMech.LAM_LANDING_GEAR, Mech.LOC_CT);

int[] ctEngine = getMech().getEngine().getCenterTorsoCriticalSlots(getMech().getGyroType());
int lastEngine = ctEngine[ctEngine.length - 1];
Expand Down Expand Up @@ -385,19 +385,17 @@ private void clearCrit(int loc, int slotNum) {
}

}

private void removeSystemCrits(int systemType, int loc) {
for (int slot = 0; slot < getMech().getNumberOfCriticals(loc); slot++) {
CriticalSlot cs = getMech().getCritical(loc, slot);

public void removeSystemCrits(int systemType) {
for (int loc = 0; loc < getMech().locations(); loc++) {
for (int slot = 0; slot < getMech().getNumberOfCriticals(loc); slot++) {
CriticalSlot cs = getMech().getCritical(loc, slot);

if ((cs == null) || (cs.getType() != CriticalSlot.TYPE_SYSTEM)) {
continue;
}
if ((cs == null) || (cs.getType() != CriticalSlot.TYPE_SYSTEM)) {
continue;
}

if (cs.getIndex() == systemType) {
getMech().setCritical(loc, slot, null);
}
if (cs.getIndex() == systemType) {
getMech().setCritical(loc, slot, null);
}
}
}
Expand Down

0 comments on commit a7833bc

Please sign in to comment.