Exemple #1
0
        public static List <int> LinkedPaths(this BuildingInfo info, int inx, List <int> inxSoFar = null)
        {
            List <int> retval = new List <int>();

            var paths      = info.GetPaths(true);
            var targetPath = paths[inx];

            if (inxSoFar == null)
            {
                inxSoFar = new List <int>();
            }
            else
            {
                retval.Add(inx);
            }
            inxSoFar.Add(inx);
            var trackPaths = paths.Where(p => p?.m_netInfo != null && (p.m_netInfo.IsTrainTrackAI() || p.m_netInfo.IsTrainTrackBridgeAI() || p.m_netInfo.IsTrainTrackAIMetro() || p.m_netInfo.IsTrainTrackBridgeAIMetro() || ((p.m_netInfo.IsTrainTrackTunnelAI() || p.m_netInfo.IsTrainTrackTunnelAIMetro()) && (p.m_netInfo.name.Contains("Sunken") || !p.m_netInfo.IsStationTrack()))));

            for (int i = 0; i < paths.Count(); i++)
            {
                if (trackPaths.Contains(paths[i]))
                {
                    if (!inxSoFar.Contains(i))
                    {
                        if (targetPath.m_nodes.Any(n => paths[i].m_nodes.Contains(n)) && targetPath.m_nodes != paths[i].m_nodes)
                        {
                            depth++;
                            retval.AddRange(info.LinkedPaths(i, inxSoFar));
                            depth--;
                        }
                    }
                }
            }
            return(retval);
        }
