Package civquest.map

Examples of civquest.map.MapData


    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(mapData.isOnMap(scrolledCoord) ? scrolledCoord : null);
       
      do {
        stepForward();
      } while (!finished && !mapData.isOnMap(adjustArrayCoordToScrolling(currCoord)));
       
      return retInfo;
    }
View Full Code Here


    notifyBefore();

    System.out.println("before done");
   

    MapData mapData = Game.getMapData();
    Unit unit = mapData.getUnit(unitID);

    // performs all necessary datastructure-upgrades (references
    // Field -> Unit, etc.)
    Game.getGame().remove(unit);
View Full Code Here

  public void execute() {
    notifyBefore();

    Game game = Game.getGame();
        Messages messages = Messages.getMessages();
        MapData mapData = Game.getMapData();
        Field field = mapData.getField(location);
        Nation nation = game.getNation(owner);

        Iterator<Unit> unitsIt = field.getUnitIterator();
        if (unitsIt.hasNext()) {
            Unit unit = unitsIt.next();
View Full Code Here

  public RestrictedToNation[] getResToNations() {
    return new RestrictedToNation[] {new RestrictedToNation()};
  }

  public void afterGameChanged(SetMapObjectHealth change) {
    MapData mapData = Game.getMapData();
    if (mapData.isUnit(change.getMapObject())) {
      if (change.getHealth() <= 0) {
        Messages.getMessages().info("DUnitDestroyManager", "Destroy",
                      "Destroying unit " + change.getMapObject()
                      + " because it has only " + change.getHealth()
                      + " (owner was: "
                      + mapData.getUnit(change.getMapObject())
                      .getOwner());
        RemoveUnit rmUnit = new RemoveUnit(change.getMapObject());
        rmUnit.execute();
        Messages.getMessages().info("DUnitDestroyManager", "Destroy",
                      "Destroying done");
View Full Code Here

           Mode mode, JScrollPane scrollPane, Session session)
    throws RulesetException {

        super(registry, topImageSet);

    MapData mapData = Game.getMapData();
 
        this.owner = owner;
    this.gameDataAccessor = gameDataAccessor;   
    this.mode = mode;
        this.scrollPane = scrollPane;
View Full Code Here

      Long aCityID = iterator.next();
      Coordinate aCityPos
        = cityReader.getCityPosition(aCityID);
      center(aCityPos);
    } else {
      MapData mapData = Game.getMapData();
      Coordinate centerPos = new Coordinate(mapData.getArrayWidth() / 2,
                          mapData.getArrayHeight() / 2);
      center(centerPos);
    }
  }
View Full Code Here

    private Coordinate adjustShowPosition(Coordinate showPosition, Coordinate showSize) {

        Coordinate maxShowPos;
        Coordinate scrollSize = properties.getScrollSize();
    MapData mapData = Game.getMapData();
   
        if (mapData.isFlatEarth()) {
            maxShowPos = properties.getPaintSize().sub(showSize);
        } else {
            maxShowPos = (Coordinate)(scrollSize.clone());
        }

        if (mapData.isFlatEarth()) {
            if (showPosition.x < 0) {
                showPosition.x = 0;
            } else if (showPosition.x >= maxShowPos.x) {
                showPosition.x = maxShowPos.x;
            }
View Full Code Here

    void markFieldForUpdate(GameDataAccessor gameData, Coordinate fieldPos) {
    civquest.util.Rectangle paintRect
      = properties.getAbsImagePaintRectangle(fieldPos);
   
    MapData mapData = Game.getMapData();
    if (!mapData.isFlatEarth()) {
      Coordinate scrollSize = properties.getScrollSize();

      if (totalBufferedSize != null) {
        if (paintRect.getX1() + scrollSize.x < totalBufferedSize.x) {
          bufferManager
View Full Code Here

  public void afterGameChanged(MoveUnit moveUnit) {
    process(moveUnit, false, true);
  }

  private void process(MoveUnit moveUnit, boolean before, boolean after) {
    MapData mapData = Game.getMapData();
   
    Long unitID = moveUnit.getUnitID();
    Long ownerID = mapData.getUnit(unitID).getOwnerID();
    Coordinate from = moveUnit.getFrom();
    Coordinate to = moveUnit.getTo();
    if (manager.getNationID().equals(ownerID)) {
      if (after) {
        manager.unitMoved(from, to);
      }
      moveUnit.notify(manager.getRestrictedToNation(), before, after);
    } else {
      if (manager.isCompleteVisible(from)) {
        if (manager.isCompleteVisible(to)) {
          moveUnit.notify(manager.getRestrictedToNation(), before, after);
        } else {
          RemoveUnit removeUnit = new RemoveUnit(manager.getRestrictedToNation(),
                               unitID);
          removeUnit.notify(before, after);
          if (before) {
            manager.removeForeignUnit(unitID);
          }
        }
      } else {
        if (manager.isCompleteVisible(to)) {
          if (after) {
            manager.addForeignUnit(unitID);
          }
          ConstructUnit constructUnit
            = new ConstructUnit(manager.getRestrictedToNation(),
                      mapData.getMapObjectPosition(unitID),
                      mapData.getMapObjectOwner(unitID));
          constructUnit.notify(before, after);
        } else {
          // do nothing, nothing is visible
        }
      }
View Full Code Here

    protected Registry guiregistry;
  protected ImageSet topImageSet;
    protected boolean positionHelp;

    public MapViewComponent(Registry registry, ImageSet topImageSet) throws RulesetException {
    MapData mapData = Game.getMapData();

        mapWidth = mapData.getArrayWidth();
        mapHeight = mapData.getArrayHeight();
    arrayWidth = mapData.getArrayWidth();
    arrayHeight = mapData.getArrayHeight();
    this.topImageSet = topImageSet;
    guiregistry = registry.getSubRegistry("gui");
    }
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.