CitiesSkylinesMods / TMPE

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

lane connection "SUB" manager #1546

Closed kianzarrin closed 2 years ago

kianzarrin commented 2 years ago

phase 2 preparation for #354. continuation of #1545 TMPE.zip

This PR has no functional change. Just moving code from `Lane Connection manager to.

In this PR there is only one instance of the SUB manager which handles both road/track connections. This is just a preparation for the next PR where There will be 2 sub managers and I will change the code Like this.

// this is my plan for the next PR:
public class LaneConnectionManger {
- SubManager = new LaneConnectionSubManager(LaneEndTransitionGroup.ALL); // step 2
+ Road = new LaneConnectionSubManager(LaneEndTransitionGroup.Road); // step 3
+ Track = new LaneConnectionSubManager(LaneEndTransitionGroup.Track); // step 3

// usage: depending on the context ...
- LaneConnectionManager.Instance.Sub.SomeMethod(...); // replace this line ...
+ LaneConnectionManager.Instance.Road.SomeMethod(...); // with this line ...
+ LaneConnectionManager.Instance.Track.SomeMethod(...); // or this line.

Next PR will be final and will make major changes to persistency/UI code. To avoid a giant PR I decided to break it down into multiple PRs.


Compatibility with external mods:

I fixed a bug in TMPE.API that failed to get ManagersFactory. Now it is working.

For backward compatibility with my mods I did not remove implementations of ILaneConnectionManager from LaneConnectoinManager even if I didn't call them from TMPE.

used TMPE API in my mods: HUT-DCR.zip

EDIT: I cherry picked the API fix and created #1548. I need this hotfix in both Test/Stable before I can upload my mods to WS.