/// <summary> /// Goes from this Tile in specified direction, measuring outgoing rail /// </summary> public ReturnPath getRailOutTo(Direction d) { ReturnPath p = new ReturnPath(); if (neighbors.ContainsKey(d) && neighbors[d] != null) { ReturnPath r = neighbors[d].getRailOutFrom(Utilities.oppositeDirection(d)); p.EndsWithStation = r.EndsWithStation; p.PathLength = r.PathLength + 1; p.stationColor = r.stationColor; p.stationNumber = r.stationNumber; return(p); } else { //Ends with station? int ews = EndsWithStation(d); if (ews == -1) { //No station p.EndsWithStation = false; p.PathLength = 1; } else if (ews == 0) { //Middle station p.EndsWithStation = true; p.PathLength = 1; p.stationColor = PlayerColor.None; p.stationNumber = 0; } else { //Normal station p.EndsWithStation = true; p.PathLength = 1; p.stationColor = parent.GetStationColor(ews); p.stationNumber = ews; } } return(p); }