Exemple #2
0
        public static void SetTrackVehicleType(this BuildingInfo info, int inx, TrackVehicleType vehicleType)
        {
            var path = info.GetPaths()[inx];

            switch (vehicleType)
            {
            case TrackVehicleType.Default:
                if ((path.m_finalNetInfo.IsElevatedSidePlatformTrainStationTrack() || path.m_finalNetInfo.IsGroundSinglePlatformTrainStationTrack()) && (path.m_netInfo.IsElevatedSidePlatformMetroStationTrack() || path.m_netInfo.IsGroundSinglePlatformMetroStationTrack()) ||
                    (path.m_finalNetInfo.IsElevatedSidePlatformMetroStationTrack() || path.m_finalNetInfo.IsGroundSinglePlatformMetroStationTrack()) && (path.m_netInfo.IsElevatedSidePlatformTrainStationTrack() || path.m_netInfo.IsGroundSinglePlatformTrainStationTrack()))
                {
                    InvertPath(path);
                }
                path.AssignNetInfo(path.m_netInfo);
                break;

            case TrackVehicleType.Train:
                if (path.m_finalNetInfo.IsAbovegroundMetroStationTrack())
                {
                    if (path.m_finalNetInfo.IsElevatedSidePlatformMetroStationTrack())
                    {
                        path.AssignNetInfo(ModTrackNames.TRAIN_STATION_TRACK_ELEVA, false);     //somehow expand this for the other types
                    }
                    else if (path.m_finalNetInfo.IsSunkenSidePlatformMetroStationTrack())
                    {
                        path.AssignNetInfo(ModTrackNames.TRAIN_STATION_TRACK_SUNKEN, false);
                    }
                    else if (path.m_finalNetInfo.IsGroundSidePlatformMetroStationTrack())
                    {
                        path.AssignNetInfo(ModTrackNames.TRAIN_STATION_TRACK_GROUND, false);
                    }
                    else if (path.m_finalNetInfo.IsElevatedSinglePlatformMetroStationTrack())
                    {
                        InvertPath(path);
                        path.AssignNetInfo(ModTrackNames.TRAIN_STATION_TRACK_ELEVATED_SMALL, false);
                    }
                    else if (path.m_finalNetInfo.IsGroundSinglePlatformMetroStationTrack())
                    {
                        InvertPath(path);
                        path.AssignNetInfo(ModTrackNames.TRAIN_STATION_TRACK_GROUND_SMALL, false);
                    }
                    else if (path.m_finalNetInfo.IsElevatedIslandPlatformMetroStationTrack())
                    {
                        path.AssignNetInfo(ModTrackNames.TRAIN_STATION_TRACK_ELEVATED_ISLAND, false);
                    }
                    else if (path.m_finalNetInfo.IsGroundIslandPlatformMetroStationTrack())
                    {
                        path.AssignNetInfo(ModTrackNames.TRAIN_STATION_TRACK_GROUND_ISLAND, false);
                    }
                    else if (path.m_finalNetInfo.IsElevatedLargeSidePlatformMetroStationTrack())
                    {
                        path.AssignNetInfo(ModTrackNames.TRAIN_STATION_TRACK_ELEVATED_LARGE, false);
                    }
                    else if (path.m_finalNetInfo.IsGroundLargeSidePlatformMetroStationTrack())
                    {
                        path.AssignNetInfo(ModTrackNames.TRAIN_STATION_TRACK_GROUND_LARGE, false);
                    }
                    else if (path.m_finalNetInfo.IsElevatedDualIslandPlatformMetroStationTrack())
                    {
                        path.AssignNetInfo(ModTrackNames.TRAIN_STATION_TRACK_ELEVATED_LARGE_DUALISLAND, false);
                    }
                    else if (path.m_finalNetInfo.IsGroundDualIslandPlatformMetroStationTrack())
                    {
                        path.AssignNetInfo(ModTrackNames.TRAIN_STATION_TRACK_GROUND_LARGE_DUALISLAND, false);
                    }
                }
                else if (path.m_finalNetInfo.IsMetroTrack())
                {
                    if (path.m_finalNetInfo)
                    {
                        path.AssignNetInfo(ModTrackNames.GetTrackAnalogName(path.m_finalNetInfo.name), false);
                    }
                    //FixSlopes(info, inx, vehicleType);
                }
                break;

            case TrackVehicleType.Metro:
                if (path.m_finalNetInfo.IsAbovegroundTrainStationTrack())
                {
                    if (path.m_finalNetInfo.IsElevatedSidePlatformTrainStationTrack())
                    {
                        path.AssignNetInfo(ModTrackNames.MOM_STATION_TRACK_ELEVATED, false);
                    }
                    else if (path.m_finalNetInfo.IsSunkenSidePlatformTrainStationTrack())
                    {
                        path.AssignNetInfo(ModTrackNames.MOM_STATION_TRACK_SUNKEN, false);
                    }
                    else if (path.m_finalNetInfo.IsGroundSidePlatformTrainStationTrack())
                    {
                        path.AssignNetInfo(ModTrackNames.MOM_STATION_TRACK_GROUND, false);
                    }
                    else if (path.m_finalNetInfo.IsElevatedSinglePlatformTrainStationTrack())
                    {
                        InvertPath(path);
                        path.AssignNetInfo(ModTrackNames.MOM_STATION_TRACK_ELEVATED_SMALL, false);
                    }
                    else if (path.m_finalNetInfo.IsGroundSinglePlatformTrainStationTrack())
                    {
                        InvertPath(path);
                        path.AssignNetInfo(ModTrackNames.MOM_STATION_TRACK_GROUND_SMALL, false);
                    }
                    else if (path.m_finalNetInfo.IsElevatedIslandPlatformTrainStationTrack())
                    {
                        path.AssignNetInfo(ModTrackNames.MOM_STATION_TRACK_ELEVATED_ISLAND, false);
                    }
                    else if (path.m_finalNetInfo.IsGroundIslandPlatformTrainStationTrack())
                    {
                        path.AssignNetInfo(ModTrackNames.MOM_STATION_TRACK_GROUND_ISLAND, false);
                    }
                    else if (path.m_finalNetInfo.IsElevatedLargeSidePlatformTrainStationTrack())
                    {
                        path.AssignNetInfo(ModTrackNames.MOM_STATION_TRACK_ELEVATED_LARGE, false);
                    }
                    else if (path.m_finalNetInfo.IsGroundLargeSidePlatformTrainStationTrack())
                    {
                        path.AssignNetInfo(ModTrackNames.MOM_STATION_TRACK_GROUND_LARGE, false);
                    }
                    else if (path.m_finalNetInfo.IsElevatedDualIslandPlatformTrainStationTrack())
                    {
                        path.AssignNetInfo(ModTrackNames.MOM_STATION_TRACK_ELEVATED_LARGE_DUALISLAND, false);
                    }
                    else if (path.m_finalNetInfo.IsGroundDualIslandPlatformTrainStationTrack())
                    {
                        path.AssignNetInfo(ModTrackNames.MOM_STATION_TRACK_GROUND_LARGE_DUALISLAND, false);
                    }
                }
                else if (path.m_finalNetInfo.IsTrainTrack())
                {
                    path.AssignNetInfo(ModTrackNames.GetTrackAnalogName(path.m_finalNetInfo.name), false);
                    //FixSlopes(info, inx, vehicleType);
                }
                break;
            }
        }