Package civquest.io

Examples of civquest.io.Messages


      }
  }
   
   
  private void dumpHumidityValues() {
    Messages messages = Messages.getMessages();
    messages.info("MWFCRivGen", "MRGenRes", "Humidity-values:");
   
    for(int y = 0;y < mapdata.getArrayHeight();y++) {
      StringBuffer currLine = new StringBuffer();
      for(int x = 0;x < mapdata.getArrayWidth();x++) {
        if(mapdata.isArrayCoordOnMap(x,y)) {
          currLine.append(getThreeDigitValue(mapdata.getField(x,y).getHumidity()));
          currLine.append(" ");
        } else {
          currLine.append("    ");
        }
      }

      currLine.append(y);
      messages.info("MWFCRivGen", "MRGenRes", currLine.toString());
    }
  }
View Full Code Here


    }
  }
   
   
  private void dumpWaterFlowValues() {
    Messages messages = Messages.getMessages();
    messages.info("MWFCRivGen", "MRGenRes", "WaterFlow:");
    for(int y = 0;y < mapdata.getArrayHeight();y++) {
      StringBuffer currLine = new StringBuffer();
      for(int x = 0;x < mapdata.getArrayWidth();x++) {
        if((mapdata.isArrayCoordOnMap(x,y))
           && (mapdata.getField(x,y).isLand())) {
          int value = mapdata.getField(x,y).getWaterFlow();
          if(value < 1000) {
            currLine.append(" " + getThreeDigitValue(value));
          } else {
            currLine.append("_" + getThreeDigitValue(value / 100));
          }
        } else {
          currLine.append("    ");
        }
      }

      currLine.append(" " + y);
      messages.info("MWFCRivGen", "MRGenRes", currLine.toString());
    }   
  }
View Full Code Here

    return parts[parts.length - 1];
  }

  private void loadVegetationDefinitions(Ruleset vegetationRuleset)
    throws ConfigurationException {
    Messages messages = Messages.getMessages();
    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
        String msg = "Vegetation " + name + " is already defined! "
          + "(vegetation names must be unique)";
        throw new MapDefinitionException(msg);
      } else {
        VegetationDefinition def = new VegetationDefinition(name);
        vegetationDefinitions.put(name, def);

        messages.info("MapData-Config", "VegConf", "Adding vegetation " + name);
      }
    }
    messages.info("MapData-Config", "VegConf", "==============================");   
  }
View Full Code Here

  }

  private void loadResourceDefinitions(Registry resourceRegistry)
    throws ConfigurationException {

    Messages messages = Messages.getMessages();
    messages.info("MapData-Config", "ResourceConf", "==============================");
    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 "
                       + "unit-identifier! (definitions.ruleset)");
      } else {
        resourceDefinitions.put(name, new ResourceDefinition(name, physUnit));

        messages.info("MapData-Config", "ResourceConf", "Adding resource " + name);
        messages.info("MapData-Config", "ResourceConf", "    --> StandardUnit: "
                + physUnit);
      }
    }

    messages.info("MapData-Config", "ResourceConf", "==============================");
  }
View Full Code Here

  public SetWorkingFieldAction(QuadMap quadMap) {
    this.quadMap = quadMap;
  }

  public void actionPerformed(FunctionActionEvent e) {
    Messages messages = Messages.getMessages();

    if (quadMap.setWFByMouse()) {
      Field pointedField = quadMap.getFieldAtPosition(e.getPosition());
      if (pointedField != quadMap.getWorkingField()) {
        Coordinate pos = null;
        if (pointedField != null) {
          pos = pointedField.getPosition();
        }
       
        SetWorkingField setWFChange = new SetWorkingField(quadMap, pos);
        setWFChange.execute();
      }     
    } else if (quadMap.setWFByKeyboard()) {
      messages.err("SetWorkingFieldAction", "setWFByKeyboard not yet implemented");
    } else {
      messages.err("SetWorkingFieldAction", "SetWorkingField: BUG!!! " +
             "Either setWFByMouse or setWFByKeyboard must be true!!!");
     
    }
   
  } 
