Package civquest.map

Examples of civquest.map.FieldReader


    Iterator iterator = Game.getMapData().getRectIterator(pos, getUnitVisDistance());
    while (iterator.hasNext()) {
      Coordinate checkPos = (Coordinate)(iterator.next());

      // BWVMs own readers!
      FieldReader fieldReader = getFieldReader();
      MapObjectReader moReader = getMapObjectReader();
      if (fieldReader.areUnitsAvailable(checkPos)) {
        Iterator<Long> unitIterator = fieldReader.getUnits(checkPos);
        while (unitIterator.hasNext()) {
          Long currID = unitIterator.next();
          if (moReader.isMapObjectOwnerAvailable(currID)
            && getNationID().equals(moReader.getMapObjectOwner(currID))
            && (!(currID.equals(notThisOne)))) {
View Full Code Here


  private static boolean foreignStops(GameDataAccessor gameData,
                     Long owner, Coordinate to) {
    if (owner == null) {
      return false;
    } else {
      FieldReader fieldReader = gameData.getFieldReader();
      MapObjectReader moReader = gameData.getMapObjectReader();
      RestrictedToNation resToNation = gameData.getRestrictedToNation();

      if (fieldReader.areMapObjectsAvailable(to)) {
        Iterator<Long> mapObjects = fieldReader.getMapObjects(to);
        while (mapObjects.hasNext()) {
          Long mo = mapObjects.next();
          if (moReader.isMapObjectOwnerAvailable(mo)) {
            Long toOwner = moReader.getMapObjectOwner(mo);
            if (!(owner.equals(toOwner))) {
View Full Code Here

   *  Foreign in the sense of "any nation except the active one", where "active"
   *  is specified by the given game-data.
   */
  private static boolean containsForeignTargets(GameDataAccessor gameData,
                          Long owner, Coordinate pos) {
    FieldReader fieldReader = gameData.getFieldReader();
    MapObjectReader moReader = gameData.getMapObjectReader();

    if (!fieldReader.areUnitsAvailable(pos) || owner == null) {
      return false;
    } else {
      Iterator<Long> unitIterator = fieldReader.getUnits(pos);
      while (unitIterator.hasNext()) {
        Long currUnit = unitIterator.next();
        if (moReader.isMapObjectOwnerAvailable(currUnit)) {
          Long foreignOwner = moReader.getMapObjectOwner(currUnit);
          if (!(owner.equals(foreignOwner))) {
View Full Code Here

  public void afterGameChanged(FieldChange fieldChange) {
   
    if (pos != null) {
      Long[] fieldIDs = fieldChange.getFields();
      FieldReader fieldReader = gameData.getFieldReader();

      for (Long fieldID : fieldIDs) {
        Coordinate changePos = fieldReader.getFieldPosition(fieldID);
        if (pos.equals(changePos)) {
          repaint();
          break;
        }
      }
View Full Code Here

    // (and by not asking the change, we don't need to check if there is
    // perhaps a second MapView setting its working-field...)

    Coordinate workingFieldPos = mainMapView.getWorkingFieldPos();

    FieldReader fieldReader = gameData.getFieldReader();
    if (workingFieldPos != null && fieldReader.areUnitsAvailable(workingFieldPos)) {
      Iterator<Long> unitIDs = fieldReader.getUnits(workingFieldPos);
      if (unitIDs.hasNext()) {
        unitInfoComp.setUnit(unitIDs.next());
      } else {
        unitInfoComp.setUnit(null);
      }
View Full Code Here

        this.workingFieldPos = this.mainMapView.getWorkingFieldPos();
        this.detailedFieldInfoComp.setPos(this.workingFieldPos);

        this.wfUnits.clear();
        this.wfInfoPanel.removeAll();
        FieldReader fieldReader = this.gameData.getFieldReader();

        if (this.workingFieldPos != null &&
                fieldReader.areUnitsAvailable(this.workingFieldPos)) {

            Iterator<Long> iterator = fieldReader.getUnits(
                this.workingFieldPos);
            for (;iterator.hasNext();) {
                Long unitID = iterator.next();
                UnitInfoComponent infoComponent = new UnitInfoComponent(
                    unitID, this.unitInfoRuleset, true, this.gameData);
View Full Code Here

  }

    private void addUnitsOnFieldsToMarked(Long[] fieldIDs) {
       
        Coordinate[] coords = MapData.getCoords(fieldIDs);
        FieldReader fieldReader = this.gameData.getFieldReader();

        for (Coordinate coord : coords) {
            if (fieldReader.areUnitsAvailable(coord)) {
                Iterator<Long> uit = fieldReader.getUnits(coord);
                for (;uit.hasNext();) {
                    Long unitID = uit.next();
                    if (!this.markedFieldUnits.containsKey(unitID)) {
                        UnitInfoComponent infoComponent;
                        if (!this.activeUnits.containsKey(unitID)) {
View Full Code Here

     * @param fieldIDs the fields whose units will be removed
     */
    private void removeUnitsOnFieldsFromMarked(Long[] fieldIDs) {
       
        Coordinate[] coords = MapData.getCoords(fieldIDs);
        FieldReader fieldReader = this.gameData.getFieldReader();

        for (Coordinate coord : coords) {
            if (fieldReader.areUnitsAvailable(coord)) {
                Iterator<Long> uit = fieldReader.getUnits(coord);
                for (;uit.hasNext();) {
                    Long unitID = uit.next();
                    if (this.markedFieldUnits.containsKey(unitID) &&
                            !this.activeUnits.containsKey(unitID)) {
                        this.markedInfoPanel.remove(this.markedFieldUnits.get(unitID));
View Full Code Here

   
    public void afterGameChanged(MarkField change) {
        Field markedField = Game.getMapData().getField(change.getFields()[0]);
       
        if (markedField != null) {
            FieldReader fieldReader = gameData.getFieldReader();
            Coordinate lmfPosition = markedField.getPosition();
            String vegName = fieldReader.getVegetationName(lmfPosition)
                .toLowerCase();

            setSelectedButton(this.vegetationButtons, vegName);

            this.createHeightButtons(vegName);
            String heightName = Field.getHeightString(
                    fieldReader.getHeightLevel(lmfPosition));

            setSelectedButton(this.heightButtons, heightName);
            this.civQuest.repaint();
        }
    }
View Full Code Here

     *
     * @return the IDs of all units on this group's fields
     */
    public Set<Long> getUnitsOnFields() {
        Set<Long> units = new HashSet();
        FieldReader fieldReader = this.gameData.getFieldReader();
        for (Coordinate coord : this.fields) {
            if (fieldReader.areUnitsAvailable(coord)) {
                Iterator<Long> uit = fieldReader.getUnits(coord);
                for (;uit.hasNext();) {
                    units.add(uit.next());
                }
            }
        }
View Full Code Here

TOP

Related Classes of civquest.map.FieldReader

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.