CitiesSkylinesMods / TMPE

Cities: Skylines Traffic Manager: President Edition
https://steamcommunity.com/sharedfiles/filedetails/?id=1637663252
MIT License
571 stars 85 forks source link

Cargo truck transfer pathfinding fixes #1703

Closed krzychu124 closed 1 year ago

krzychu124 commented 1 year ago

Fixes #1701

Note

I've swapped method for matching lanes for RoutingManager, because the original was already used by lane connection tool (and more) and I didn't want to increase complexity or scope of tests. Additionally lanes with CargoVehicles are not available for configuration in game by any tools we support and at this state they are used internally only in form of invisible paths included in building assets and meant to be used as internal paths with certain limitations.

More info about the problem and small test savegame you can find in the mentioned issue.

Build ZIP

kianzarrin commented 1 year ago

do we need to deal with Cargo Vehicle in LaneEndTransitionGroup ?

        public static LaneEndTransitionGroup GetLaneEndTransitionGroup(VehicleInfo.VehicleType vehicleType) {
            LaneEndTransitionGroup ret = 0;
            if (vehicleType.IsFlagSet(ROAD_VEHICLE_TYPES))
                ret |= LaneEndTransitionGroup.Road;
            if (vehicleType.IsFlagSet(TRACK_VEHICLE_TYPES))
                ret |= LaneEndTransitionGroup.Track;
            return ret;
        }

        public static LaneEndTransitionGroup GetLaneEndTransitionGroup(this NetInfo.Lane laneInfo) {
            LaneEndTransitionGroup ret = 0;
            if(laneInfo.MatchesRoad())
                ret |= LaneEndTransitionGroup.Road;
            if (laneInfo.MatchesTrack())
                ret |= LaneEndTransitionGroup.Track;
            return ret;
        }