CitiesSkylinesMods / TMPE

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

CalculateCornerException #881

Closed kianzarrin closed 4 years ago

kianzarrin commented 4 years ago

@krzychu124 i run 868 and I'm getting exception after loading savegame. I will try different one and also disable all mods to be sure it's not other mod or something


at NetSegment.CalculateCorner (.NetInfo info, Vector3 startPos, Vector3 endPos, Vector3 startDir, Vector3 endDir, .NetInfo extraInfo1, Vector3 extraEndPos1, Vector3 extraStartDir1, Vector3 extraEndDir1, .NetInfo extraInfo2, Vector3 extraEndPos2, Vector3 extraStartDir2, Vector3 extraEndDir2, UInt16 ignoreSegmentID, UInt16 startNodeID, Boolean heightOffset, Boolean leftSide, UnityEngine.Vector3& cornerPos, UnityEngine.Vector3& cornerDirection, System.Boolean& smooth) [0x00000] in <filename unknown>:0 
at NetSegment.CalculateCorner (UInt16 segmentID, Boolean heightOffset, Boolean start, Boolean leftSide, UnityEngine.Vector3& cornerPos, UnityEngine.Vector3& cornerDirection, System.Boolean& smooth) [0x00000] in <filename unknown>:0 
at TrafficManager.Manager.Impl.ExtSegmentEndManager.CalculateCorners (UInt16 segmentId, Boolean startNode) [0x00000] in <filename unknown>:0 
at TrafficManager.Manager.Impl.ExtSegmentEndManager.OnLevelLoading () [0x00000] in <filename unknown>:0 
at TrafficManager.LoadingExtension.OnLevelLoaded (LoadMode mode) [0x00000] in <filename unknown>:0 
at LoadingWrapper.OnLevelLoaded (UpdateMode mode) [0x00000] in <filename unknown>:0 
Rethrow as ModException: The Mod C:\Users\krzychu\AppData\Local\Colossal Order\Cities_Skylines\Addons\Mods\TrafficManager [CSUtil.CameraControl.dll, CSUtil.Commons.dll, TMPE.GenericGameBridge.dll, TMPE.API.dll, TMPE.CitiesGameBridge.dll, TrafficManager.dll] has caused an error

UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object) UnityEngine.DebugLogHandler:LogException(Exception, Object) UnityEngine.Logger:LogException(Exception, Object) UnityEngine.Debug:LogException(Exception) LoadingWrapper:OnLevelLoaded(UpdateMode)

c__Iterator9:MoveNext() LoadingManager:Update() ``` > works on new game, probably because of no roads touched by TM:PE code, loads game it saved when I started new game but throws exception when I'm starting particular savegame > I'm not sure if calculate corners doesn't need a little bit of refactor because of null check > I meant missing NetInfo from missing assets, which cause corners to throw exception ;) segments/nodes were still 'valid' from simulation aspect > @kvakvs that Nullptr with corners on null Netinfo, let me know if its a breaking problem, i'll address it asap
kianzarrin commented 4 years ago

How can I get a null info? which asset is causing it. I want to sub to that asset so that I can reproduce the problem.

originalfoo commented 4 years ago

It can be caused if the asset is removed perhaps? The segments/nodes might still be present (flagged created and not deleted), but not have an associated netinfo.

kianzarrin commented 4 years ago

I managed to reproduce the problem by loading a saved city with placed roads from which I had unsubed.

kianzarrin commented 4 years ago

fixed it by checking for IsSegmentValid