Skip to content

Commit

Permalink
rename TroopSpace to InfantryCompartment
Browse files Browse the repository at this point in the history
  • Loading branch information
SJuliez committed Nov 5, 2024
1 parent 62055be commit 4b741c1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion megameklab/src/megameklab/printing/PrintAero.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public String formatFeatures() {
Map<String, Double> transport = new HashMap<>();
Map<String, Integer> seating = new HashMap<>();
for (Transporter t : aero.getTransports()) {
if (t instanceof TroopSpace) {
if (t instanceof InfantryCompartment) {
transport.merge("Infantry Compartment", t.getUnused(), Double::sum);
} else if (t instanceof StandardSeatCargoBay) {
seating.merge(((Bay) t).getType(), (int) ((Bay) t).getCapacity(), Integer::sum);
Expand Down
4 changes: 2 additions & 2 deletions megameklab/src/megameklab/printing/PrintTank.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import megamek.common.StandardSeatCargoBay;
import megamek.common.Tank;
import megamek.common.Transporter;
import megamek.common.TroopSpace;
import megamek.common.InfantryCompartment;
import megamek.common.VTOL;
import megameklab.printing.reference.ClusterHitsTable;
import megameklab.printing.reference.GroundMovementRecord;
Expand Down Expand Up @@ -199,7 +199,7 @@ public String formatFeatures() {
Map<String, Double> transport = new HashMap<>();
Map<String, Integer> seating = new HashMap<>();
for (Transporter t : tank.getTransports()) {
if (t instanceof TroopSpace) {
if (t instanceof InfantryCompartment) {
transport.merge("Infantry Compartment", t.getUnused(), Double::sum);
} else if (t instanceof StandardSeatCargoBay) {
seating.merge(((Bay) t).getType(), (int) ((Bay) t).getCapacity(), Integer::sum);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -680,16 +680,16 @@ public void turretBaseWtChanged(double turret1, double turret2) {
@Override
public void troopSpaceChanged(double fixed, double pod) {
List<Transporter> toRemove = getTank().getTransports().stream()
.filter(t -> t instanceof TroopSpace).collect(Collectors.toList());
.filter(t -> t instanceof InfantryCompartment).collect(Collectors.toList());
toRemove.forEach(t -> getTank().removeTransporter(t));
double troopTons = Math
.round((fixed) * 2) / 2.0;
if (troopTons > 0) {
getTank().addTransporter(new TroopSpace(troopTons), false);
getTank().addTransporter(new InfantryCompartment(troopTons), false);
}
troopTons = Math.round(pod * 2) / 2.0;
if (troopTons > 0) {
getTank().addTransporter(new TroopSpace(troopTons), true);
getTank().addTransporter(new InfantryCompartment(troopTons), true);
}
panSummary.refresh();
refresh.refreshStatus();
Expand Down
8 changes: 4 additions & 4 deletions megameklab/src/megameklab/ui/generalUnit/TransportTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
import megamek.common.Jumpship;
import megamek.common.RoundWeight;
import megamek.common.Transporter;
import megamek.common.TroopSpace;
import megamek.common.InfantryCompartment;
import megamek.common.verifier.BayData;
import megamek.common.verifier.TestAdvancedAerospace;
import megamek.common.verifier.TestAero;
Expand Down Expand Up @@ -542,15 +542,15 @@ public void stateChanged(ChangeEvent ev) {
final double pod = (Double) spnPodTroopSpace.getValue();

List<Transporter> toRemove = getEntity().getTransports().stream()
.filter(t -> t instanceof TroopSpace).collect(Collectors.toList());
.filter(t -> t instanceof InfantryCompartment).collect(Collectors.toList());
toRemove.forEach(t -> getEntity().removeTransporter(t));
double troopTons = TestEntity.round(fixed, Ceil.HALFTON);
if (troopTons > 0) {
getEntity().addTransporter(new TroopSpace(troopTons), false);
getEntity().addTransporter(new InfantryCompartment(troopTons), false);
}
troopTons = TestEntity.round(pod, Ceil.HALFTON);
if (troopTons > 0) {
getEntity().addTransporter(new TroopSpace(troopTons), true);
getEntity().addTransporter(new InfantryCompartment(troopTons), true);
}
if (null != refresh) {
refresh.refreshStructure();
Expand Down

0 comments on commit 4b741c1

Please sign in to comment.