Retrieve a list of campaigns named on the supplied lines. @param lines The campaign lines from the PCG file. @param gameModeName The name of the charater's game mode. @return The list of campaigns. @throws PCGParseException
(List<String> lines, String gameModeName)
| 1391 | * @throws PCGParseException |
| 1392 | */ |
| 1393 | private List<Campaign> getCampaignList(List<String> lines, String gameModeName) throws PCGParseException |
| 1394 | { |
| 1395 | |
| 1396 | final List<Campaign> campaigns = new ArrayList<>(); |
| 1397 | |
| 1398 | for (final String line : lines) |
| 1399 | { |
| 1400 | PCGTokenizer tokens; |
| 1401 | try |
| 1402 | { |
| 1403 | tokens = new PCGTokenizer(line); |
| 1404 | } |
| 1405 | catch (PCGParseException pcgpex) |
| 1406 | { |
| 1407 | /* |
| 1408 | * Campaigns are critical for characters, |
| 1409 | * need to stop the load process |
| 1410 | * |
| 1411 | * Thomas Behr 14-08-02 |
| 1412 | */ |
| 1413 | throw new PCGParseException("parseCampaignLines", line, pcgpex.getMessage(), pcgpex); |
| 1414 | } |
| 1415 | |
| 1416 | for (PCGElement element : tokens.getElements()) |
| 1417 | { |
| 1418 | String sourceKey = SourceMigration.getNewSourceKey(element.getText(), pcgenVersion, gameModeName); |
| 1419 | final Campaign aCampaign = Globals.getCampaignKeyed(sourceKey); |
| 1420 | |
| 1421 | if (aCampaign != null) |
| 1422 | { |
| 1423 | campaigns.add(aCampaign); |
| 1424 | } |
| 1425 | } |
| 1426 | } |
| 1427 | |
| 1428 | return campaigns; |
| 1429 | } |
| 1430 | |
| 1431 | private void parseCatchPhraseLine(final String line) |
| 1432 | { |
no test coverage detected