public Structure getNearestStructure(Class<?> class1, Tile tile, Dude dude) {
		int x = tile.getX();
		int y = tile.getY();
		int bestSquaredDistance = Integer.MAX_VALUE;
		Structure bestStructure = null;

		for (Structure r : structures) {
			if (!class1.isInstance(r))
				continue;
			Tile td = getTile(r.getX(), r.getY());
			if (td.getDude() != null && td.getDude() != dude)
				continue;
			int squaredDistance = (r.getX() - x) * (r.getX() - x)
					+ (r.getY() - y) * (r.getY() - y);
			if (squaredDistance < bestSquaredDistance) {
				if (getLogic().canPath(tile, getTile(r.getX(), r.getY()))) {
					bestSquaredDistance = squaredDistance;
					bestStructure = r;
				}
			}

		}
		return bestStructure;
	}