Package civquest.map.resource

Examples of civquest.map.resource.ResourceSet


    Iterator<ResourceEdge<FieldResourceProductionMapping, ? extends ResourceNodeManager>> edgeIterator
      = source.getOutEdgeIterator();
    while (edgeIterator.hasNext()) {
      ResourceEdge<FieldResourceProductionMapping, ? extends ResourceNodeManager> edge = edgeIterator.next();
      Field field = (Field)(edge.getDestNode().getManager());
      ResourceSet amount = producer.getResourceProduction(field.getPosition());
      change.add(edge.getID(), amount);
    }

    change.execute();
  }
View Full Code Here


     PhysicalAmount amount, ResourceDistributing distributing) {

    ResourceDistribution distribution
      = distributing.getResourceDistribution();   
   
    ResourceSet resourceSet
      = distribution.getResourcesForConsumer(consumer);
    resourceSet.addToThis(resourceName, amount);
    return new SetDistributionConsumer(consumer, resourceSet,
                       distributing);
  }
View Full Code Here

    // Mentioned in texinfo-docs (2005-07-04)
    return position;
  }

  public ResourceSet getNeededResources() {
    return new ResourceSet();
  }
View Full Code Here

  public ResourceSet getNeededResources() {
    return new ResourceSet();
  }

  public ResourceSet getMaxAcceptedResources() {
    return new ResourceSet();
  }
View Full Code Here

  }

  private void loadBasicAmounts(Section section, Field.Height height, String vegetation)
    throws ConfigurationException {
   
    ResourceSet resourceSet = new ResourceSet();
    Iterator<civquest.parser.ruleset.Field> fieldIterator = section.getFieldIterator();
    while (fieldIterator.hasNext()) {
      civquest.parser.ruleset.Field field = fieldIterator.next();
      String resourceName = field.getName();
      String amountString = field.getStringValue();
      PhysicalAmount amount = getAmount(amountString);
     
      if (!(mapConfig.resourceExists(resourceName))) {
        throw new ConfigurationException(resourceName + " is not a valid "
                         + "resource name!");
      } else {
        ResourceDefinition resourceDef = mapConfig.getResourceDefinition(resourceName);
        PhysicalAmount.PhysicalUnit standardUnit = resourceDef.getStandardUnit();
       
        if ((!amount.getUnit().canTransform(standardUnit))) {
          String msg = "Can't transform unit " + amount.getUnit() +
            " into standard unit for resource " + resourceName +
            ", which is " + standardUnit;
          throw new ConfigurationException(msg);
        } else {
          resourceSet.addToThis(resourceName, amount);
        }
      }
    }

    if (!(basicAmounts.containsKey(height))) {
View Full Code Here

      FieldReader fieldReader = gameData.getFieldReader();
      Field.Height heightLevel = fieldReader.getHeightLevel(pos);
      String vegetation = fieldReader.getVegetationName(pos);
      long population = fieldReader.getPopulation(pos);

      ResourceSet resources = getBasicAmount(heightLevel, vegetation);
      resources = resources.mult(population);

      return resources;
    }
  }
View Full Code Here

    }
  }

  private ResourceSet getBasicAmount(Field.Height height, String vegetation) {
    Map<String, ResourceSet> vegMap = basicAmounts.get(height);
    ResourceSet basicAmount = (vegMap != null ? vegMap.get(vegetation) : null);
    return (basicAmount != null ? basicAmount : EMPTY_RESOURCE_SET);
  }
View Full Code Here

TOP

Related Classes of civquest.map.resource.ResourceSet

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.