Package civquest.parser.ruleset

Examples of civquest.parser.ruleset.Section


    messages.info("MapData-Config", "VegConf", "==============================");
    messages.info("MapData-Config", "VegConf", "Loading vegetation definitions");
   
    Iterator<Section> sectionIterator = vegetationRuleset.getSectionIterator();
    while (sectionIterator.hasNext()) {
      Section section = sectionIterator.next();
      String name = section.getField("Name").getStringValue();

      checkVegetationName(name);

      if (vegetationDefinitions.containsKey(name)) {
        // vegetation already defined
View Full Code Here


    messages.info("MapData-Config", "ResourceConf", "Loading resource definitions");   

    Ruleset defRuleset = resourceRegistry.getRuleset("definition");
    Iterator<Section> sectionIterator = defRuleset.getSectionIterator();
    while (sectionIterator.hasNext()) {
      Section currSection = sectionIterator.next();

      String name = currSection.getField("Name").getStringValue();

      if (resourceDefinitions.containsKey(name)) {
        String msg = "Resource " + name + " is already defined! "
          + "(resource names must be unique) (definitions.ruleset)";
        throw new MapDefinitionException(msg);
      }

      String physUnitString = currSection.getField("StandardUnit").getStringValue();
      PhysicalAmount.PhysicalUnit physUnit
        = PhysicalAmount.PhysicalUnit.fromString(physUnitString);
      if (physUnit == null) {
        throw new RulesetException("While loading resource-definitions: "
                       + physUnitString + " is not a valid "
View Full Code Here

    this.nation = nation;
  }

  private void loadSettings(Registry registry) throws RulesetException {
    Ruleset settingRuleset = registry.getRuleset("settings");
    Section section = settingRuleset.getSection("settings");
    unitVisibilityDistance = section.getField("unitVisibilityDistance").getIntValue();
    cityVisibilityDistance = section.getField("cityVisibilityDistance").getIntValue();
   
    String fallBackTo = section.getField("fallBackTo").getStringValue();
    if (fallBackTo.equals("Terrain")) {
      useTerrainVisibility = true;
    } else if (fallBackTo.equals("Invisible")) {
      useTerrainVisibility = false;
    } else {
View Full Code Here

    }

    private void configure(Registry flatRegistry) throws RulesetException {
    Messages messages = Messages.getMessages();
        Ruleset settingsRuleset = flatRegistry.getRuleset("flatSettings");
        Section fieldViewSection = settingsRuleset.getSection("fieldViews");
        String whichFieldView = fieldViewSection.getField("whichFieldView").getStringValue();
        if (whichFieldView.equals("QuadFlatLayeredFieldView")) {
            constructLayeredFV();
        } else {
            messages.info("QuadMap.FlatProp", "QMapFV", "FallBack",
              "FlatProperties.configure says: No valid FieldView specified");
View Full Code Here

  }

  private void loadConfiguration(Registry registry) throws RulesetException {
    Registry mapRegistry = registry.getSubRegistry("map");
    Ruleset flatRuleset = mapRegistry.getRuleset("flat");
    Section distSection = flatRuleset.getSection("distances");
    diagonalDistance = distSection.getField("diagonal").getIntValue();
    straightDistance = distSection.getField("straight").getIntValue();
 
View Full Code Here

  // visibility

  private String getWhichVisManager() throws RulesetException {
    Ruleset settingsRuleset = nationRegistry.getRuleset("settings");
    Section visSection = settingsRuleset.getSection("visibility");
    return visSection.getField("whichManager").getStringValue();
  }
View Full Code Here

*/
public class DefaultUnitDestroyManager
  implements UnitDestroyManager, GameChangeListener {

  public DefaultUnitDestroyManager(Ruleset ruleset) throws RulesetException {
    Section listenerSection = ruleset.getSection("listens");
    try {
      GameChangeManager.getGameChangeManager().addAfterListener(this,
                                    "SetMapObjectHealth",
                                    "SetMapObjectHealth");
    } catch (GameChangeException e) {
View Full Code Here

      Messages.getMessages().err("DetailedUnitInfoComponent", "CivQuest will abort NOW!");
      System.exit(-1);
    }

    try {
      Section listenerSection = ruleset.getSection("listens");
      RulesetGameChangeLoader.addListener(listenerSection, this);
    } catch (Exception e) {
      Messages.getMessages().err("DetailedUnitInfoComponent", "Problem when setting up "
                     + "listeners: " + e);
      Messages.getMessages().err("DetailedUnitInfoComponent", "CivQuest will abort NOW!");
View Full Code Here

  public GlobalFunctionComponent(CivQuest civQuest) throws RulesetException {
    this.civQuest = civQuest;

    Registry topRegistry = civQuest.getTopRegistry();
    Registry mainRegistry = topRegistry.getSubRegistry("gui").getSubRegistry("main");
    Section globalFctSection = mainRegistry.getRuleset("functions").getSection("global");

    try {
      RulesetFunctionLoader.addFunctions(functionManager,
                         globalFctSection.toSwifuSection());
    } catch (FunctionException e) {
      Messages messages = Messages.getMessages();
      messages.err("GlobalFctComp", "Some error occured: " + e);
       messages.err("GlobalFctComp", "===> CivQuest will abort now!");
       System.exit(-1);     
View Full Code Here

            Messages.getMessages().err("DetailedUnitInfoComponent", "CivQuest will abort NOW!");
            System.exit(-1);
        }

        try {
            Section listenerSection = ruleset.getSection("listens");
            RulesetGameChangeLoader.addListener(listenerSection, this);
        } catch (Exception e) {
            Messages.getMessages().err("DetailedUnitInfoComponent", "Problem when setting up "
                                       + "listeners: " + e);
            Messages.getMessages().err("DetailedUnitInfoComponent", "CivQuest will abort NOW!");
View Full Code Here

TOP

Related Classes of civquest.parser.ruleset.Section

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.