-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
central default value #1702
central default value #1702
Conversation
renamed Options to SavedGameOptions Options are instant fields now.
Doesn't work (loading user savegame)... Info 487.6267004: OptionsManager.LoadData: 61 bytes
Error 487.6488223: System.Reflection.TargetException: Non-static field requires a target
at System.Reflection.MonoField.SetValue (System.Object obj, System.Object val, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
at System.Reflection.FieldInfo.SetValue (System.Object obj, System.Object value) [0x00000] in <filename unknown>:0
at TrafficManager.UI.Helpers.SerializableUIOptionBase`3[TrafficManager.API.Traffic.Enums.SimulationAccuracy,ColossalFramework.UI.UIDropDown,TrafficManager.UI.Helpers.DropDownOption`1[TrafficManager.API.Traffic.Enums.SimulationAccuracy]].set_Value (SimulationAccuracy value) [0x00000] in <filename unknown>:0
at TrafficManager.UI.Helpers.DropDownOption`1[TrafficManager.API.Traffic.Enums.SimulationAccuracy].set_Value (SimulationAccuracy value) [0x00000] in <filename unknown>:0
at TrafficManager.UI.Helpers.DropDownOption`1[TrafficManager.API.Traffic.Enums.SimulationAccuracy].Load (Byte data) [0x00000] in <filename unknown>:0
at TrafficManager.Manager.Impl.OptionsManager.ToOption (System.Byte[] data, UInt32 idx, ILegacySerializableOption opt) [0x00000] in <filename unknown>:0
at TrafficManager.Manager.Impl.OptionsManager.LoadData (System.Byte[] data) [0x00000] in <filename unknown>:0
====================
at CSUtil.Commons.Log.LogToFile(System.String log, LogLevel level)
at CSUtil.Commons.Log.Error(System.String s)
at TrafficManager.Util.Shortcuts.LogException(System.Exception ex, Boolean showInPanel)
at TrafficManager.Manager.Impl.OptionsManager.LoadData(System.Byte[] data)
at TrafficManager.Lifecycle.SerializableDataExtension.Load()
at TrafficManager.Lifecycle.SerializableDataExtension.OnLoadData()
at SerializableDataWrapper.OnLoadData()
at SimulationManager.LateUpdateData(UpdateMode mode, Single minProgress, Single maxProgress)
at SimulationManager.Managers_LateUpdateData(UpdateMode mode, Single minProgress, Single maxProgress)
at LoadingManager+<LoadSimulationData>c__IteratorB.MoveNext()
at AsyncTask.Execute()
at SimulationManager.SimulationStep()
at SimulationManager.SimulationThread() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not work correctly, actually not a surprise for me since I mentioned about that.
Info 521.2699181: Initialization done. Loading mod data now.
Info 521.2834804: Loading VersionInfo Data! Length=424
Info 521.3043247: Reading VersionInfo from config
Info 521.3066605: Save game was created with TM:PE 11.7.2.32153 - Test
Info 521.3096925: Loading Data from New Load Routine! Length=8215
Info 521.3717997: Loading State from Config
Info 521.3738369: Loading 0 extended citizens
Info 521.3771330: Loading 0 extended citizen instances
Info 521.3785392: Priority segments data structure (old) undefined!
Info 521.3812201: Loading 0 priority segments (new method)
Info 521.3839069: Loading parking restrictions data. 0 elements
Info 521.3864258: Loading lane vehicle restriction data. 0 elements
Info 521.4002488: Loading 0 timed traffic lights (new method)
Info 521.4036183: Loading junction traffic light data (old method)
Info 521.4065993: Loading toggled traffic lights (new method)
Info 521.4076064: Lane arrow data structure (old) undefined!
Info 521.4103714: Loading lane arrow data (new method)
Info 521.4123714: Loading 0 lane connections
Info 521.4149324: Loading 0 lane connections
Info 521.4161229: Loading 0 lane connections
Info 521.4190053: Loading custom default speed limit data. 0 elements
Info 521.4218735: Loading lane speed limit data. 0 elements
Info 521.4249492: Loading junction restrictions. 0 elements
Info 521.4293720: OptionsManager.LoadData: 3497 bytes
Error 521.4362877: unrecognised value:60 for enum:SimulationAccuracy
at CSUtil.Commons.Log.LogToFile(System.String log, LogLevel level)
at CSUtil.Commons.Log.Error(System.String s)
at TrafficManager.UI.Helpers.DropDownOption`1[[TrafficManager.API.Traffic.Enums.SimulationAccuracy, TMPE.API, Version=11.7.2.32152, Culture=neutral, PublicKeyToken=null]].set_Value(SimulationAccuracy value)
at TrafficManager.UI.Helpers.DropDownOption`1[[TrafficManager.API.Traffic.Enums.SimulationAccuracy, TMPE.API, Version=11.7.2.32152, Culture=neutral, PublicKeyToken=null]].Load(Byte data)
at TrafficManager.Manager.Impl.OptionsManager.ToOption(System.Byte[] data, UInt32 idx, ILegacySerializableOption opt)
at TrafficManager.Manager.Impl.OptionsManager.LoadDataLegacy(System.Byte[] data)
at TrafficManager.Manager.Impl.OptionsManager.LoadData(System.Byte[] data)
at TrafficManager.Lifecycle.SerializableDataExtension.Load()
at TrafficManager.Lifecycle.SerializableDataExtension.OnLoadData()
at SerializableDataWrapper.OnLoadData()
at SimulationManager.LateUpdateData(UpdateMode mode, Single minProgress, Single maxProgress)
at SimulationManager.Managers_LateUpdateData(UpdateMode mode, Single minProgress, Single maxProgress)
at LoadingManager+<LoadSimulationData>c__IteratorB.MoveNext()
at AsyncTask.Execute()
at SimulationManager.SimulationStep()
at SimulationManager.SimulationThread()
Error 521.4419724: unrecognised value:120 for enum:RecklessDrivers
at CSUtil.Commons.Log.LogToFile(System.String log, LogLevel level)
at CSUtil.Commons.Log.Error(System.String s)
at TrafficManager.UI.Helpers.DropDownOption`1[[TrafficManager.API.Traffic.Enums.RecklessDrivers, TMPE.API, Version=11.7.2.32152, Culture=neutral, PublicKeyToken=null]].set_Value(RecklessDrivers value)
at TrafficManager.UI.Helpers.DropDownOption`1[[TrafficManager.API.Traffic.Enums.RecklessDrivers, TMPE.API, Version=11.7.2.32152, Culture=neutral, PublicKeyToken=null]].Load(Byte data)
at TrafficManager.Manager.Impl.OptionsManager.ToOption(System.Byte[] data, UInt32 idx, ILegacySerializableOption opt)
at TrafficManager.Manager.Impl.OptionsManager.LoadDataLegacy(System.Byte[] data)
at TrafficManager.Manager.Impl.OptionsManager.LoadData(System.Byte[] data)
at TrafficManager.Lifecycle.SerializableDataExtension.Load()
at TrafficManager.Lifecycle.SerializableDataExtension.OnLoadData()
at SerializableDataWrapper.OnLoadData()
at SimulationManager.LateUpdateData(UpdateMode mode, Single minProgress, Single maxProgress)
at SimulationManager.Managers_LateUpdateData(UpdateMode mode, Single minProgress, Single maxProgress)
at LoadingManager+<LoadSimulationData>c__IteratorB.MoveNext()
at AsyncTask.Execute()
at SimulationManager.SimulationStep()
at SimulationManager.SimulationThread()
Info 521.4852683: CheckboxOption.Value: `nodesOverlay` changed to True
Info 521.4874312: CheckboxOption.Value: `allowEnterBlockedJunctions` changed to True
Info 521.4885719: CheckboxOption.Value: `advancedAI` changed to True
Info 521.4895001: CheckboxOption.Value: `highwayRules` changed to True
Info 521.4939077: CheckboxOption.Value: `strongerRoadConditionEffects` changed to True
Info 521.4949835: CheckboxOption.Value: `allowUTurns` changed to True
Info 521.4964012: CheckboxOption.Value: `allowLaneChangesWhileGoingStraight` changed to True
Info 521.4979016: CheckboxOption.Value: `disableDespawning` changed to True
Info 521.4998670: CheckboxOption.Value: `parkingAI` changed to True
Info 521.5018157: CheckboxOption.Value: `preferOuterLane` changed to True
Info 521.5063603: CheckboxOption.Value: `evacBussesMayIgnoreRules` changed to True
Info 521.5078081: CheckboxOption.Value: `banRegularTrafficOnBusLanes` changed to True
Info 521.5100523: CheckboxOption.Value: `showPathFindStats` changed to True
Info 521.5141986: SliderOption.Value: `altLaneSelectionRatio` changed to 45
Error 521.5195614: unrecognised value:54 for enum:VehicleRestrictionsAggression
at CSUtil.Commons.Log.LogToFile(System.String log, LogLevel level)
at CSUtil.Commons.Log.Error(System.String s)
at TrafficManager.UI.Helpers.DropDownOption`1[[TrafficManager.API.Traffic.Enums.VehicleRestrictionsAggression, TMPE.API, Version=11.7.2.32152, Culture=neutral, PublicKeyToken=null]].set_Value(VehicleRestrictionsAggression value)
at TrafficManager.UI.Helpers.DropDownOption`1[[TrafficManager.API.Traffic.Enums.VehicleRestrictionsAggression, TMPE.API, Version=11.7.2.32152, Culture=neutral, PublicKeyToken=null]].Load(Byte data)
at TrafficManager.Manager.Impl.OptionsManager.ToOption(System.Byte[] data, UInt32 idx, ILegacySerializableOption opt)
at TrafficManager.Manager.Impl.OptionsManager.LoadDataLegacy(System.Byte[] data)
at TrafficManager.Manager.Impl.OptionsManager.LoadData(System.Byte[] data)
at TrafficManager.Lifecycle.SerializableDataExtension.Load()
at TrafficManager.Lifecycle.SerializableDataExtension.OnLoadData()
at SerializableDataWrapper.OnLoadData()
at SimulationManager.LateUpdateData(UpdateMode mode, Single minProgress, Single maxProgress)
at SimulationManager.Managers_LateUpdateData(UpdateMode mode, Single minProgress, Single maxProgress)
at LoadingManager+<LoadSimulationData>c__IteratorB.MoveNext()
at AsyncTask.Execute()
at SimulationManager.SimulationStep()
at SimulationManager.SimulationThread()
Info 521.5222948: CheckboxOption.Value: `trafficLightPriorityRules` changed to True
Info 521.5239486: CheckboxOption.Value: `realisticPublicTransport` changed to True
Info 521.5254218: CheckboxOption.Value: `allowNearTurnOnRed` changed to True
Info 521.5271850: CheckboxOption.Value: `allowFarTurnOnRed` changed to True
Info 521.5288149: CheckboxOption.Value: `RoundAboutQuickFix_NoCrossYieldR` changed to True
Info 521.5302995: CheckboxOption.Value: `PriorityRoad_CrossMainR` changed to True
Info 521.5326717: CheckboxOption.Value: `PriorityRoad_AllowLeftTurns` changed to True
Info 521.5342372: CheckboxOption.Value: `PriorityRoad_EnterBlockedYeild` changed to True
Info 521.5357333: CheckboxOption.Value: `PriorityRoad_StopAtEntry` changed to True
Info 521.5374737: CheckboxOption.Value: `RoundAboutQuickFix_RealisticSpeedLimits` changed to True
Info 521.5384945: CheckboxOption.Value: `RoundAboutQuickFix_ParkingBanYieldR` changed to True
Info 521.5399277: CheckboxOption.Value: `NoDoubleCrossings` changed to True
Info 521.5413940: CheckboxOption.Value: `DedicatedTurningLanes` changed to True
Info 521.5428891: CheckboxOption.Value: `showDefaultSpeedSubIcon` changed to True
Info 521.5443958: CheckboxOption.Value: `highwayMergingRules` changed to True
Info 521.5461050: OnLoadData completed successfully.
Seriously, looking at what values it tried to convert to enum something went horribly wrong and I have no idea what it actually saved in that xml...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok, UI remains synced when switching savegame 👍
Options
class into 2 classes:SavedGameOptions
(for the values) andTMPESettings
(for the UI).SavedGameOptions
(before it was hard coded in the loading code).SavedGameOptions
and instant class so that I can reset default values by InstantiatingSavedGameOptions
.bonus fix: replaced 'Ldarg_2(copies vehicle struct) with
Ldarga_S, 2` (loads address to vehicle struct - notice extra 'a' that stands for address).SavedGameOptions
is Ensured (created if needed) inOnSettingsUI()
andOnBeforeLoadData()
and its released inPreload()
andUnload()
.Note: No functional change
![image](https://user-images.githubusercontent.com/26344691/204596754-22eba460-5e9e-4e79-b163-a00f098d25b8.png)
Hint: you might want to review this commit separately . this is rename and has 90% of changes.
TMPE.zip