Open Elesbaan70 opened 2 years ago
This is basically done now, but I want to get NCR working before taking it out of draft status.
I had originally planned make this change before beginning the optimization/reorg of JunctionRestrictionsManager
, but it turned out that I had to do most of that work in conjunction with this. But all the redundancies can't finally be eliminated until the patches are gone from the stable builds of NC2 and NCR.
Solve conflicts and sync with master
? 😅
We need to determine the correct resolution to the duplication of @kianzarrin's JunctionRestrictionFlags
and my JunctionRestrictionsFlags
before this can be merged.
The number of external mods patching junction restrictions is increasing. This really needs to get merged.
The end objectives here were:
The ordinary way to do this would be to make a new cached API, and have the existing methods call the new ones. Unfortunately, this could not be done straightforwardly, because the API methods are being patched by Node Controller, and now also by Adaptive Networks. The conventional approach would leave the new API methods unaffected by the patches, breaking those mods.
Therefore, the following strategy is being followed:
This PR represents Phase 1.
Since most of the TMPE implementation was calling the API methods directly via JunctionRestrictionsManager
instead of through its interface, they all had to be updated when the deprecated API was changed to privately implemented interface methods. This was necessary because the methods they were calling are now an uncached implementation detail, and are not guaranteed to work correctly if called from outside.
This means that a lot of files were changed. Following is a list of the files with functional changes. All other changes are refactoring and eliminating deprecated API calls.
TLM/TLM/Constants.cs TLM/TLM/Hook/Impl/HookFactory.cs TLM/TMPE.API/Hook/IHookFactory.cs TLM/TMPE.API/Hook/IJunctionRestrictionsHook.cs TLM/TMPE.API/Implementations.cs TLM/TMPE.API/Manager/IJunctionRestrictionsManager.cs
JunctionRestrictionsManager
changesTLM/TLM/Manager/Impl/JunctionRestrictionsManager.cs
TLM/TLM/Geometry/Impl/SegmentEndIdApi.cs TLM/TLM/Network/Data/SegmentEndId.cs TLM/TLM/Util/Extensions/SegmentEndIdExtensions.cs
Resolves #902
An
IJunctionRestrictionsHook
API implementing the idea discussed in #1557.I had originally planned make this change before beginning the optimization/reorg of JunctionRestrictionsManager, but it turned out that I had to do most of that work in conjunction with this. But all the redundancies can't finally be eliminated until the patches are gone from the stable builds of NC2 and NCR.
Relevant PRs for the Node Controller projects: https://github.com/MacSergey/NodeController30/pull/55 https://github.com/kianzarrin/NodeController/pull/33