Skip to content

Commit 4afb5c6

Browse files
committed
Updated Edge Handling and GUI Support
- Refactored `PersonViewPanel` to display current and total edge without support role-specific logic. - Updated `resetCurrentEdge` logic in `Person` to apply universally instead of being restricted to support roles. - Marked `processWeeklyEdgeResets` in `Campaign` as deprecated, consolidating its usage into `resetCurrentEdge`. - Removed check that prevented non-support characters from having their current Edge levels stored on save.
1 parent 7193b9a commit 4afb5c6

File tree

3 files changed

+9
-36
lines changed

3 files changed

+9
-36
lines changed

MekHQ/src/mekhq/campaign/Campaign.java

+4-7
Original file line numberDiff line numberDiff line change
@@ -4914,7 +4914,7 @@ public void processNewDayPersonnel() {
49144914
processWeeklyRelationshipEvents(person);
49154915
}
49164916

4917-
processWeeklyEdgeResets(person);
4917+
person.resetCurrentEdge();
49184918

49194919
if (!person.getStatus().isMIA()) {
49204920
processFatigueRecovery(this, person);
@@ -4990,14 +4990,11 @@ private void processAdvancedMedicalEvents(Person person) {
49904990
}
49914991

49924992
/**
4993-
* Process weekly Edge resets for a given person.
4994-
*
4995-
* @param person the person for whom weekly Edge resets will be processed
4993+
* @deprecated use {@link Person#resetCurrentEdge()} instead
49964994
*/
4995+
@Deprecated(since = "0.50.05", forRemoval = true)
49974996
private void processWeeklyEdgeResets(Person person) {
4998-
if ((person.hasSupportRole(true) || person.isEngineer())) {
4999-
person.resetCurrentEdge();
5000-
}
4997+
person.resetCurrentEdge();
50014998
}
50024999

50035000
/**

MekHQ/src/mekhq/campaign/personnel/Person.java

+4-7
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ public class Person {
215215

216216
// Supports edge usage by a ship's engineer composite crewman
217217
private int edgeUsedThisRound;
218-
// To track how many edge points support personnel have left until next refresh
218+
// To track how many edge points personnel have left until next refresh
219219
private int currentEdge;
220220

221221
// phenotype and background
@@ -2411,10 +2411,7 @@ public void writeToXML(final PrintWriter pw, int indent, final Campaign campaign
24112411
indent,
24122412
"edge",
24132413
getOptionList("::", PersonnelOptions.EDGE_ADVANTAGES));
2414-
// For support personnel, write an available edge value
2415-
if (hasSupportRole(true) || isEngineer()) {
2416-
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "edgeAvailable", getCurrentEdge());
2417-
}
2414+
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "edgeAvailable", getCurrentEdge());
24182415
}
24192416

24202417
if (countOptions(PersonnelOptions.MD_ADVANTAGES) > 0) {
@@ -4226,14 +4223,14 @@ public void changeEdge(final int amount) {
42264223
}
42274224

42284225
/**
4229-
* Resets support personnel edge points to the purchased level. Used for weekly refresh.
4226+
* Resets edge points to the purchased level. Used for weekly refresh.
42304227
*/
42314228
public void resetCurrentEdge() {
42324229
setCurrentEdge(getEdge());
42334230
}
42344231

42354232
/**
4236-
* Sets support personnel edge points to the value 'currentEdge'. Used for weekly refresh.
4233+
* Sets edge points to the value 'currentEdge'. Used for weekly refresh.
42374234
*
42384235
* @param currentEdge - integer used to track this person's edge points available for the current week
42394236
*/

MekHQ/src/mekhq/gui/view/PersonViewPanel.java

+1-22
Original file line numberDiff line numberDiff line change
@@ -1614,7 +1614,7 @@ private JPanel fillSkills() {
16141614

16151615
lblEdge2.setName("lblEdge2");
16161616
lblEdge1.setLabelFor(lblEdge2);
1617-
lblEdge2.setText(Integer.toString(person.getEdge()));
1617+
lblEdge2.setText("" + person.getCurrentEdge() + '/' + person.getEdge());
16181618
lblEdge2.setToolTipText(person.getEdgeTooltip());
16191619
gridBagConstraints = new GridBagConstraints();
16201620
gridBagConstraints.gridx = 1;
@@ -1625,27 +1625,6 @@ private JPanel fillSkills() {
16251625
gridBagConstraints.fill = GridBagConstraints.NONE;
16261626
gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
16271627
pnlSkills.add(lblEdge2, gridBagConstraints);
1628-
1629-
if (campaign.getCampaignOptions().isUseSupportEdge() && person.hasSupportRole(true)) {
1630-
// Add the Edge Available field for support personnel only
1631-
lblEdgeAvail1.setName("lblEdgeAvail1");
1632-
lblEdgeAvail1.setText(resourceMap.getString("lblEdgeAvail1.text"));
1633-
gridBagConstraints = new GridBagConstraints();
1634-
gridBagConstraints.gridx = 2;
1635-
gridBagConstraints.gridy = firsty;
1636-
gridBagConstraints.fill = GridBagConstraints.NONE;
1637-
gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
1638-
pnlSkills.add(lblEdgeAvail1, gridBagConstraints);
1639-
1640-
lblEdgeAvail2.setName("lblEdgeAvail2");
1641-
lblEdgeAvail1.setLabelFor(lblEdgeAvail2);
1642-
lblEdgeAvail2.setText(Integer.toString(person.getCurrentEdge()));
1643-
gridBagConstraints.gridx = 3;
1644-
gridBagConstraints.gridwidth = 1;
1645-
gridBagConstraints.weightx = 1.0;
1646-
gridBagConstraints.insets = new Insets(0, 10, 0, 0);
1647-
pnlSkills.add(lblEdgeAvail2, gridBagConstraints);
1648-
}
16491628
firsty++;
16501629
}
16511630

0 commit comments

Comments
 (0)