コード例 #1
0
  /** Find objects that are in visibility range. */
  protected void findVisibleObjects() {
    if (owner == null || !owner.isSpawned()) {
      return;
    }

    MapRegion[] regions = owner.getActiveRegion().getNeighbours();
    for (int i = 0; i < regions.length; i++) {
      MapRegion r = regions[i];
      FastMap<Integer, VisibleObject> objects = r.getObjects();
      for (FastMap.Entry<Integer, VisibleObject> e = objects.head(), mapEnd = objects.tail();
          (e = e.getNext()) != mapEnd; ) {
        VisibleObject newObject = e.getValue();
        if (newObject == owner || newObject == null) {
          continue;
        }

        if (!isAwareOf(newObject)) {
          continue;
        }
        if (knownObjects.containsKey(newObject.getObjectId())) {
          continue;
        }

        if (!checkObjectInRange(newObject)
            && !newObject.getKnownList().checkReversedObjectInRange(owner)) {
          continue;
        }

        /** New object is not known. */
        if (add(newObject)) {
          newObject.getKnownList().add(owner);
        }
      }
    }
  }
コード例 #2
0
ファイル: KnownList.java プロジェクト: opentree/aionj-hungary
  /** Find objects that are in visibility range. */
  protected void findVisibleObjects() {
    if (getOwner() == null || !getOwner().isSpawned()) return;

    for (MapRegion region : getOwner().getActiveRegion().getNeighbours()) {
      for (VisibleObject object : region.getVisibleObjects().values()) {
        if (!object.isSpawned()) continue;
        addKnownObject(object);
        object.getKnownList().addKnownObject(getOwner());
      }
    }
  }