diff --git a/MekHQ/src/mekhq/campaign/personnel/Person.java b/MekHQ/src/mekhq/campaign/personnel/Person.java index 59d2c113b9..309383615b 100644 --- a/MekHQ/src/mekhq/campaign/personnel/Person.java +++ b/MekHQ/src/mekhq/campaign/personnel/Person.java @@ -327,7 +327,7 @@ public Person(final String preNominal, final String givenName, final String surn secondaryRole = PersonnelRole.NONE; primaryDesignator = ROMDesignation.NONE; secondaryDesignator = ROMDesignation.NONE; - setBirthday(LocalDate.now()); + setDateOfBirth(LocalDate.now()); originFaction = Factions.getInstance().getFaction(factionCode); originPlanet = null; @@ -1329,7 +1329,12 @@ public Gender getGender() { return gender; } - public void setBirthday(final LocalDate birthday) { + /** + * Sets the date of birth (the date they are born) for the person. + * + * @param birthday the person's new date of birth + */ + public void setDateOfBirth(final LocalDate birthday) { this.birthday = birthday; } diff --git a/MekHQ/src/mekhq/campaign/personnel/generator/AbstractPersonnelGenerator.java b/MekHQ/src/mekhq/campaign/personnel/generator/AbstractPersonnelGenerator.java index 2df7224d5a..86d5d16c6a 100644 --- a/MekHQ/src/mekhq/campaign/personnel/generator/AbstractPersonnelGenerator.java +++ b/MekHQ/src/mekhq/campaign/personnel/generator/AbstractPersonnelGenerator.java @@ -18,11 +18,8 @@ */ package mekhq.campaign.personnel.generator; -import java.time.LocalDate; -import java.util.Objects; - -import megamek.client.generator.RandomNameGenerator; import megamek.client.generator.RandomGenderGenerator; +import megamek.client.generator.RandomNameGenerator; import megamek.common.Compute; import megamek.common.enums.Gender; import mekhq.Utilities; @@ -33,6 +30,9 @@ import mekhq.campaign.personnel.enums.PersonnelRole; import mekhq.campaign.personnel.enums.Phenotype; +import java.time.LocalDate; +import java.util.Objects; + /** * Represents a class which can generate new {@link Person} objects * for a {@link Campaign}. @@ -215,6 +215,6 @@ protected void generateBirthday(Campaign campaign, Person person, int expLvl, bo int nDays = birthday.isLeapYear() ? 366 : 365; int randomDay = Compute.randomInt(nDays) + 1; - person.setBirthday(birthday.withDayOfYear(randomDay)); + person.setDateOfBirth(birthday.withDayOfYear(randomDay)); } } diff --git a/MekHQ/src/mekhq/campaign/personnel/procreation/AbstractProcreation.java b/MekHQ/src/mekhq/campaign/personnel/procreation/AbstractProcreation.java index d72ac2c824..faedb75dbb 100644 --- a/MekHQ/src/mekhq/campaign/personnel/procreation/AbstractProcreation.java +++ b/MekHQ/src/mekhq/campaign/personnel/procreation/AbstractProcreation.java @@ -322,7 +322,7 @@ public void birth(final Campaign campaign, final LocalDate today, final Person m final Person baby = campaign.newDependent(true); baby.setSurname(campaign.getCampaignOptions().getBabySurnameStyle() .generateBabySurname(mother, father, baby.getGender())); - baby.setBirthday(today); + baby.setDateOfBirth(today); // Create reports and log the birth campaign.addReport(String.format(resources.getString("babyBorn.report"), diff --git a/MekHQ/src/mekhq/campaign/storyarc/storypoint/CreateCharacterStoryPoint.java b/MekHQ/src/mekhq/campaign/storyarc/storypoint/CreateCharacterStoryPoint.java index bf98e5bcc3..599bfe6201 100644 --- a/MekHQ/src/mekhq/campaign/storyarc/storypoint/CreateCharacterStoryPoint.java +++ b/MekHQ/src/mekhq/campaign/storyarc/storypoint/CreateCharacterStoryPoint.java @@ -20,14 +20,6 @@ */ package mekhq.campaign.storyarc.storypoint; -import java.io.PrintWriter; -import java.text.ParseException; -import java.util.Enumeration; -import java.util.UUID; - -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - import megamek.Version; import megamek.common.options.IOption; import megamek.common.options.IOptionGroup; @@ -54,6 +46,13 @@ import mekhq.gui.dialog.CreateCharacterDialog; import mekhq.gui.dialog.CreateCharacterDialog.NameRestrictions; import mekhq.utilities.MHQXMLUtility; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import java.io.PrintWriter; +import java.text.ParseException; +import java.util.Enumeration; +import java.util.UUID; /** * This StoryPoint opens a {@link CreateCharacterDialog CreateCharacterDialog} @@ -180,7 +179,7 @@ public Person createPerson() { AbstractSkillGenerator skillGenerator = new DefaultSkillGenerator(skillPrefs); skillGenerator.generateSkills(getCampaign(), p, SkillType.EXP_ULTRA_GREEN); - p.setBirthday(getCampaign().getLocalDate().minusYears(age)); + p.setDateOfBirth(getCampaign().getLocalDate().minusYears(age)); // set education EducationController.setInitialEducation(campaign, p); diff --git a/MekHQ/src/mekhq/gui/dialog/CreateCharacterDialog.java b/MekHQ/src/mekhq/gui/dialog/CreateCharacterDialog.java index f00588b1c7..d906d5fdf1 100644 --- a/MekHQ/src/mekhq/gui/dialog/CreateCharacterDialog.java +++ b/MekHQ/src/mekhq/gui/dialog/CreateCharacterDialog.java @@ -1458,7 +1458,7 @@ private void done() { ? ((Gender) choiceGender.getSelectedItem()).getInternalVariant() : (Gender) choiceGender.getSelectedItem()); } - person.setBirthday(birthdate); + person.setDateOfBirth(birthdate); person.setOriginFaction((Faction) choiceFaction.getSelectedItem()); if (choiceSystem.getSelectedItem() != null && choicePlanet.getSelectedItem() != null) { person.setOriginPlanet((Planet)choicePlanet.getSelectedItem()); diff --git a/MekHQ/src/mekhq/gui/dialog/CustomizePersonDialog.java b/MekHQ/src/mekhq/gui/dialog/CustomizePersonDialog.java index 586769e74c..226aa934db 100644 --- a/MekHQ/src/mekhq/gui/dialog/CustomizePersonDialog.java +++ b/MekHQ/src/mekhq/gui/dialog/CustomizePersonDialog.java @@ -1181,7 +1181,7 @@ private void btnOkActionPerformed(ActionEvent evt) { : (Gender) choiceGender.getSelectedItem()); } - person.setBirthday(birthdate); + person.setDateOfBirth(birthdate); person.setRecruitment(recruitment); person.setLastRankChangeDate(lastRankChangeDate); person.setRetirement(retirement); diff --git a/MekHQ/src/mekhq/gui/dialog/HireBulkPersonnelDialog.java b/MekHQ/src/mekhq/gui/dialog/HireBulkPersonnelDialog.java index cff27f2aee..f7e4eec44f 100644 --- a/MekHQ/src/mekhq/gui/dialog/HireBulkPersonnelDialog.java +++ b/MekHQ/src/mekhq/gui/dialog/HireBulkPersonnelDialog.java @@ -18,23 +18,6 @@ */ package mekhq.gui.dialog; -import static mekhq.campaign.personnel.SkillType.*; -import static mekhq.campaign.personnel.generator.AbstractSkillGenerator.addSkill; - -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.time.LocalDate; -import java.time.temporal.ChronoUnit; -import java.util.Objects; -import java.util.ResourceBundle; - -import javax.swing.*; -import javax.swing.JSpinner.DefaultEditor; -import javax.swing.JSpinner.NumberEditor; - import megamek.client.ui.baseComponents.MMComboBox; import megamek.client.ui.preferences.JWindowPreference; import megamek.client.ui.preferences.PreferencesNode; @@ -53,6 +36,20 @@ import mekhq.gui.CampaignGUI; import mekhq.gui.displayWrappers.RankDisplay; +import javax.swing.*; +import javax.swing.JSpinner.DefaultEditor; +import javax.swing.JSpinner.NumberEditor; +import java.awt.*; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.time.LocalDate; +import java.time.temporal.ChronoUnit; +import java.util.Objects; +import java.util.ResourceBundle; + +import static mekhq.campaign.personnel.SkillType.*; +import static mekhq.campaign.personnel.generator.AbstractSkillGenerator.addSkill; + /** * @author Jay Lawson */ @@ -353,7 +350,7 @@ private void hire(boolean isGmHire) { if (useAge) { if ((age > maxAgeVal) || (age < minAgeVal)) { LocalDate birthDay = earliestBirthDate.plusDays(Compute.randomInt(days)); - person.setBirthday(birthDay); + person.setDateOfBirth(birthDay); age = person.getAge(today); } }