|
From: <jfr...@us...> - 2007-11-29 01:25:18
|
Revision: 4606
http://pcgen.svn.sourceforge.net/pcgen/?rev=4606&view=rev
Author: jfrazierjr
Date: 2007-11-28 17:25:20 -0800 (Wed, 28 Nov 2007)
Log Message:
-----------
Class using SUB or SUBSTITION Class not Base Class listed...
* Changed to show the base class as the first entry in the list of SubstitutionClasses (new)
* Changed to sort the SubstitutionClasses (new)
* If the base class is selected or Cancel is clicked in the GUI, the base class is used instead of any SubstitutionClasses for this level.
Issue#: 1838955
Modified Paths:
--------------
Trunk/pcgen/code/src/java/pcgen/core/PCClass.java
Modified: Trunk/pcgen/code/src/java/pcgen/core/PCClass.java
===================================================================
--- Trunk/pcgen/code/src/java/pcgen/core/PCClass.java 2007-11-28 19:21:32 UTC (rev 4605)
+++ Trunk/pcgen/code/src/java/pcgen/core/PCClass.java 2007-11-29 01:25:20 UTC (rev 4606)
@@ -5993,7 +5993,7 @@
*/
private void buildSubstitutionClassChoiceList(final List<PCClass> choiceList,
final int level, final PlayerCharacter aPC) {
-
+
for (SubstitutionClass sc : substitutionClassList) {
if (!PrereqHandler.passesAll(sc.getPreReqList(), aPC, this)) {
continue;
@@ -6004,6 +6004,8 @@
choiceList.add(sc);
}
+ Collections.sort(choiceList); // sort the SubstitutionClass's
+ choiceList.add(0,this); // THEN add the base class as the first choice
}
/**
@@ -6266,14 +6268,17 @@
List<PCClass> choiceList = new ArrayList<PCClass>();
buildSubstitutionClassChoiceList(choiceList, level, aPC);
- if (choiceList.size() == 0) {
- return;
+ if (choiceList.size() <= 1) {
+ return; // This means the there are no classes for which
+ // the pc meets the prerequisitions and thus the
+ // base class is chosen.
}
final ChooserInterface c = ChooserFactory.getChooserInstance();
c.setTitle("Substitution Levels");
c.setMessageText("Choose one of the listed substitution levels " +
- "or press Close to take the standard class level.");
+ "or the base class(top entry). "
+ +"Pressing Close will take the standard class level.");
c.setPool(1);
c.setPoolFlag(false);
@@ -6282,15 +6287,29 @@
c.setVisible(true);
- List<SubstitutionClass> selectedList = c.getSelectedList();
-
- if (!selectedList.isEmpty()) {
- SubstitutionClass sc = selectedList.get(0);
+ List<PCClass> selectedList = c.getSelectedList();
+ PCClass selected =selectedList.get(0);
+
+ if ((!selectedList.isEmpty()) && selected instanceof SubstitutionClass)
+ {
+ SubstitutionClass sc = (SubstitutionClass)selected;
setSubstitutionClassKey(sc.getKeyName(), aLevel);
sc.applyLevelArrayModsToLevel(this, aLevel);
return;
}
- setSubstitutionClassKey(null, aLevel);
+ else
+ {
+ /*
+ * the original code has the below line..
+ * however, it appears to not be needed.
+ * I say this because if the original buildSubstitutionClassChoiceList
+ * method returned an empty list, it returned right away without
+ * calling this method.
+ */
+ setSubstitutionClassKey(null, aLevel);
+ return;
+ }
+
}
/*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|