Package civquest.map

Examples of civquest.map.MapData


   (description copied from Properties)
   @param buffer any Buffer
   */
  public void updateDirtyFields(Buffer buffer, BufferManager bufferManager)
    throws InvalidImageException {
    MapData mapData = Game.getMapData();

    Rectangle fieldRect = buffer.getFieldRect();

    Coordinate fieldStart = fieldRect.getTopLeftCorner();
    boolean[][] markedFields = buffer.getMarkedFields();
View Full Code Here


      startCoord = (Coordinate)(lineStartCoord.clone());
      currCoord = (Coordinate)(lineStartCoord.clone());
      endCoord = unscrolledCoord2;

      MapData mapData = Game.getMapData();
      while (!finished && !mapData.isOnMap(adjustArrayCoordToScrolling(currCoord))) {
        stepForward();
      }
    }
View Full Code Here

    public Object next() {
      if (finished) {
        throw new NoSuchElementException();
      }

      MapData mapData = Game.getMapData();

      PaintInfo retInfo = new PaintInfo();
      retInfo.setCoord((Coordinate)(currCoord.clone()));

      Coordinate scrolledCoord = adjustArrayCoordToScrolling(currCoord);
      retInfo.setFieldPos(scrolledCoord);

      do {
        stepForward();
      } while (!finished && !mapData.isOnMap(adjustArrayCoordToScrolling(currCoord)));

      return retInfo;
    }
View Full Code Here

  private Long nationID = null;

  public RemoveUnit(Long unitID) {
    super(unitID);

    MapData mapData = Game.getMapData();
    Coordinate coord = mapData.getMapObjectPosition(unitID);
    addFieldID(mapData.getFieldID(coord));
    this.nationID = mapData.getMapObjectOwner(unitID);
    addNationID(this.nationID);
    this.unitID = unitID;
  }
View Full Code Here

    this.unitID = unitID;
  }

  public RemoveUnit(RestrictedToNation resToNation, long unitID) {
    super(resToNation, unitID);
    MapData mapData = Game.getMapData();
    Coordinate coord = mapData.getMapObjectPosition(unitID);
    addFieldID(mapData.getFieldID(coord));
    this.nationID = mapData.getMapObjectOwner(unitID);
    addNationID(nationID);
    this.unitID = unitID;
  }
View Full Code Here

    JScrollPane scrollPane = null;
    QuadMap map = null;
    try {
       scrollPane = new JScrollPane();

       MapData mapData = Game.getMapData();

       if(mapData instanceof FlatMapData) {
         map = new QuadMap(civQuest,
                   registry, topImageSet, Const.FLAT,
                  QuadMap.Mode.GAME,
View Full Code Here

    JScrollPane scrollPane = null;
    QuadMap map = null;
    try {
       scrollPane = new JScrollPane();

       MapData mapData = Game.getMapData();


       if(mapData instanceof FlatMapData) {
         map = new QuadMap(civQuest, Game.getGame(),
                   registry, topImageSet, Const.FLAT,
View Full Code Here

  }

  public void execute() {
      notifyBefore();
      Messages messages = Messages.getMessages();
        MapData mapData = Game.getMapData();

        Field field = mapData.getField(location);
        Nation nation = Game.getGame().getNation(ownerNation);

        Iterator<Unit> unitsIt = field.getUnitIterator();
        if (unitsIt.hasNext()) {
            Unit unit = unitsIt.next();
            if (!unit.getOwner().equals(nation)) {
                messages.err("ConstructCity", "You try to build a city " +
                        "on a field where another nation's unit is located.");
                return;
            }
        }
       
        if (field.getCityOnField() != null &&
                !field.getCityOnField().getOwner().equals(nation)) {
            messages.err("ConstructCity", "You try to build a city " +
            "on a field where another nation's city is located.");
            return;
        }

        City city = new City(field, "New City");
    Game.getGame().add(city);
    mapData.setCityOwner(city, nation);
//         mapData.addCity(city, field, nation);

        setCityID(city.getID());
       
      notifyAfter();
View Full Code Here

  }

  public void execute() {
    notifyBefore();

    MapData mapData = Game.getMapData();
    mapData.removeCity(cityID);

    forgetCityID();

    notifyAfter();
  }
View Full Code Here

  private abstract class BorderPainter {

    public void paintBorders(Coordinate coord, Graphics g) {

      Session session = quadMap.getSession();
      MapData mapData = Game.getMapData();
     
      FieldReader fieldReader = gameData.getFieldReader();
      if (fieldReader.isFieldOwnerAvailable(position)) {
        Long owner = fieldReader.getFieldOwner(position);

        if (owner == null) {
          return;
        }

        g.setColor(session.getNationColor(owner));

        Coordinate[] neighborCoords = position.getDirectNeighborCoords();

        for (Coordinate neighborPos : neighborCoords) {
          Coordinate adjustedNeighborPos
            = mapData.adjustToMapSize((Coordinate)neighborPos.clone());
          if (adjustedNeighborPos == null) {
            continue;
          }

          if (fieldReader.isFieldOwnerAvailable(adjustedNeighborPos)) {
View Full Code Here

TOP

Related Classes of civquest.map.MapData

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.