Package civquest.map

Examples of civquest.map.Field


   * @param targetPos position of target field, may not be null
   * @return see above
   */
  private static boolean areOnOneNeighborField(Set<Attacking> attackings,
                         Coordinate targetPos) {
    Field field = null;
    for (Attacking attacker : attackings) {
      if (field == null || field.equals(attacker.getField())) {
        field = attacker.getField();
      } else {
        // The Attackings are located on more than one field
        return false;
      }
    }
   
    return field != null
      && Game.getMapData().areNeighborCoords(field.getPosition(),  targetPos)
      && !(field.getPosition().equals(targetPos));
   
 
View Full Code Here


   
    private void updateWorkingField(Point position) {
        Messages messages = Messages.getMessages();

        if (this.setWFByMouse()) {
            Field pointedField = this.getFieldAtPosition(position);
            if (pointedField != this.getWorkingField()) {
                Coordinate pos = null;
                if (pointedField != null) {
                    pos = pointedField.getPosition();
                }
                SetWorkingField setWFChange = new SetWorkingField(this, pos);
                setWFChange.execute();
            }          
        } else if (this.setWFByKeyboard()) {
View Full Code Here

  }

  public void execute() {
    notifyBefore();

    Field field = null;
    if (coord != null) {
      field = Game.getMapData().getField(coord);
    }
   
    mapViewComponent.setWorkingField(field);
View Full Code Here

//    public void afterGameChanged(UnmarkField change) {
        //TODO do we really have to listen to UnmarkField???
//    }
   
    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);
View Full Code Here

       
        Iterator<Coordinate> mfit = this.mainMapView.getActiveGroup()
            .getFieldIterator();
        for (;mfit.hasNext();) {
            Coordinate coord = mfit.next();
            Field field = mapData.getField(coord);
            field.setHeightLevel(Field.getHeightConstant(height));
            try {
                field.setValues(new VegetationData(
                        this.registry, vegName), -1, -1);
            } catch (RulesetException rse) {
                CivQuest.showErrorQuitDialog("There was an error " +
                        "related to ruleset-loading: ", rse);
            }
            ((QuadMap) this.mainMapView).getFieldView(
                    game, field.getPosition()).dataChanged();
           
           
        }

        this.civQuest.repaint();
View Full Code Here

  public void actionPerformed(FunctionActionEvent e) {
    Point position = e.getPosition();

    if (position != null) {
      Field field = quadMap.getFieldAtPosition(position);
   
      if (field != null) {
        GameDataAccessor gameData = quadMap.getGameData();
        FieldReader fieldReader = gameData.getFieldReader();

        Messages messages = Messages.getMessages();
        messages.info("MoveUnitsToWF", "FieldProp", "Information about field at coord "
                + field.getPosition() + ": " + field);
      }
    } else {
      Messages messages = Messages.getMessages();
      messages.info("MoveUnitsToWF", "FieldProp", "No field at " + position);
    }
View Full Code Here

     * will be deleted.
     */
    public void actionPerformed(FunctionActionEvent e) {

        Vector<MapObject> mapObjects = new Vector();
        Field field = this.map.getWorkingField();
        Iterator<Unit> unitsIt = field.getUnitIterator();
        for (;unitsIt.hasNext();) {
            mapObjects.add(unitsIt.next());
        }
        City city = field.getCityOnField();
        if (city != null) {
            mapObjects.add(city);
        }

        if (mapObjects.size() == 1) {
            removeObjects(mapObjects, this.map, field.getPosition());
        } else if (mapObjects.size() > 1) {
            new RemoveDialog(null, field, mapObjects, this.map);
        }
    }
View Full Code Here

  }

  private void calculateSources(City city) {
    Iterator<Field> ruledFieldIterator = city.getRuledFieldIterator();
    while (ruledFieldIterator.hasNext()) {
      Field field = ruledFieldIterator.next();
      Long fieldID = field.getID();
      throw new ResourceGraphException("Re-implement this!");
//       ResourceSet produced = field.getProducedResources();
//       SetDistributionSource change
//         = new SetDistributionSource(fieldID, produced, city);
//       change.execute();
View Full Code Here

    TurnManager turnManager = Game.getGame().getTurnManager();
    Nation currNation = turnManager.getActiveNation();
   
    Coordinate position = change.getPosition();
    MapData mapData = Game.getMapData();
    Field field = mapData.getField(position);
    Long cityID = change.getCityID();
    City city = mapData.getCity(cityID);

    throw new ResourceGraphException("Re-implement this!");
//     ResourceDistribution distribution = null;
View Full Code Here

            removeMarkedButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    ObjectsButton button = (ObjectsButton) e.getSource();
                    Vector<MapObject> mapObjects = button.getMapObjects();
                    Vector<JCheckBox> checkBoxes = button.getCheckBoxes();
                    Field field = button.getField();
                    QuadMap map = button.getMap();
                    Vector<MapObject> delObjects = new Vector();
                    for (int i = 0; i<mapObjects.size(); i++) {
                        if (checkBoxes.get(i).isSelected()) {
                            delObjects.add(mapObjects.get(i));
                        }
                    }
                    if (!delObjects.isEmpty()) {
                        removeObjects(delObjects, map, field.getPosition());
                    }
                    setVisible(false);
                }
            });

            ObjectsButton removeAllButton = new ObjectsButton(
                    this.mapObjects, this.checkBoxes, "Remove all",
                    field, this.map);
            removeAllButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    ObjectsButton button = (ObjectsButton) e.getSource();
                    Vector<MapObject> mapObjects = button.getMapObjects();
                    Field field = button.getField();
                    QuadMap map = button.getMap();
                    removeObjects(mapObjects, map, field.getPosition());
                    setVisible(false);
                }
            });
           
            JButton cancelButton = new JButton("Cancel");
View Full Code Here

TOP

Related Classes of civquest.map.Field

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.