MCPcopy Create free account
hub / github.com/PCGen/pcgen / getCampaignList

Method getCampaignList

code/src/java/pcgen/io/PCGVer2Parser.java:1393–1429  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 {

Callers 1

parcePCGSourceOnlyMethod · 0.95

Calls 6

getElementsMethod · 0.95
getNewSourceKeyMethod · 0.95
getCampaignKeyedMethod · 0.95
getMessageMethod · 0.65
addMethod · 0.65
getTextMethod · 0.45

Tested by

no test coverage detected