throw new ScenarioLoaderException("nonexistantBoard", board); //$NON-NLS-1$
System.err.println(String.format("Scenario loading: Unit declaration %s found %d times", //$NON-NLS-1$ key, p.getNumValues(key))); throw new ScenarioLoaderException("multipleUnitDeclarations", key); //$NON-NLS-1$
private Collection<Player> createPlayers(StringMultiMap p) throws ScenarioLoaderException { String sFactions = p.getString(PARAM_FACTIONS); if((null == sFactions) || sFactions.isEmpty()) { throw new ScenarioLoaderException("missingFactions"); //$NON-NLS-1$
MechSummary ms = MechSummaryCache.getInstance().getMech(sRef); if (ms == null) { throw new ScenarioLoaderException("missingRequiredEntity", sRef); //$NON-NLS-1$ } catch (NumberFormatException | IndexOutOfBoundsException | EntityLoadingException ex) { ex.printStackTrace(); throw new ScenarioLoaderException("unparsableEntityLine", s); //$NON-NLS-1$
throw new ScenarioLoaderException("missingMMSVersion"); //$NON-NLS-1$
private StringMultiMap load() throws ScenarioLoaderException { StringMultiMap props = new StringMultiMap(); try(BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(scenarioFile), "UTF-8"))) { //$NON-NLS-1$ String line = null; int lineNum = 0; while(null != (line = reader.readLine())) { ++ lineNum; line = line.trim(); if(line.startsWith(COMMENT_MARK) || (line.length() == 0)) { continue; } if(!line.contains(SEPARATOR_PROPERTY)) { System.err.println(String.format("Equality sign in scenario file %s on line %d missing; ignoring", //$NON-NLS-1$ scenarioFile, lineNum)); continue; } String elements[] = line.split(SEPARATOR_PROPERTY, -1); if(elements.length > 2) { System.err.println(String.format("Multiple equality signs in scenario file %s on line %d; ignoring", //$NON-NLS-1$ scenarioFile, lineNum)); continue; } props.put(elements[0].trim(), elements[1].trim()); } } catch(IOException e) { e.printStackTrace(); throw new ScenarioLoaderException("exceptionReadingFile", scenarioFile); //$NON-NLS-1$ } return props; }
private void parseCamo(Entity entity, String camoString) throws ScenarioLoaderException { String[] camoData = camoString.split(SEPARATOR_COMMA, -1); String camoGroup = getValidCamoGroup(camoData[0]); if(null == camoGroup) { throw new ScenarioLoaderException("invalidIndividualCamoGroup", //$NON-NLS-1$ camoData[0], entity.getDisplayName()); } String camoName = getValidCamoName(camoGroup, camoData[1]); if(null == camoName) { throw new ScenarioLoaderException("invalidIndividualCamoName", //$NON-NLS-1$ camoData[1], camoGroup, entity.getDisplayName()); } entity.setCamoCategory(camoGroup); entity.setCamoFileName(camoName); }
private void parseCamo(IPlayer player, String camoString) throws ScenarioLoaderException { String[] camoData = camoString.split(SEPARATOR_COMMA, -1); String camoGroup = getValidCamoGroup(camoData[0]); if(null == camoGroup) { throw new ScenarioLoaderException("invalidFactionCamoGroup", //$NON-NLS-1$ camoData[0], player.getName()); } String camoName = getValidCamoName(camoGroup, camoData[1]); if(null == camoName) { throw new ScenarioLoaderException("invalidFactionCamoName", //$NON-NLS-1$ camoData[1], camoGroup, player.getName()); } player.setCamoCategory(camoGroup); player.setCamoFileName(camoName); }