byte reference = (byte) (CompassPoints.NORTH | CompassPoints.SOUTH); byte currentLayout = oldTile.getTrackTile().getTrackConfiguration(); for (int i = 0; i < 4; i++) { if (currentLayout == reference) return true; currentLayout = CompassPoints.rotateClockwise(currentLayout); } return false;
return true;
    public boolean canBuiltStationHere(Point p) {        FreerailsTile oldTile = w.getTile(p.x, p.y);        if (oldTile.getTrackTile() == null)	    return false;	/* if there is a building present, it must be a station */	BuildingTile bTile = oldTile.getBuildingTile();	if (bTile != null) {	   BuildingType bType = (BuildingType) w.get(KEY.BUILDING_TYPES,		   bTile.getType(), Player.AUTHORITATIVE);		if (bType.getCategory() != BuildingType.CATEGORY_STATION)		    return false;	}	/* further condition is that track must be straight with no branches */	byte reference = (byte) (CompassPoints.NORTH | CompassPoints.SOUTH);	byte currentLayout = oldTile.getTrackTile().getTrackConfiguration();	for (int i = 0; i < 4; i++) {	    if (currentLayout == reference)		return true;	    currentLayout = CompassPoints.rotateClockwise(currentLayout);	}	return false;    }