View Full Code Here

      }
  }
    }

    private void setClimate(){
    Messages messages = Messages.getMessages();

    int tc = 0;
 
 
    /* Air temperature */
    messages.info("ClimateGenerator", "CVGenState", "Setting climate")
    int map[][] = new AirTemperatureMap(this.mapData, this.mapType, polTemp, eqTemp, bands).getAirTemperatureMap();
    for (int x = 0; x<map.length; x++)
      for (int y = 0; y<map[0].length; y++){
        Field f = mapData.getField(mapData.mapCoordinate(new Coordinate(x,y)));
        if (f.isHills()) {
          f.setTemperature(map[x][y] - 20);
        } else if (f.isMountain()) {
          f.setTemperature(map[x][y] - 30);
        } else if (f.isHighMountain()) {
          f.setTemperature(map[x][y] - 40);
        } else {
          f.setTemperature(map[x][y]);
        }

//         if (f.isLand() && !(f.isPlain()))
//           f.setTemperature(map[x][y]-(f.getHeightLevel()*10));
//         else
//           f.setTemperature(map[x][y]);
      }
    messages.info("ClimateGenerator", "CVGenState", "Air temperatures set")
    messages.info("ClimateGenerator", "CVGenState", "Creating Seabed River(s)");
    for (int i = 0; i<streams; i++)
      new SeaBedRiver(mapData,Util.getRandomNumber(10)+1); // Hopefully to be done in a better way soon.

    messages.info("ClimateGenerator", "CVGenState", "Seabed Rivers (Streams) generated!");

    messages.info("ClimateGenerator", "CVGenState", "Setting precipitation rate")

    /* Percepitation */ /* NOT DONE */
    new PrecipitationMap(this.mapData);

    }
View Full Code Here

  }
  return prob;
    }

    public void generate(MapData mapData){
    Messages messages = Messages.getMessages();
   
        this.mapData = mapData;       
        width = mapData.getArrayWidth();
        height = mapData.getArrayHeight();

    setClimate();
    messages.info("ClimateGenerator", "CVGenState", "Setting landscape");
    generateLandscape();

  //  setLayer(Field.LAYER_TERRAIN, String layerData) { layers.put(new Integer(layer), layerData); }
//   Coordinate hei = new Coordinate(width/2, height/2);

//   mapData.getField(hei).setLayer(Field.LAYER_RESOURCE, "Red");
//   mapData.getField(hei).setLayer(Field.LAYER_CITY, "City");
//   Field[] z = mapData.getNeighborFields(mapData.getField(hei));
//   for (int i = 0; i<z.length; i++)
//       if (z[i]!=null)
//     z[i].setLayer(Field.LAYER_RESOURCE, "Red");   
//   hei.x += 6;

//   mapData.getField(hei).setLayer(Field.LAYER_RESOURCE, "Blue");
//   mapData.getField(hei).setLayer(Field.LAYER_CITY, "City");
//   z = mapData.getNeighborFields(mapData.getField(hei));
//   for (int i = 0; i<z.length; i++)
//       if (z[i]!=null)
//     z[i].setLayer(Field.LAYER_RESOURCE, "Blue");   

//   hei.y += 3;
//   mapData.getField(hei).setLayer(Field.LAYER_RESOURCE, "Blue");
//   mapData.getField(hei).setLayer(Field.LAYER_ROAD, "Tank");
//   hei.y -= 3;
//   hei.x += 6;
//   mapData.getField(hei).setLayer(Field.LAYER_RESOURCE, "Red");
//   mapData.getField(hei).setLayer(Field.LAYER_ROAD, "Doubledecker");

    messages.info("ClimateGenerator", "CVGenState", "Done");
    }
View Full Code Here

        configure(flatRegistry);
    }

    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");
            messages.info("QuadMap.FlatProp", "QMapFV", "FallBack",
              "-> Using QuadFlatLayeredFieldView as an default");
            constructLayeredFV();
        }
       
        unitRuleset = flatRegistry.getRuleset("unitimages");       
