Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Edge Handling and GUI Support (Sentry) #6579

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions MekHQ/src/mekhq/campaign/Campaign.java
Original file line number Diff line number Diff line change
Expand Up @@ -4914,7 +4914,7 @@ public void processNewDayPersonnel() {
processWeeklyRelationshipEvents(person);
}

processWeeklyEdgeResets(person);
person.resetCurrentEdge();

if (!person.getStatus().isMIA()) {
processFatigueRecovery(this, person);
Expand Down Expand Up @@ -4990,14 +4990,11 @@ private void processAdvancedMedicalEvents(Person person) {
}

/**
* Process weekly Edge resets for a given person.
*
* @param person the person for whom weekly Edge resets will be processed
* @deprecated use {@link Person#resetCurrentEdge()} instead
*/
@Deprecated(since = "0.50.05", forRemoval = true)
private void processWeeklyEdgeResets(Person person) {
if ((person.hasSupportRole(true) || person.isEngineer())) {
person.resetCurrentEdge();
}
person.resetCurrentEdge();
}

/**
Expand Down
11 changes: 4 additions & 7 deletions MekHQ/src/mekhq/campaign/personnel/Person.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public class Person {

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

// phenotype and background
Expand Down Expand Up @@ -2411,10 +2411,7 @@ public void writeToXML(final PrintWriter pw, int indent, final Campaign campaign
indent,
"edge",
getOptionList("::", PersonnelOptions.EDGE_ADVANTAGES));
// For support personnel, write an available edge value
if (hasSupportRole(true) || isEngineer()) {
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "edgeAvailable", getCurrentEdge());
}
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "edgeAvailable", getCurrentEdge());
}

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

/**
* Resets support personnel edge points to the purchased level. Used for weekly refresh.
* Resets edge points to the purchased level. Used for weekly refresh.
*/
public void resetCurrentEdge() {
setCurrentEdge(getEdge());
}

/**
* Sets support personnel edge points to the value 'currentEdge'. Used for weekly refresh.
* Sets edge points to the value 'currentEdge'. Used for weekly refresh.
*
* @param currentEdge - integer used to track this person's edge points available for the current week
*/
Expand Down
23 changes: 1 addition & 22 deletions MekHQ/src/mekhq/gui/view/PersonViewPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -1614,7 +1614,7 @@ private JPanel fillSkills() {

lblEdge2.setName("lblEdge2");
lblEdge1.setLabelFor(lblEdge2);
lblEdge2.setText(Integer.toString(person.getEdge()));
lblEdge2.setText("" + person.getCurrentEdge() + '/' + person.getEdge());
lblEdge2.setToolTipText(person.getEdgeTooltip());
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 1;
Expand All @@ -1625,27 +1625,6 @@ private JPanel fillSkills() {
gridBagConstraints.fill = GridBagConstraints.NONE;
gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
pnlSkills.add(lblEdge2, gridBagConstraints);

if (campaign.getCampaignOptions().isUseSupportEdge() && person.hasSupportRole(true)) {
// Add the Edge Available field for support personnel only
lblEdgeAvail1.setName("lblEdgeAvail1");
lblEdgeAvail1.setText(resourceMap.getString("lblEdgeAvail1.text"));
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = firsty;
gridBagConstraints.fill = GridBagConstraints.NONE;
gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
pnlSkills.add(lblEdgeAvail1, gridBagConstraints);

lblEdgeAvail2.setName("lblEdgeAvail2");
lblEdgeAvail1.setLabelFor(lblEdgeAvail2);
lblEdgeAvail2.setText(Integer.toString(person.getCurrentEdge()));
gridBagConstraints.gridx = 3;
gridBagConstraints.gridwidth = 1;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new Insets(0, 10, 0, 0);
pnlSkills.add(lblEdgeAvail2, gridBagConstraints);
}
firsty++;
}

Expand Down
Loading