public enum Constraint {Sea = 0, Air = 1, Land = 2, Sub = 3};

public class PathConstraints {
	private Constraint constraint;

	public PathConstraints(Constraint constraint) {
		this.constraint = constraint;
    }

	public bool canGoThrough(TerrainTriangle triangle) {
		return canGoThrough(triangle.getTerrain());
	}

	public bool canGoThrough(DTerrain terrain) {
		if (constraint == Constraint.Air) {
			return true;
		}

		if (terrain.getAltitude() < 0 && (constraint == Constraint.Sea || constraint == Constraint.Sub)) {
			return true;
		}

		if (terrain.getAltitude() >= 0 && constraint == Constraint.Land) {
			return true;
		}

		return false;
    }

	public bool isSurface() {
		return constraint != Constraint.Sub;
	}
}
