/** * Add a key of a map location to the processor that contains a location on the map that was yet * unchecked. * * @param key the key of the location that needs to be checked */ public void reportUnchecked(final long key) { synchronized (unchecked) { if (unchecked.contains(key)) { unchecked.add(key); } unchecked.notify(); } fullCheckNeeded = true; }
/** * Add all tiles surrounding this location and the tile above to the list of unchecked tiles. * * @param searchLoc the location of the start of the search. */ private void addAllNeighbours(final Location searchLoc) { for (int x = -1; x < 2; x++) { for (int y = -1; y < 2; y++) { if ((x == 0) && (y == 0)) { continue; } final long foundKey = Location.getKey(searchLoc.getScX() + x, searchLoc.getScY() + y, searchLoc.getScZ()); synchronized (unchecked) { if (!unchecked.contains(foundKey)) { unchecked.add(foundKey); } } } } final long foundKey = Location.getKey(searchLoc.getScX(), searchLoc.getScY(), searchLoc.getScZ() + 1); synchronized (unchecked) { if (!unchecked.contains(foundKey)) { unchecked.add(foundKey); } } }
/** * Add all tiles in the visible perspective below one location to the list of unchecked tiles * again. * * @param searchLoc the location the search starts add. This location is not added to the list of * unchecked tiles * @param limit the limit the Z coordinate is not going below */ private void addAllBelow(final Location searchLoc, final int limit) { int currX = searchLoc.getScX(); int currY = searchLoc.getScY(); int currZ = searchLoc.getScZ(); while (currZ >= limit) { currX += MapDisplayManager.TILE_PERSPECTIVE_OFFSET; currY -= MapDisplayManager.TILE_PERSPECTIVE_OFFSET; currZ--; final long foundKey = Location.getKey(currX, currY, currZ); synchronized (unchecked) { if (!unchecked.contains(foundKey)) { unchecked.add(foundKey); } } } }