(final String line)
| 3417 | } |
| 3418 | |
| 3419 | private void parseRaceLine(final String line) throws PCGParseException |
| 3420 | { |
| 3421 | List<PCGElement> elements = new PCGTokenizer(line).getElements(); |
| 3422 | PCGElement raceElement = elements.get(0); |
| 3423 | String raceName = EntityEncoder.decode(raceElement.getText()); |
| 3424 | // Check for a race key that has been updated. |
| 3425 | raceName = RaceMigration.getNewRaceKey(raceName, pcgenVersion, SettingsHandler.getGameAsProperty().get().getName()); |
| 3426 | final Race aRace = |
| 3427 | Globals.getContext().getReferenceContext().silentlyGetConstructedCDOMObject(Race.class, raceName); |
| 3428 | |
| 3429 | if (aRace == null) |
| 3430 | { |
| 3431 | final String msg = LanguageBundle.getFormattedString("Exceptions.PCGenParser.RaceNotFound", //$NON-NLS-1$ |
| 3432 | raceName); |
| 3433 | throw new PCGParseException("parseRaceLine", line, msg); //$NON-NLS-1$ |
| 3434 | } |
| 3435 | String selection = null; |
| 3436 | //Yes, start at 1, 0 was the race |
| 3437 | for (int i = 1; i < elements.size(); i++) |
| 3438 | { |
| 3439 | PCGElement thisElement = elements.get(i); |
| 3440 | final String aString = thisElement.getName(); |
| 3441 | if (aString.startsWith(IOConstants.TAG_APPLIEDTO)) |
| 3442 | { |
| 3443 | if (selection != null) |
| 3444 | { |
| 3445 | warnings.add("Found multiple selections for Race: " + aRace.getKeyName()); |
| 3446 | } |
| 3447 | selection = thisElement.getText(); |
| 3448 | } |
| 3449 | else if (!aString.startsWith(IOConstants.TAG_ADDTOKEN)) |
| 3450 | { |
| 3451 | final String msg = |
| 3452 | LanguageBundle.getFormattedString("Warnings.PCGenParser.UnknownRaceInfo", //$NON-NLS-1$ |
| 3453 | aString + ":" + thisElement.getText()); |
| 3454 | warnings.add(msg); |
| 3455 | } |
| 3456 | } |
| 3457 | raceInputFacet.importSelection(thePC.getCharID(), aRace, selection); |
| 3458 | thePC.setDirty(true); |
| 3459 | |
| 3460 | //Must process ADD after RACE is added to the PC |
| 3461 | for (PCGElement e : new PCGTokenizer(line).getElements()) |
| 3462 | { |
| 3463 | String tag = e.getName(); |
| 3464 | if (tag.equals(IOConstants.TAG_ADDTOKEN)) |
| 3465 | { |
| 3466 | parseAddTokenInfo(e, aRace); |
| 3467 | } |
| 3468 | } |
| 3469 | |
| 3470 | // TODO |
| 3471 | // adjust for more information according to |
| 3472 | // PCGVer1Creator.appendRaceLine |
| 3473 | } |
| 3474 | |
| 3475 | private void parseFavoredClassLine(final String line) |
| 3476 | { |
no test coverage detected