View Full Code Here

              ringrc_flowvalues[from][to] = 100;
            }
          }
    }
    public void dump() {
      Messages messages = Messages.getMessages();

      messages.info("MWFCRivGen", "MRGenConf", "MWFCRiverGenerator - Configuration");
      messages.info("MWFCRivGen", "MRGenConf", "--> firststeptries = " + firststeptries);
      messages.info("MWFCRivGen", "MRGenConf", "--> RandomPointRiverStarter:");
      messages.info("MWFCRivGen", "MRGenConf",
              "    --> starttries = " + rprstarter_starttries);
      messages.info("MWFCRivGen", "MRGenConf", "--> ProbRiverEvolver:");
      messages.info("MWFCRivGen", "MRGenConf", "    --> probtable:");
      for(int from = 0;from < 4;from++)
        for(int to = 0;to < 4;to++)
          messages.info("MWFCRivGen", "MRGenConf", "        --> "
                  + getHeightString(from) + " -> " + getHeightString(to) +
                  " with probability " + probevprobs[from][to]);

      StringBuffer probString = new StringBuffer();
      for(int n = 0;n < 3;n++) {
        probString.append(probev_callstoppoints[n] + " ");
      }
      messages.info("MWFCRivGen", "MRGenConf",
              "    --> callstoppoints for first, second, third call: "
              + probString.toString());

      messages.info("MWFCRivGen", "MRGenConf",
              "    --> turningpointstoppoints = " + probev_turningpointstoppoints);
      messages.info("MWFCRivGen", "MRGenConf",
              "    --> turningpointprobability = " + probev_turningpointprobability);
      messages.info("MWFCRivGen", "MRGenConf", "    --> divfactor = " + probev_divfactor);
      messages.info("MWFCRivGen", "MRGenConf",
              "    --> seastopprobsuse = " + probev_seastopprobsuse);
      messages.info("MWFCRivGen", "MRGenConf",
              "    --> seastopprobs and seastopprobsmindepth:");

      for(int n = 0;n < probev_seastopprobs.length;n++) {
        messages.info("MWFCRivGen", "MRGenConf",
                "        --> for distance to sea " + (n+1) + ": probability " +
                probev_seastopprobs[n] + " and mindepth "
                + probev_seastopprobsmindepth[n]);
      }

      messages.info("MWFCRivGen", "MRGenConf",
              "    --> spforseadistuse = " + probev_spforseadistuse);
     

      StringBuffer distString = new StringBuffer();
      for(int n = 0;n < probev_spforseadist.length;n++) {
        distString.append(" Distance " + (n+1) + " => " + probev_spforseadist[n]);
      }
      messages.info("MWFCRivGen", "MRGenConf",
              "    --> spforseadist: " + distString.toString());

      messages.info("MWFCRivGen", "MRGenConf",
              "    --> spfornearerseause = " + probev_spfornearerseause);
      messages.info("MWFCRivGen", "MRGenConf",
              "    --> spfornearersea = " + probev_spfornearersea);
      messages.info("MWFCRivGen", "MRGenConf",
              "    --> nearerseamaxdist = " + probev_nearerseamaxdist);
      messages.info("MWFCRivGen", "MRGenConf",
              "    --> spforturnarounduse = " + probev_spforturnarounduse);
      messages.info("MWFCRivGen", "MRGenConf",
              "    --> spforturnaround = " + probev_spforturnaround);
      messages.info("MWFCRivGen", "MRGenConf",
              "    --> turnaroundmindist = " + probev_turnaroundmindist);

      messages.info("MWFCRivGen", "MRGenConf", "--> RingRiverCompleter:");
      messages.info("MWFCRivGen", "MRGenConf",
              "    --> ignoreprobability = " + ringrc_ignoreprobability);
      messages.info("MWFCRivGen", "MRGenConf",
              "    --> flowvalue-table:");
      for(int from = 0;from < 4;from++)
        for(int to = 0;to < 5;to++)
          messages.info("MWFCRivGen", "MRGenConf",
                  "        --> " + getHeightString(from) + " -> "
                  + getHeightString(to) +
                  " has flowvalue " + ringrc_flowvalues[from][to]);
    }
View Full Code Here

    if (whichVisManager.equals(REALITY_VISIBILITY)) {
      setUpRealityVisManager();
    } else if (whichVisManager.equals(BLACK_WHITE_VISIBILITY)) {
      setUpBlackWhiteVisManager();
    } else {
      Messages messages = Messages.getMessages();
      messages.info("Nation", "GlobRuleConf", "FallDefault",
              whichVisManager + " is not a valid visibilityManager!");
      messages.info("Nation", "GlobRuleConf", "FallDefault",
              "Using BlackWhiteVisibilityManager instead.");
      setUpBlackWhiteVisManager();
    }
  }
View Full Code Here

TOP

Related Classes of civquest.io.Messages

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.