Skip to content

Commit 2435865

Browse files
authored
Merge pull request #8588 from IllianiBird/deprecatedRoles
Fix #8584: Prevented Deprecated Professions from Being Accessed By The Player or Personnel Markets
2 parents 785e5e2 + a0a9f66 commit 2435865

File tree

1 file changed

+47
-9
lines changed

1 file changed

+47
-9
lines changed

MekHQ/src/mekhq/campaign/personnel/enums/PersonnelRole.java

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -345,17 +345,17 @@ public enum PersonnelRole {
345345
NOBLE(KeyEvent.VK_UNDEFINED),
346346
COMMON_CRIMINAL(KeyEvent.VK_UNDEFINED),
347347
@Deprecated(since = "0.50.10", forRemoval = true)
348-
GROUND_VEHICLE_DRIVER(KeyEvent.VK_UNDEFINED),
348+
GROUND_VEHICLE_DRIVER(true),
349349
@Deprecated(since = "0.50.10", forRemoval = true)
350-
NAVAL_VEHICLE_DRIVER(KeyEvent.VK_UNDEFINED),
350+
NAVAL_VEHICLE_DRIVER(true),
351351
@Deprecated(since = "0.50.10", forRemoval = true)
352-
VTOL_PILOT(KeyEvent.VK_UNDEFINED),
352+
VTOL_PILOT(true),
353353
@Deprecated(since = "0.50.10", forRemoval = true)
354-
VEHICLE_GUNNER(KeyEvent.VK_UNDEFINED),
354+
VEHICLE_GUNNER(true),
355355
@Deprecated(since = "0.50.10", forRemoval = true)
356-
VEHICLE_CREW(KeyEvent.VK_UNDEFINED),
356+
VEHICLE_CREW(true),
357357
@Deprecated(since = "0.50.10", forRemoval = true)
358-
COMBAT_TECHNICIAN(KeyEvent.VK_UNDEFINED);
358+
COMBAT_TECHNICIAN(true);
359359
// endregion Enum Declarations
360360

361361
// region Variable Declarations
@@ -377,21 +377,42 @@ public enum PersonnelRole {
377377
private final int intelligence;
378378
private final int willpower;
379379
private final int charisma;
380+
private final boolean isDeprecated;
380381
// endregion Variable Declarations
381382

382383
// region Constructors
384+
PersonnelRole(final boolean isDeprecated) {
385+
this(PersonnelRoleSubType.CIVILIAN, false, KeyEvent.VK_UNDEFINED, 5, 5, 5, 5, 5, 5, 5, isDeprecated);
386+
}
387+
383388
PersonnelRole(final int mnemonic) {
384-
this(PersonnelRoleSubType.CIVILIAN, false, mnemonic, 5, 5, 5, 5, 5, 5, 5);
389+
this(PersonnelRoleSubType.CIVILIAN, false, mnemonic, 5, 5, 5, 5, 5, 5, 5, false);
385390
}
386391

387392
PersonnelRole(final PersonnelRoleSubType subType, final int mnemonic, final int strength, final int body,
388393
final int dexterity, final int reflexes, final int intelligence, final int willpower, final int charisma) {
389-
this(subType, false, mnemonic, strength, body, dexterity, reflexes, intelligence, willpower, charisma);
394+
this(subType, false, mnemonic, strength, body, dexterity, reflexes, intelligence, willpower, charisma, false);
390395
}
391396

392397
PersonnelRole(final PersonnelRoleSubType subType, final boolean hasClanName, final int mnemonic, final int strength,
393398
final int body, final int dexterity, final int reflexes, final int intelligence, final int willpower,
394399
final int charisma) {
400+
this(subType,
401+
hasClanName,
402+
mnemonic,
403+
strength,
404+
body,
405+
dexterity,
406+
reflexes,
407+
intelligence,
408+
willpower,
409+
charisma,
410+
false);
411+
}
412+
413+
PersonnelRole(final PersonnelRoleSubType subType, final boolean hasClanName, final int mnemonic, final int strength,
414+
final int body, final int dexterity, final int reflexes, final int intelligence, final int willpower,
415+
final int charisma, boolean isDeprecated) {
395416
this.subType = subType;
396417
this.hasClanName = hasClanName;
397418
this.mnemonic = mnemonic;
@@ -402,6 +423,7 @@ public enum PersonnelRole {
402423
this.intelligence = intelligence;
403424
this.willpower = willpower;
404425
this.charisma = charisma;
426+
this.isDeprecated = isDeprecated;
405427
}
406428
// endregion Constructors
407429

@@ -1258,6 +1280,10 @@ public boolean isSupport() {
12581280
return isSupport(true);
12591281
}
12601282

1283+
public boolean isDeprecated() {
1284+
return isDeprecated;
1285+
}
1286+
12611287
/**
12621288
* @param excludeCivilian whether to exclude civilian roles
12631289
*
@@ -1342,6 +1368,10 @@ public static List<PersonnelRole> getMarketableRoles() {
13421368
public static List<PersonnelRole> getCombatRoles() {
13431369
List<PersonnelRole> combatRoles = new ArrayList<>();
13441370
for (PersonnelRole personnelRole : PersonnelRole.values()) {
1371+
if (personnelRole.isDeprecated()) {
1372+
continue;
1373+
}
1374+
13451375
if (personnelRole.isCombat()) {
13461376
combatRoles.add(personnelRole);
13471377
}
@@ -1355,6 +1385,10 @@ public static List<PersonnelRole> getCombatRoles() {
13551385
public static List<PersonnelRole> getSupportRoles() {
13561386
List<PersonnelRole> supportRoles = new ArrayList<>();
13571387
for (PersonnelRole personnelRole : PersonnelRole.values()) {
1388+
if (personnelRole.isDeprecated()) {
1389+
continue;
1390+
}
1391+
13581392
if (personnelRole.isSubType(PersonnelRoleSubType.SUPPORT)) {
13591393
supportRoles.add(personnelRole);
13601394
}
@@ -1368,11 +1402,15 @@ public static List<PersonnelRole> getSupportRoles() {
13681402
* @return a {@code List<PersonnelRole>} containing all civilian personnel roles.
13691403
*
13701404
* @author Illiani
1371-
* @since 0.50.06
1405+
* @since 0.50.06e
13721406
*/
13731407
public static List<PersonnelRole> getCivilianRoles() {
13741408
List<PersonnelRole> civilianRoles = new ArrayList<>();
13751409
for (PersonnelRole personnelRole : PersonnelRole.values()) {
1410+
if (personnelRole.isDeprecated()) {
1411+
continue;
1412+
}
1413+
13761414
if (personnelRole.isSubType(PersonnelRoleSubType.CIVILIAN)) {
13771415
civilianRoles.add(personnelRole);
13781416
}

0 commit comments

Comments
 (0)