Skip to content

Commit

Permalink
Merge pull request #1355 from SJuliez/statusbar-correction
Browse files Browse the repository at this point in the history
StatusBar: correct free slot displays
  • Loading branch information
HammerGS authored Dec 29, 2023
2 parents f3e40a0 + d7ad6b2 commit a7394a4
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions megameklab/src/megameklab/ui/combatVehicle/CVStatusBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ public void refreshMovement() {

public void refreshSlots() {
Tank tank = getTank();
int currentSlots = tank.getTotalSlots() - tank.getFreeSlots();
slots.setText(String.format(SLOTS_LABEL, currentSlots, tank.getTotalSlots()));
slots.setForeground(currentSlots > tank.getTotalSlots() ? GUIPreferences.getInstance().getWarningColor() : null);
int freeSlots = tank.getFreeSlots();
slots.setText(String.format(SLOTS_LABEL, freeSlots, tank.getTotalSlots()));
slots.setForeground((freeSlots < 0) ? GUIPreferences.getInstance().getWarningColor() : null);
}
}
2 changes: 1 addition & 1 deletion megameklab/src/megameklab/ui/generalUnit/StatusBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public StatusBar(MegaMekLabMainUI parent) {
invalid.setVisible(false);

if (!getEntity().isConventionalInfantry()) {
JButton showEquipmentDatabase = new JButton("Show Equipment Database");
JButton showEquipmentDatabase = new JButton("Equipment Database");
showEquipmentDatabase.addActionListener(evt -> parent.getFloatingEquipmentDatabase().setVisible(true));
add(showEquipmentDatabase);
}
Expand Down
2 changes: 1 addition & 1 deletion megameklab/src/megameklab/ui/mek/BMStatusBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected void additionalRefresh() {
public void refreshSlots() {
int maxCrits = getTestEntity().totalCritSlotCount();
int currentSlots = UnitUtil.countUsedCriticals(getMech());
slots.setText(String.format(SLOTS_LABEL, currentSlots, maxCrits));
slots.setText(String.format(SLOTS_LABEL, maxCrits - currentSlots, maxCrits));
slots.setForeground(currentSlots > maxCrits ? GUIPreferences.getInstance().getWarningColor() : null);
}

Expand Down
2 changes: 1 addition & 1 deletion megameklab/src/megameklab/ui/protoMek/PMStatusBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void refreshSlots() {
long currentSlots = getProtomech().getEquipment().stream()
.filter(m -> TestProtomech.requiresSlot(m.getType())).count();

slots.setText(String.format(SLOTS_LABEL, currentSlots, maxCrits));
slots.setText(String.format(SLOTS_LABEL, maxCrits - currentSlots, maxCrits));
slots.setForeground(currentSlots > maxCrits ? GUIPreferences.getInstance().getWarningColor() : null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void refreshSlots() {
TestSupportVehicle testEntity = (TestSupportVehicle) getTestEntity();
final int totalSlots = testEntity.totalSlotCount();
final int currentSlots = testEntity.occupiedSlotCount();
slots.setText(String.format(SLOTS_LABEL, currentSlots, totalSlots));
slots.setText(String.format(SLOTS_LABEL, totalSlots - currentSlots, totalSlots));
slots.setForeground(currentSlots > totalSlots ? GUIPreferences.getInstance().getWarningColor() : null);
}
}

0 comments on commit a7394a4

Please sign in to comment.